- def _compare_and_update(self, ocloudmodel: StxGenericModel) -> bool:\r
- with self._uow:\r
- # localmodel = self._uow.stxobjects.get(str(ocloudmodel.id))\r
- oclouds = self._uow.stxobjects.list(ResourceTypeEnum.OCLOUD)\r
- if len(oclouds) > 1:\r
- raise InvalidOcloudState("More than 1 ocloud is found")\r
- if len(oclouds) == 0:\r
- logger.info("add ocloud:" + ocloudmodel.name\r
- + " update_at: " + str(ocloudmodel.updatetime)\r
- + " id: " + str(ocloudmodel.id)\r
- + " hash: " + str(ocloudmodel.hash))\r
- self._uow.stxobjects.add(ocloudmodel)\r
- else:\r
- localmodel = oclouds.pop()\r
- if localmodel.is_outdated(ocloudmodel):\r
- logger.info("update ocloud:" + ocloudmodel.name\r
- + " update_at: " + str(ocloudmodel.updatetime)\r
- + " id: " + str(ocloudmodel.id)\r
- + " hash: " + str(ocloudmodel.hash))\r
- localmodel.update_by(ocloudmodel)\r
- self._uow.stxobjects.update(localmodel)\r
- self._uow.commit()\r
+# def _compare_and_update(self, ocloudmodel: StxGenericModel) -> bool:\r
+# with self._uow:\r
+# # localmodel = self._uow.stxobjects.get(str(ocloudmodel.id))\r
+# oclouds = self._uow.stxobjects.list(ResourceTypeEnum.OCLOUD)\r
+# if len(oclouds) > 1:\r
+# raise InvalidOcloudState("More than 1 ocloud is found")\r
+# if len(oclouds) == 0:\r
+# logger.info("add ocloud:" + ocloudmodel.name\r
+# + " update_at: " + str(ocloudmodel.updatetime)\r
+# + " id: " + str(ocloudmodel.id)\r
+# + " hash: " + str(ocloudmodel.hash))\r
+# self._uow.stxobjects.add(ocloudmodel)\r
+# else:\r
+# localmodel = oclouds.pop()\r
+# if localmodel.is_outdated(ocloudmodel):\r
+# logger.info("update ocloud:" + ocloudmodel.name\r
+# + " update_at: " + str(ocloudmodel.updatetime)\r
+# + " id: " + str(ocloudmodel.id)\r
+# + " hash: " + str(ocloudmodel.hash))\r
+# localmodel.update_by(ocloudmodel)\r
+# self._uow.stxobjects.update(localmodel)\r
+# self._uow.commit()\r