From 1f711f1005da406eb00d7068421cfa45e8fcd5a0 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 24 Sep 2015 16:27:46 +0000 Subject: Attempt 2 of "Allow firehose config split into directories" --- firehose_call.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'firehose_call.py') diff --git a/firehose_call.py b/firehose_call.py index 8e7b75c..bdf23de 100644 --- a/firehose_call.py +++ b/firehose_call.py @@ -4,7 +4,7 @@ import os FIREHOSE_DIR = 'src/firehose' LOGFILE = os.path.expanduser("~/orchestration/trigger_log") -from firehose_mappings import mapping +from firehose_config import get_landings log_file = open(LOGFILE,'a') @@ -35,17 +35,13 @@ if __name__ == '__main__': print "firehose_map.py requires a repo argument" exit(1) - try: - configs = mapping[repo] - except: - log("Unknown repo: %s, Firehose not triggered" % repo) - exit(0) - - os.chdir(FIREHOSE_DIR) - exit_val = subprocess.call(firehose_cmd(configs)) - if not exit_val: - log("Successful") - exit(exit_val) - else: - log("Unsuccessful") - exit(exit_val) + landings = get_landings(FIREHOSE_DIR) + + for configs in landings: + if not configs: continue + exit_val = subprocess.call(firehose_cmd(configs), cwd=FIREHOSE_DIR) + if not exit_val: + log("Successfully configured %s" % ', '.join(configs)) + else: + log("Unsuccessful") + exit(exit_val) -- cgit v1.2.1