summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/CloudConfig/cc_apt_update_upgrade.py10
-rw-r--r--doc/examples/cloud-config-TODO.txt15
-rw-r--r--doc/examples/cloud-config.txt14
3 files changed, 24 insertions, 15 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):
diff --git a/doc/examples/cloud-config-TODO.txt b/doc/examples/cloud-config-TODO.txt
index 20db618f..c7ed54ab 100644
--- a/doc/examples/cloud-config-TODO.txt
+++ b/doc/examples/cloud-config-TODO.txt
@@ -18,18 +18,3 @@ apt_conf:
- content: |
DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt -p critical|| true";
-# Provide debconf answers
-#
-# See debconf-set-selections man page.
-#
-# Default: none
-#
-debconf_selections: | # Need to perserve newlines
- # Force debconf priority to critical.
- debconf debconf/priority select critical
-
- # Override default frontend to readline, but allow user to select.
- debconf debconf/frontend select readline
- debconf debconf/frontend seen false
-
-
diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt
index 4cb435f6..8afefcaa 100644
--- a/doc/examples/cloud-config.txt
+++ b/doc/examples/cloud-config.txt
@@ -212,3 +212,17 @@ cloud_config_modules:
# can easily be imported into the configured user
# This can be a single string ('smoser') or a list ([smoser, kirkland])
ssh_import_id: [smoser]
+
+# Provide debconf answers
+#
+# See debconf-set-selections man page.
+#
+# Default: none
+#
+debconf_selections: | # Need to perserve newlines
+ # Force debconf priority to critical.
+ debconf debconf/priority select critical
+
+ # Override default frontend to readline, but allow user to select.
+ debconf debconf/frontend select readline
+ debconf debconf/frontend seen false