mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #933 from goozbach/scope_error
scope error with utils.py branch_path
This commit is contained in:
commit
b69d11a8e3
1 changed files with 11 additions and 11 deletions
|
@ -317,17 +317,17 @@ def _gitinfo():
|
||||||
branch = f.readline().split('/')[-1].rstrip("\n")
|
branch = f.readline().split('/')[-1].rstrip("\n")
|
||||||
f.close()
|
f.close()
|
||||||
branch_path = os.path.join(repo_path, "refs", "heads", branch)
|
branch_path = os.path.join(repo_path, "refs", "heads", branch)
|
||||||
if os.path.exists(branch_path):
|
if os.path.exists(branch_path):
|
||||||
f = open(branch_path)
|
f = open(branch_path)
|
||||||
commit = f.readline()[:10]
|
commit = f.readline()[:10]
|
||||||
f.close()
|
f.close()
|
||||||
date = time.localtime(os.stat(branch_path).st_mtime)
|
date = time.localtime(os.stat(branch_path).st_mtime)
|
||||||
if time.daylight == 0:
|
if time.daylight == 0:
|
||||||
offset = time.timezone
|
offset = time.timezone
|
||||||
else:
|
else:
|
||||||
offset = time.altzone
|
offset = time.altzone
|
||||||
result = "({0} {1}) last updated {2} (GMT {3:+04d})".format(branch, commit,
|
result = "({0} {1}) last updated {2} (GMT {3:+04d})".format(branch, commit,
|
||||||
time.strftime("%Y/%m/%d %H:%M:%S", date), offset / -36)
|
time.strftime("%Y/%m/%d %H:%M:%S", date), offset / -36)
|
||||||
else:
|
else:
|
||||||
result = 'n/a'
|
result = 'n/a'
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in a new issue