mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Only upgrade system or apps, not both at the same time
This commit is contained in:
parent
0386345637
commit
a16fb94d82
2 changed files with 18 additions and 11 deletions
|
@ -1563,11 +1563,11 @@ tools:
|
||||||
authenticate: all
|
authenticate: all
|
||||||
authenticator: ldap-anonymous
|
authenticator: ldap-anonymous
|
||||||
arguments:
|
arguments:
|
||||||
--ignore-apps:
|
--apps:
|
||||||
help: Ignore apps upgrade
|
help: List of apps to upgrade (all by default)
|
||||||
action: store_true
|
nargs: "*"
|
||||||
--ignore-packages:
|
--system:
|
||||||
help: Ignore APT packages upgrade
|
help: Upgrade only the system packages
|
||||||
action: store_true
|
action: store_true
|
||||||
|
|
||||||
### tools_diagnosis()
|
### tools_diagnosis()
|
||||||
|
|
|
@ -582,22 +582,29 @@ def _dump_sources_list():
|
||||||
|
|
||||||
|
|
||||||
@is_unit_operation()
|
@is_unit_operation()
|
||||||
def tools_upgrade(operation_logger, auth, ignore_apps=False, ignore_packages=False):
|
def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
||||||
"""
|
"""
|
||||||
Update apps & package cache, then display changelog
|
Update apps & package cache, then display changelog
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
ignore_apps -- Ignore apps upgrade
|
apps -- List of apps to upgrade (or [] to update all apps)
|
||||||
ignore_packages -- Ignore APT packages upgrade
|
system -- True to upgrade system
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.utils import packages
|
from yunohost.utils import packages
|
||||||
if packages.dpkg_is_broken():
|
if packages.dpkg_is_broken():
|
||||||
raise YunohostError("dpkg_is_broken")
|
raise YunohostError("dpkg_is_broken")
|
||||||
|
|
||||||
|
if system is not False and apps is not None:
|
||||||
|
# TODO : i18n
|
||||||
|
raise YunohostError("Cannot upgrade both system and apps at the same time")
|
||||||
|
|
||||||
|
if system is False and apps is None:
|
||||||
|
# TODO : i18n
|
||||||
|
raise YunohostError("Please specify --apps OR --system")
|
||||||
|
|
||||||
failure = False
|
failure = False
|
||||||
|
|
||||||
if not ignore_packages:
|
if system is True:
|
||||||
|
|
||||||
# Check that there's indeed some packages to upgrade
|
# Check that there's indeed some packages to upgrade
|
||||||
upgradables = list(_list_upgradable_apt_packages())
|
upgradables = list(_list_upgradable_apt_packages())
|
||||||
|
@ -722,7 +729,7 @@ def tools_upgrade(operation_logger, auth, ignore_apps=False, ignore_packages=Fal
|
||||||
operation_logger.success()
|
operation_logger.success()
|
||||||
|
|
||||||
|
|
||||||
if not ignore_apps:
|
if apps is not None:
|
||||||
try:
|
try:
|
||||||
app_upgrade(auth)
|
app_upgrade(auth)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Reference in a new issue