Skip to content
Snippets Groups Projects
Commit 8a3b69dc authored by Ben Morrice's avatar Ben Morrice
Browse files

Simplify some code

parent 0e66d8e6
No related branches found
No related tags found
1 merge request!9Various improvements
......@@ -145,7 +145,9 @@ def get_upstream(token, feed):
packages.append(f"{package},{checksum}")
if count == 100:
offset += count
print(f"{feed}: incrementing offset to {offset}", flush=True)
else:
print(f"{feed}: up-to-date", flush=True)
break
return packages
......@@ -223,7 +225,7 @@ def format_release(p, f, token):
response = requests.post(mattermost_integration_url, json=payload)
print(
f" -- Sent notification to Mattermost, response code was {response.status_code}", flush=True
f" -- Sent notification to Mattermost for package {newpackage}, response code was {response.status_code}", flush=True
)
print(f" -- Payload sent: {payload}", flush=True)
......@@ -242,11 +244,7 @@ if __name__ == "__main__":
print(f"{len(differences)} new package(s) detected", flush=True)
for p in differences:
format_release(p, feed, token)
# In case there was an API fault
# don't overwrite the local packages if upstream is less than local
if upstream_packages > local_packages:
set_local(upstream_packages, feed)
set_local(upstream_packages, feed)
logfile.close()
if os.stat(logfilename).st_size == 0:
os.remove(logfilename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment