Ejemplo n.º 1
0
 def _write_part(self, payload, filename):
     filename = util.clean_filename(filename)
     filepath = os.path.join(self.boothook_dir, filename)
     contents = util.strip_prefix_suffix(util.dos2unix(payload),
                                         prefix=self.prefixes[0])
     util.write_file(filepath, contents.lstrip(), 0o700)
     return filepath
Ejemplo n.º 2
0
 def _write_part(self, payload, filename):
     filename = util.clean_filename(filename)
     filepath = os.path.join(self.boothook_dir, filename)
     contents = util.strip_prefix_suffix(util.dos2unix(payload),
                                         prefix=BOOTHOOK_PREFIX)
     util.write_file(filepath, contents.lstrip(), 0o700)
     return filepath
Ejemplo n.º 3
0
 def _merge_patch(self, payload):
     # 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.lstrip()
     payload = util.strip_prefix_suffix(payload, prefix=JSONP_PREFIX)
     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)
Ejemplo n.º 4
0
 def _merge_patch(self, payload):
     # 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.lstrip()
     payload = util.strip_prefix_suffix(payload, prefix=JSONP_PREFIX)
     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)