SyncStep.__init__(self, **args)
HpcLibrary.__init__(self)
+ def fetch_pending(self, deleted):
+ #self.consistency_check()
+
+ return SyncStep.fetch_pending(self, deleted)
+
+ def consistency_check(self):
+ # set to true if something changed
+ result=False
+
+ # sanity check to make sure our PS objects have CMI objects behind them
+ all_cp_ids = [x["content_provider_id"] for x in self.client.onev.ListAll("ContentProvider")]
+ for cp in ContentProvider.objects.all():
+ if (cp.content_provider_id is not None) and (cp.content_provider_id not in all_cp_ids):
+ logger.info("Content provider %s was not found on CMI" % cp.content_provider_id)
+ cp.content_provider_id=None
+ cp.save()
+ result = True
+
+ return result
+
def sync_record(self, cp):
logger.info("sync'ing content provider %s" % str(cp))
account_name = self.make_account_name(cp.name)
- print "XXX", cp.name, account_name
if (not cp.serviceProvider) or (not cp.serviceProvider.service_provider_id):
return
cp.save()
def delete_record(self, m):
- self.client.onev.Delete("ContentProvider", m.content_provider_id)
+ if m.content_provider_id is not None:
+ self.client.onev.Delete("ContentProvider", m.content_provider_id)