Merge pull request #1519 from YunoHost/ci-format-dev

[CI] Format code with Black
This commit is contained in:
Alexandre Aubin 2022-10-17 23:52:29 +02:00 committed by GitHub
commit 78a4cbacd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 5 deletions

View file

@ -138,7 +138,12 @@ class MyDiagnoser(Diagnoser):
)
# Using yunohost testing channel
if os.system("grep -q '^\\s*deb\\s*.*yunohost.org.*\\stesting' /etc/apt/sources.list /etc/apt/sources.list.d/*") == 0:
if (
os.system(
"grep -q '^\\s*deb\\s*.*yunohost.org.*\\stesting' /etc/apt/sources.list /etc/apt/sources.list.d/*"
)
== 0
):
yield dict(
meta={"test": "apt_yunohost_channel"},
status="WARNING",
@ -150,7 +155,12 @@ class MyDiagnoser(Diagnoser):
# will cause the machine to spontaenously upgrade everything as soon as next debian is released ...
# Note that we grep this from the policy for libc6, because it's hard to know exactly which apt repo
# is configured (it may not be simply debian.org)
if os.system("apt policy libc6 2>/dev/null | grep '^\\s*500' | awk '{print $3}' | tr '/' ' ' | awk '{print $1}' | grep -q 'stable'") == 0:
if (
os.system(
"apt policy libc6 2>/dev/null | grep '^\\s*500' | awk '{print $3}' | tr '/' ' ' | awk '{print $1}' | grep -q 'stable'"
)
== 0
):
yield dict(
meta={"test": "apt_debian_codename"},
status="WARNING",

View file

@ -402,11 +402,13 @@ def tools_update(target=None):
logger.info(m18n.n("already_up_to_date"))
important_yunohost_upgrade = False
if upgradable_system_packages and any(p["name"] == "yunohost" for p in upgradable_system_packages):
if upgradable_system_packages and any(
p["name"] == "yunohost" for p in upgradable_system_packages
):
yunohost = [p for p in upgradable_system_packages if p["name"] == "yunohost"][0]
current_version = yunohost["current_version"].split(".")[:2]
new_version = yunohost["new_version"].split(".")[:2]
important_yunohost_upgrade = (current_version != new_version)
important_yunohost_upgrade = current_version != new_version
# Wrapping this in a try/except just in case for some reason we can't load
# the migrations, which would result in the update/upgrade process being blocked...
@ -521,7 +523,10 @@ def tools_upgrade(operation_logger, target=None):
returncode = call_async_output(dist_upgrade, callbacks, shell=True)
# If yunohost is being upgraded from the webadmin
if any(p["name"] == "yunohost" for p in upgradables) and Moulinette.interface.type == "api":
if (
any(p["name"] == "yunohost" for p in upgradables)
and Moulinette.interface.type == "api"
):
# Restart the API after 10 sec (at now doesn't support sub-minute times...)
# We do this so that the API / webadmin still gets the proper HTTP response