From bb0721b64536f2076b81533aa13858953c106ca0 Mon Sep 17 00:00:00 2001 From: Adam Dodman Date: Mon, 17 Jul 2017 17:03:20 +0100 Subject: [PATCH] Add checking to see if task sent sucessfully This prevents a new current value being written if it did not succeed, allowing it to be retried after the wait period. --- main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index e545564..c022848 100644 --- a/main.py +++ b/main.py @@ -139,10 +139,11 @@ if __name__ == '__main__': branch = 'master' else: branch = config[service]['branch'] - runbuild(config[service].get('drone_repo'), branch) - config[service]['current_value'] = new_value - with open(filepath + '/dronetrigger.cfg', 'w') as configfile: - config.write(configfile) + if (runbuild(config[service].get('drone_repo'), branch)): + config[service]['current_value'] = new_value + with open(filepath + '/dronetrigger.cfg', 'w') as configfile: + config.write(configfile) + print("Successfully build new version for " + service) except: raise