summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--cloudinit/distros/debian.py7
-rw-r--r--doc/examples/cloud-config.txt18
-rw-r--r--doc/merging.rst2
-rwxr-xr-xtools/ccfg-merge-debug81
5 files changed, 108 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 612c7fa7..11a8b9c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,8 @@
(LP: #1023179)
- use python-requests rather than urllib2. By using recent versions of
python-requests, we get https support (LP: #1067888).
+ - make apt-get invoke 'dist-upgrade' rather than 'upgrade' for
+ package_upgrade. (LP: #1164147)
0.7.1:
- sysvinit: fix missing dependency in cloud-init job for RHEL 5.6
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index 4b779d57..0811eefd 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -161,7 +161,12 @@ class Distro(distros.Distro):
elif args and isinstance(args, list):
cmd.extend(args)
- cmd.append(command)
+ subcmd = command
+ if command == "upgrade":
+ subcmd = self.get_option("apt_get_upgrade_subcommand",
+ "dist-upgrade")
+
+ cmd.append(subcmd)
pkglist = util.expand_package_list('%s=%s', pkgs)
cmd.extend(pkglist)
diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt
index 09298655..24b4b36c 100644
--- a/doc/examples/cloud-config.txt
+++ b/doc/examples/cloud-config.txt
@@ -125,6 +125,24 @@ apt_sources:
=Y2oI
-----END PGP PUBLIC KEY BLOCK-----
+## apt config via system_info:
+# under the 'system_info', you can further customize cloud-init's interaction
+# with apt.
+# system_info:
+# apt_get_command: [command, argument, argument]
+# apt_get_upgrade_subcommand: dist-upgrade
+#
+# apt_get_command:
+# To specify a different 'apt-get' command, set 'apt_get_command'.
+# This must be a list, and the subcommand (update, upgrade) is appended to it.
+# default is:
+# ['apt-get', '--option=Dpkg::Options::=--force-confold',
+# '--option=Dpkg::options::=--force-unsafe-io', '--assume-yes', '--quiet']
+#
+# apt_get_upgrade_subcommand:
+# Specify a different subcommand for 'upgrade. The default is 'dist-upgrade'.
+# This is the subcommand that is invoked if package_upgrade is set to true above.
+
# Install additional packages on first boot
#
# Default: none
diff --git a/doc/merging.rst b/doc/merging.rst
index 6344facd..d4d5cd05 100644
--- a/doc/merging.rst
+++ b/doc/merging.rst
@@ -145,7 +145,7 @@ For example, the default string that is used when none is provided is the follow
::
- list(extend)+dict()+str(append)
+ list()+dict()+str()
Dictionary format
********
diff --git a/tools/ccfg-merge-debug b/tools/ccfg-merge-debug
new file mode 100755
index 00000000..aac60528
--- /dev/null
+++ b/tools/ccfg-merge-debug
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+from cloudinit import handlers
+from cloudinit.handlers import cloud_config as cc_part
+from cloudinit import helpers
+from cloudinit.settings import PER_INSTANCE
+from cloudinit import user_data as ud
+
+import argparse
+import os
+import shutil
+import tempfile
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description='test cloud-config merging')
+ parser.add_argument("--output", "-o", metavar="file",
+ help="specify output file", default="-")
+ parser.add_argument('files', nargs='+')
+
+ args = parser.parse_args()
+ outfile = args.output
+ if args.output == "-":
+ outfile = "/dev/stdout"
+
+ tempd = tempfile.mkdtemp()
+ handler_dir = os.path.join(tempd, "hdir")
+ data = None # the 'init' object
+ frequency = PER_INSTANCE
+
+ paths = helpers.Paths({})
+
+ # make a '#include <f1>' style
+ udproc = ud.UserDataProcessor(paths=paths)
+ user_data_msg = udproc.process("#include\n" +
+ '\n'.join([os.path.abspath(f) for f in args.files]))
+
+ ccph = cc_part.CloudConfigPartHandler(paths=paths)
+ ccph.cloud_fn = outfile
+
+ c_handlers = helpers.ContentHandlers()
+ c_handlers.register_defaults([ccph])
+
+ called = []
+ for (_ctype, mod) in c_handlers.iteritems():
+ if mod in called:
+ continue
+ handlers.call_begin(mod, data, frequency)
+ called.append(mod)
+
+ # Walk the user data
+ part_data = {
+ 'handlers': c_handlers,
+ # Any new handlers that are encountered get writen here
+ 'handlerdir': handler_dir,
+ 'data': data,
+ # The default frequency if handlers don't have one
+ 'frequency': frequency,
+ # This will be used when new handlers are found
+ # to help write there contents to files with numbered
+ # names...
+ 'handlercount': 0,
+ }
+
+ handlers.walk(user_data_msg, handlers.walker_callback, data=part_data)
+
+ # Give callbacks opportunity to finalize
+ called = []
+ for (_ctype, mod) in c_handlers.iteritems():
+ if mod in called:
+ continue
+ handlers.call_end(mod, data, frequency)
+ called.append(mod)
+
+ shutil.rmtree(tempd)
+
+if __name__ == "__main__":
+ main()
+
+# vi: ts=4 expandtab