From 36bbd898e9b8bef508b5d185dc1e52af0f13cfd0 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 20 Jul 2013 05:56:30 -0700 Subject: Add usage of '#json-patch' --- cloudinit/handlers/cloud_config.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'cloudinit/handlers/cloud_config.py') 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 = [ -- cgit v1.2.3