From de306922b12743154b699ec9b711737098f0011b Mon Sep 17 00:00:00 2001 From: Derek Carter Date: Thu, 23 Aug 2012 12:30:34 -0400 Subject: [PATCH] scope error with utils.py branch_path --- lib/ansible/utils.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py index 5a0fb46b5c..3743337e74 100644 --- a/lib/ansible/utils.py +++ b/lib/ansible/utils.py @@ -317,17 +317,17 @@ def _gitinfo(): branch = f.readline().split('/')[-1].rstrip("\n") f.close() branch_path = os.path.join(repo_path, "refs", "heads", branch) - if os.path.exists(branch_path): - f = open(branch_path) - commit = f.readline()[:10] - f.close() - date = time.localtime(os.stat(branch_path).st_mtime) - if time.daylight == 0: - offset = time.timezone - else: - offset = time.altzone - result = "({0} {1}) last updated {2} (GMT {3:+04d})".format(branch, commit, - time.strftime("%Y/%m/%d %H:%M:%S", date), offset / -36) + if os.path.exists(branch_path): + f = open(branch_path) + commit = f.readline()[:10] + f.close() + date = time.localtime(os.stat(branch_path).st_mtime) + if time.daylight == 0: + offset = time.timezone + else: + offset = time.altzone + result = "({0} {1}) last updated {2} (GMT {3:+04d})".format(branch, commit, + time.strftime("%Y/%m/%d %H:%M:%S", date), offset / -36) else: result = 'n/a' return result