added option to disable system- and package upgrade as well as service

restart
This commit is contained in:
Fredrik Eriksson 2019-04-07 19:27:15 +02:00
parent bdbad6084b
commit 50af5a9e4d
No known key found for this signature in database
GPG Key ID: 8825C73A0FD1502A
2 changed files with 16 additions and 3 deletions

View File

@ -16,10 +16,19 @@ def main():
conf = sau.config conf = sau.config
log = logging.getLogger(sau.LOGNAME) log = logging.getLogger(sau.LOGNAME)
platform = sau.platforms.get_platform() platform = sau.platforms.get_platform()
reboot_required = False
reboot_recommended = False
if conf.getboolean('default', 'do_system_upgrade', fallback=True):
reboot_required = platform.system_upgrade() reboot_required = platform.system_upgrade()
if conf.getboolean('default', 'do_package_upgrade', fallback=True):
platform.pkg_upgrade() platform.pkg_upgrade()
if conf.getboolean('default', 'do_service_restart', fallback=True):
reboot_recommended = sau.services.restart_services() reboot_recommended = sau.services.restart_services()
if conf.getboolean('default', 'do_reboot', fallback=False): if conf.getboolean('default', 'do_reboot', fallback=False):
if reboot_required: if reboot_required:
log.warning('Rebooting because of a system upgrade') log.warning('Rebooting because of a system upgrade')

View File

@ -16,6 +16,10 @@ min_version_diff=2
# not close all deleted files (any platform) # not close all deleted files (any platform)
do_reboot=no do_reboot=no
do_system_upgrade=yes
do_package_upgrade=yes
do_service_restart=yes
# The packages section contains <package>=<version_diff> pairs to override the # The packages section contains <package>=<version_diff> pairs to override the
# default min_version_diff. Note that package naming may differ depending on # default min_version_diff. Note that package naming may differ depending on