summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-03-03 20:04:24 -0500
committerScott Moser <smoser@ubuntu.com>2011-03-03 20:04:24 -0500
commitf885aaf58da84660f8354cc4a3d4eef3444569f9 (patch)
treec4bc1237a0319138371289d53374b2b055aeee7a /cloudinit/CloudConfig
parenta23be741c23978064d0fe6ff6bd8e7fcf0c2cfa8 (diff)
downloadvyos-cloud-init-f885aaf58da84660f8354cc4a3d4eef3444569f9.tar.gz
vyos-cloud-init-f885aaf58da84660f8354cc4a3d4eef3444569f9.zip
make update of sources not prevent installation attempt (LP: #728167)
LP: #728167
Diffstat (limited to 'cloudinit/CloudConfig')
-rw-r--r--cloudinit/CloudConfig/cc_apt_update_upgrade.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/cloudinit/CloudConfig/cc_apt_update_upgrade.py b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
index 30ef8d44..f361b8a4 100644
--- a/cloudinit/CloudConfig/cc_apt_update_upgrade.py
+++ b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
@@ -55,15 +55,34 @@ def handle(name,cfg,cloud,log,args):
log.error("Failed to run debconf-set-selections")
log.debug(traceback.format_exc())
+ errors = [ ]
if update:
- cc.update_package_sources()
+ try:
+ cc.update_package_sources()
+ except subprocess.CalledProcessError as e:
+ log.warn("apt-get update failed")
+ log.debug(traceback.format_exc())
+ errors.append(e)
if upgrade:
- cc.apt_get("upgrade")
+ try:
+ cc.apt_get("upgrade")
+ except subprocess.CalledProcessError as e:
+ log.warn("apt upgrade failed")
+ log.debug(traceback.format_exc())
+ errors.append(e)
pkglist = util.get_cfg_option_list_or_str(cfg,'packages',[])
if len(pkglist):
- cc.install_packages(pkglist)
+ try:
+ cc.install_packages(pkglist)
+ except subprocess.CalledProcessError as e:
+ log.warn("Failed to install packages: %s " % pkglist)
+ log.debug(traceback.format_exc())
+ errors.append(e)
+
+ if len(errors):
+ raise errors[0]
return(True)