diff options
author | Joshua Harlow <harlowja@gmail.com> | 2013-07-20 07:34:31 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2013-07-20 07:34:31 -0700 |
commit | 0be217f4c177a34b5ec46aa3e64fb1bede4ceb33 (patch) | |
tree | 2f43ec0420b6cbe2f92876d601ab2449e41e6645 /cloudinit/handlers | |
parent | 1f73904df31feb22ad8545a3a336ba2e92e367bb (diff) | |
download | vyos-cloud-init-0be217f4c177a34b5ec46aa3e64fb1bede4ceb33.tar.gz vyos-cloud-init-0be217f4c177a34b5ec46aa3e64fb1bede4ceb33.zip |
Remove json-patch inclusion header if payload contains it.
Diffstat (limited to 'cloudinit/handlers')
-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) |