mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
tools_update: also yield a boolean to easily know if there's a major yunohost upgrade pending + list of pending migrations (cf change in webadmin to encourage people to check the release note on the forum before yoloupgrading)
This commit is contained in:
parent
6f03bb62ce
commit
86e45f9cbc
1 changed files with 21 additions and 1 deletions
22
src/tools.py
22
src/tools.py
|
@ -401,7 +401,27 @@ def tools_update(target=None):
|
||||||
if len(upgradable_apps) == 0 and len(upgradable_system_packages) == 0:
|
if len(upgradable_apps) == 0 and len(upgradable_system_packages) == 0:
|
||||||
logger.info(m18n.n("already_up_to_date"))
|
logger.info(m18n.n("already_up_to_date"))
|
||||||
|
|
||||||
return {"system": upgradable_system_packages, "apps": upgradable_apps}
|
important_yunohost_upgrade = False
|
||||||
|
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)
|
||||||
|
|
||||||
|
# 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...
|
||||||
|
try:
|
||||||
|
pending_migrations = tools_migrations_list(pending=True)["migrations"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
pending_migrations = []
|
||||||
|
|
||||||
|
return {
|
||||||
|
"system": upgradable_system_packages,
|
||||||
|
"apps": upgradable_apps,
|
||||||
|
"important_yunohost_upgrade": important_yunohost_upgrade,
|
||||||
|
"pending_migrations": pending_migrations,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@is_unit_operation()
|
@is_unit_operation()
|
||||||
|
|
Loading…
Add table
Reference in a new issue