summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig/cc_apt_update_upgrade.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2010-06-18 15:00:45 -0400
committerScott Moser <smoser@ubuntu.com>2010-06-18 15:00:45 -0400
commit7c9d41b6b14285e2f161237a3012ad1d1cf5b250 (patch)
tree4d78e2c1644c7212b35e045da6919ef02a836bff /cloudinit/CloudConfig/cc_apt_update_upgrade.py
parentb9d39a834af1c6c30122f503aba695e49f4fecca (diff)
downloadvyos-cloud-init-7c9d41b6b14285e2f161237a3012ad1d1cf5b250.tar.gz
vyos-cloud-init-7c9d41b6b14285e2f161237a3012ad1d1cf5b250.zip
add suport for setting debconf selections through debconf-set-selections
LP: #582667
Diffstat (limited to 'cloudinit/CloudConfig/cc_apt_update_upgrade.py')
-rw-r--r--cloudinit/CloudConfig/cc_apt_update_upgrade.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/cloudinit/CloudConfig/cc_apt_update_upgrade.py b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
index ab2ece93..6d522705 100644
--- a/cloudinit/CloudConfig/cc_apt_update_upgrade.py
+++ b/cloudinit/CloudConfig/cc_apt_update_upgrade.py
@@ -1,5 +1,6 @@
import cloudinit.util as util
import subprocess
+import traceback
import os
def handle(name,cfg,cloud,log,args):
@@ -23,6 +24,15 @@ def handle(name,cfg,cloud,log,args):
for e in errors:
log.warn("Source Error: %s\n" % ':'.join(e))
+ dconf_sel = util.get_cfg_option_str(cfg, 'debconf_selections', False)
+ if dconf_sel:
+ log.debug("setting debconf selections per cloud config")
+ try:
+ util.subp(('debconf-set-selections', '-'), dconf_sel)
+ except:
+ log.error("Failed to run debconf-set-selections")
+ log.debug(traceback.format_exc())
+
pkglist = []
if 'packages' in cfg:
if isinstance(cfg['packages'],list):