MCPcopy Create free account
hub / github.com/apache/cloudstack / load

Method load

systemvm/debian/opt/cloud/bin/merge.py:291–315  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

289 data = {}
290
291 def load(self, data):
292 if data is not None:
293 self.data = data
294 self.type = self.data["type"]
295 updateDataBag(self)
296 return
297 filename = '{cache_location}/{json_file}'.format(cache_location=self.configCache, json_file=self.fileName)
298 try:
299 handle = open(filename)
300 except IOError as exception:
301 error_message = ("Exception occurred with the following exception error '{error}'. Could not open '{filename}'. "
302 "It seems that the file has already been moved.".format(error=exception, filename=filename))
303 logging.error(error_message)
304 else:
305 logging.info("Continuing with the processing of file '{filename}'".format(filename=filename))
306
307 self.data = json.load(handle)
308 self.type = self.data["type"]
309 handle.close()
310 if self.keep:
311 self.__moveFile(filename, self.configCache + "/processed")
312 else:
313 logging.debug("Processed file deleted: %s and not kept in /processed", filename)
314 os.remove(filename)
315 updateDataBag(self)
316
317 def setFile(self, name):
318 self.fileName = name

Callers 3

processGuestNetworkMethod · 0.95
processCLItemMethod · 0.95
process_fileFunction · 0.95

Calls 9

__moveFileMethod · 0.95
updateDataBagClass · 0.85
formatMethod · 0.80
debugMethod · 0.80
closeMethod · 0.65
removeMethod · 0.65
errorMethod · 0.45
infoMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected