diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rwxr-xr-x | bin/cloud-init | 5 | ||||
-rw-r--r-- | cloudinit/config/cc_write_files.py | 22 | ||||
-rw-r--r-- | config/cloud.cfg | 1 | ||||
-rw-r--r-- | doc/examples/cloud-config-write-files.txt | 16 | ||||
-rwxr-xr-x | sysvinit/cloud-init | 2 |
6 files changed, 24 insertions, 23 deletions
@@ -1,4 +1,5 @@ 0.7.0: + - add write-files module (LP: #1012854) - Add setuptools + cheetah to debian package build dependencies (LP: #1022101) - Adjust the sysvinit local script to provide 'cloud-init-local' and have the cloud-config script depend on that as well. diff --git a/bin/cloud-init b/bin/cloud-init index fafd176d..1f017475 100755 --- a/bin/cloud-init +++ b/bin/cloud-init @@ -160,7 +160,10 @@ def main_init(name, args): # objects config as it may be different from init object # 10. Run the modules for the 'init' stage # 11. Done! - w_msg = welcome_format(name) + if not args.local: + w_msg = welcome_format(name) + else: + w_msg = welcome_format("%s-local" % (name)) init = stages.Init(deps) # Stage 1 init.read_cfg(extract_fns(args)) diff --git a/cloudinit/config/cc_write_files.py b/cloudinit/config/cc_write_files.py index 061b9810..1bfa4c25 100644 --- a/cloudinit/config/cc_write_files.py +++ b/cloudinit/config/cc_write_files.py @@ -38,23 +38,23 @@ def handle(name, cfg, _cloud, log, _args): write_files(name, files, log) -def canonicalize_extraction(compression_type, log): - if not compression_type: - compression_type = '' - compression_type = compression_type.lower().strip() - if compression_type in ['gz', 'gzip']: +def canonicalize_extraction(encoding_type, log): + if not encoding_type: + encoding_type = '' + encoding_type = encoding_type.lower().strip() + if encoding_type in ['gz', 'gzip']: return ['application/x-gzip'] - if compression_type in ['gz+base64', 'gzip+base64', 'gz+b64', 'gzip+b64']: + if encoding_type in ['gz+base64', 'gzip+base64', 'gz+b64', 'gzip+b64']: return ['application/base64', 'application/x-gzip'] # Yaml already encodes binary data as base64 if it is given to the # yaml file as binary, so those will be automatically decoded for you. # But the above b64 is just for people that are more 'comfortable' # specifing it manually (which might be a possiblity) - if compression_type in ['b64', 'base64']: + if encoding_type in ['b64', 'base64']: return ['application/base64'] - if compression_type: - log.warn("Unknown compression type %s, assuming %s", - compression_type, UNKNOWN_ENC) + if encoding_type: + log.warn("Unknown encoding type %s, assuming %s", + encoding_type, UNKNOWN_ENC) return [UNKNOWN_ENC] @@ -69,7 +69,7 @@ def write_files(name, files, log): i + 1, name) continue path = os.path.abspath(path) - extractions = canonicalize_extraction(f_info.get('compression'), log) + extractions = canonicalize_extraction(f_info.get('encoding'), log) contents = extract_contents(f_info.get('content', ''), extractions) (u, g) = util.extract_usergroup(f_info.get('owner', DEFAULT_OWNER)) perms = decode_perms(f_info.get('permissions'), DEFAULT_PERMS, log) diff --git a/config/cloud.cfg b/config/cloud.cfg index cb51d061..72e413d5 100644 --- a/config/cloud.cfg +++ b/config/cloud.cfg @@ -21,6 +21,7 @@ preserve_hostname: false # The modules that run in the 'init' stage cloud_init_modules: - bootcmd + - write-files - resizefs - set_hostname - update_hostname diff --git a/doc/examples/cloud-config-write-files.txt b/doc/examples/cloud-config-write-files.txt index 09ec12c2..9c4e3998 100644 --- a/doc/examples/cloud-config-write-files.txt +++ b/doc/examples/cloud-config-write-files.txt @@ -2,25 +2,21 @@ # vim: syntax=yaml # # This is the configuration syntax that the write_files module -# will know how to understand, it can be given b64, b32, b16, or -# gz (or gz+b64) encoded strings which will be decoded accordingly -# and then written to the path that is provided. +# will know how to understand. encoding can be given b64 or gzip or (gz+b64). +# The content will be decoded accordingly and then written to the path that is +# provided. # # Note: Content strings here are truncated for example purposes. -# write_files: -- compression: b64 +- encoding: b64 content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4... owner: root:root path: /etc/sysconfig/selinux perms: '0644' -- content: ' - +- content: | # My new /etc/sysconfig/samba file SMBDOPTIONS="-D" - - ' path: /etc/sysconfig/samba - content: !!binary | f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAwARAAAAAAABAAAAAAAAAAJAVAAAAAAAAAAAAAEAAOAAI @@ -29,7 +25,7 @@ write_files: .... path: /bin/arch perms: '0555' -- compression: gzip +- encoding: gzip content: !!binary | H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA= path: /usr/bin/hello diff --git a/sysvinit/cloud-init b/sysvinit/cloud-init index 7726c452..4b44a615 100755 --- a/sysvinit/cloud-init +++ b/sysvinit/cloud-init @@ -26,7 +26,7 @@ ### BEGIN INIT INFO # Provides: cloud-init # Required-Start: $local_fs $network $named $remote_fs -# Should-Start: $time +# Should-Start: $time cloud-init-local # Required-Stop: # Should-Stop: # Default-Start: 3 5 |