summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/CloudConfig/cc_apt_update_upgrade.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/CloudConfig/cc_apt_update_upgrade.py b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
index f361b8a4..495b8522 100644
--- a/cloudinit/CloudConfig/cc_apt_update_upgrade.py
+++ b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
@@ -55,8 +55,10 @@ def handle(name,cfg,cloud,log,args):
log.error("Failed to run debconf-set-selections")
log.debug(traceback.format_exc())
+ pkglist = util.get_cfg_option_list_or_str(cfg,'packages',[])
+
errors = [ ]
- if update:
+ if update or len(pkglist) or upgrade:
try:
cc.update_package_sources()
except subprocess.CalledProcessError as e:
@@ -72,7 +74,6 @@ def handle(name,cfg,cloud,log,args):
log.debug(traceback.format_exc())
errors.append(e)
- pkglist = util.get_cfg_option_list_or_str(cfg,'packages',[])
if len(pkglist):
try:
cc.install_packages(pkglist)