From 7f2f2d5cdcff18f5604150a79cdb5265df1b8e9d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Tue, 18 Jun 2019 16:37:31 +0200 Subject: [PATCH] Declare the variable before using it and small style fix Signed-off-by: Pierre-Yves Chibon --- playbooks/roles/flag_ci_pr/files/flag_ci_pr.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py b/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py index 4c35376..fd00c17 100644 --- a/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py +++ b/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py @@ -44,6 +44,7 @@ def main(msg, pipeline_state='complete', seed='empty'): print("Pipeline state is not 'complete' or 'running'.") return + commit_hash_text = '' # test complete messages if pipeline_state == 'complete': done_states = { @@ -60,8 +61,6 @@ def main(msg, pipeline_state='complete', seed='empty'): human_status = done_states[state]['human'] if 'commit_hash' in msg: commit_hash_text = ' for %s' % msg['commit_hash'][:8] - else: - commit_hash_text = '' # test running messages elif pipeline_state == 'running': @@ -78,7 +77,7 @@ def main(msg, pipeline_state='complete', seed='empty'): data = { 'username': 'Fedora CI', 'status': status, - 'comment': 'Package tests%s: %s' % (commit_hash_text,human_status), + 'comment': 'Package tests%s: %s' % (commit_hash_text, human_status), 'url': msg['build_url'], 'uid': hashlib.md5(pr_id + seed).hexdigest() }