1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-03 17:50:11 +02:00

Merge branch 'status_at_end' into 'master'

Also write status.json when command finished

See merge request fdroid/fdroidserver!1172
This commit is contained in:
Hans-Christoph Steiner 2022-08-25 08:54:07 +00:00
commit 271e0ab232

View File

@ -900,13 +900,17 @@ def write_status_json(output, pretty=False, name=None):
os.makedirs(status_dir) os.makedirs(status_dir)
if not name: if not name:
output['endTimestamp'] = int(datetime.now(timezone.utc).timestamp() * 1000) output['endTimestamp'] = int(datetime.now(timezone.utc).timestamp() * 1000)
name = sys.argv[0].split()[1] # fdroid subcommand names = ['running', sys.argv[0].split()[1]] # fdroid subcommand
path = os.path.join(status_dir, name + '.json') else:
with open(path, 'w') as fp: names = [name]
if pretty:
json.dump(output, fp, sort_keys=True, cls=Encoder, indent=2) for fname in names:
else: path = os.path.join(status_dir, fname + '.json')
json.dump(output, fp, sort_keys=True, cls=Encoder, separators=(',', ':')) with open(path, "w", encoding="utf-8") as fp:
if pretty:
json.dump(output, fp, sort_keys=True, cls=Encoder, indent=2)
else:
json.dump(output, fp, sort_keys=True, cls=Encoder, separators=(',', ':'))
rsync_status_file_to_repo(path, repo_subdir='status') rsync_status_file_to_repo(path, repo_subdir='status')