diff options
author | Joshua Harlow <harlowja@gmail.com> | 2013-07-20 05:56:30 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2013-07-20 05:56:30 -0700 |
commit | 36bbd898e9b8bef508b5d185dc1e52af0f13cfd0 (patch) | |
tree | 5e923e7f756c518ad21fe3fcbb6d05cd98037035 | |
parent | f51e04ba97a42782e6a0e973488290552346387f (diff) | |
download | vyos-cloud-init-36bbd898e9b8bef508b5d185dc1e52af0f13cfd0.tar.gz vyos-cloud-init-36bbd898e9b8bef508b5d185dc1e52af0f13cfd0.zip |
Add usage of '#json-patch'
-rw-r--r-- | cloudinit/handlers/__init__.py | 1 | ||||
-rw-r--r-- | cloudinit/handlers/cloud_config.py | 17 |
2 files changed, 9 insertions, 9 deletions
diff --git a/cloudinit/handlers/__init__.py b/cloudinit/handlers/__init__.py index 497d68c5..297e7451 100644 --- a/cloudinit/handlers/__init__.py +++ b/cloudinit/handlers/__init__.py @@ -62,6 +62,7 @@ INCLUSION_TYPES_MAP = { '#part-handler': 'text/part-handler', '#cloud-boothook': 'text/cloud-boothook', '#cloud-config-archive': 'text/cloud-config-archive', + '#json-patch': 'application/json-patch+json', } # Sorted longest first diff --git a/cloudinit/handlers/cloud_config.py b/cloudinit/handlers/cloud_config.py index 8d1ba37f..84653375 100644 --- a/cloudinit/handlers/cloud_config.py +++ b/cloudinit/handlers/cloud_config.py @@ -66,22 +66,21 @@ class CloudConfigPartHandler(handlers.Handler): def list_types(self): ctypes_handled = [ handlers.type_from_starts_with("#cloud-config"), - JSON_PATCH_CTYPE, + handlers.type_from_starts_with("#json-patch"), ] return ctypes_handled def _write_cloud_config(self): - if not self.cloud_fn: + if not self.cloud_fn or not len(self.file_names): return # Capture which files we merged from... file_lines = [] - if self.file_names: - file_lines.append("# from %s files" % (len(self.file_names))) - for fn in self.file_names: - if not fn: - fn = '?' - file_lines.append("# %s" % (fn)) - file_lines.append("") + file_lines.append("# from %s files" % (len(self.file_names))) + for fn in self.file_names: + if not fn: + fn = '?' + file_lines.append("# %s" % (fn)) + file_lines.append("") if self.cloud_buf is not None: # Something was actually gathered.... lines = [ |