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
|
||||
authenticator: ldap-anonymous
|
||||
arguments:
|
||||
--ignore-apps:
|
||||
help: Ignore apps upgrade
|
||||
action: store_true
|
||||
--ignore-packages:
|
||||
help: Ignore APT packages upgrade
|
||||
--apps:
|
||||
help: List of apps to upgrade (all by default)
|
||||
nargs: "*"
|
||||
--system:
|
||||
help: Upgrade only the system packages
|
||||
action: store_true
|
||||
|
||||
### tools_diagnosis()
|
||||
|
|
|
@ -582,22 +582,29 @@ def _dump_sources_list():
|
|||
|
||||
|
||||
@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
|
||||
|
||||
Keyword arguments:
|
||||
ignore_apps -- Ignore apps upgrade
|
||||
ignore_packages -- Ignore APT packages upgrade
|
||||
|
||||
apps -- List of apps to upgrade (or [] to update all apps)
|
||||
system -- True to upgrade system
|
||||
"""
|
||||
from yunohost.utils import packages
|
||||
if packages.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
|
||||
|
||||
if not ignore_packages:
|
||||
if system is True:
|
||||
|
||||
# Check that there's indeed some packages to upgrade
|
||||
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()
|
||||
|
||||
|
||||
if not ignore_apps:
|
||||
if apps is not None:
|
||||
try:
|
||||
app_upgrade(auth)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Add table
Reference in a new issue