diff options
Diffstat (limited to 'cloudinit/handlers/cloud_config.py')
-rw-r--r-- | cloudinit/handlers/cloud_config.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cloudinit/handlers/cloud_config.py b/cloudinit/handlers/cloud_config.py index 99dc71d0..654314c0 100644 --- a/cloudinit/handlers/cloud_config.py +++ b/cloudinit/handlers/cloud_config.py @@ -114,6 +114,12 @@ class CloudConfigPartHandler(handlers.Handler): return (payload_yaml, all_mergers) def _merge_patch(self, payload): + if payload.startswith("#json-patch"): + # JSON doesn't handle comments in this manner, so ensure that + # if we started with this 'type' that we remove it before + # attempting to load it as json (which the jsonpatch library will + # attempt to do). + payload = payload[len("#json-patch"):] patch = jsonpatch.JsonPatch.from_string(payload) LOG.debug("Merging by applying json patch %s", patch) self.cloud_buf = patch.apply(self.cloud_buf, in_place=False) |