add suport for setting debconf selections through debconf-set-selections
This commit is contained in:
parent
0adf05faad
commit
fc5be66e5b
@ -1,5 +1,6 @@
|
|||||||
import cloudinit.util as util
|
import cloudinit.util as util
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import traceback
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def handle(name,cfg,cloud,log,args):
|
def handle(name,cfg,cloud,log,args):
|
||||||
@ -23,6 +24,15 @@ def handle(name,cfg,cloud,log,args):
|
|||||||
for e in errors:
|
for e in errors:
|
||||||
log.warn("Source Error: %s\n" % ':'.join(e))
|
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 = []
|
pkglist = []
|
||||||
if 'packages' in cfg:
|
if 'packages' in cfg:
|
||||||
if isinstance(cfg['packages'],list):
|
if isinstance(cfg['packages'],list):
|
||||||
|
@ -18,18 +18,3 @@ apt_conf:
|
|||||||
- content: |
|
- content: |
|
||||||
DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt -p critical|| true";
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,3 +212,17 @@ cloud_config_modules:
|
|||||||
# can easily be imported into the configured user
|
# can easily be imported into the configured user
|
||||||
# This can be a single string ('smoser') or a list ([smoser, kirkland])
|
# This can be a single string ('smoser') or a list ([smoser, kirkland])
|
||||||
ssh_import_id: [smoser]
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user