def verify(doc): mng=XMLJobManager() slist=StoreList() llist=LocalStoreList() mng.registerPlugins() workflow=XMLWorkflow(doc.documentElement) for task in workflow.tasks: exc=getTaskExecutor(mng, task) if task.attributes.has_key("destStore"): store=llist.getByUuid(task.attributes["destStore"]) if store<>None: continue store=slist.getByUuid(task.attributes["destStore"]) if store==None: raise Exception("Unknown destination store") # oops, requested remote destination store and executor does not support it # change destination store to local one and add MOVE task after that if not exc.supportsRemoteDestination: task.element.setAttribute("destStore", task.attributes["srcStore"]) extra=doc.createElement("task") extra.setAttribute("guid", uuid4().get_hex()) extra.setAttribute("action", "MOVE") extra.setAttribute("srcStore", task.attributes["srcStore"]) if task.attributes.has_key("destAssetItem"): extra.setAttribute("srcAssetItem", task.attributes["destAssetItem"]) else: extra.setAttribute("srcAssetItem", task.attributes["srcAssetItem"]) extra.setAttribute("destStore", store.uuid) doc.documentElement.insertBefore(extra, task.element.nextSibling)
def __init__(self,reporter, workflow,task, move): super(CopyMoveExecutor, self).__init__(reporter, workflow, task) slist=LocalStoreList() self.move=move self.srcassetuid=task.attributes["srcAssetItem"] self.dstassetuid=task.attributes["srcAssetItem"] if task.attributes.has_key("destAssetItem"): self.dstassetuid=task.attributes["destAssetItem"] self.overwrite=False if task.attributes.has_key("overwrite"): self.overwrite=(task.attributes["overwrite"].lower()=="true") self.srcasset=slist.getByUuid(task.attributes["srcStore"]).findAsset(task.attributes["srcAssetItem"]) self.targetstore=slist.getByUuid(task.attributes["destStore"]) self.isLocal=True if self.targetstore==None: self.isLocal=False slist2=StoreList() self.targetstore=slist2.getByUuid(task.attributes["destStore"]) if self.targetstore==None: raise Exception("Unknown destination store") self.desthost=slist2.getDisk(self.targetstore.diskuuid).host