Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/planetstack/core/models/plcorebase.py b/planetstack/core/models/plcorebase.py
index 4263f94..8d657a7 100644
--- a/planetstack/core/models/plcorebase.py
+++ b/planetstack/core/models/plcorebase.py
@@ -69,6 +69,7 @@
def __init__(self, *args, **kwargs):
super(PlCoreBase, self).__init__(*args, **kwargs)
self.__initial = self._dict
+ self.silent = False
@property
def diff(self):
@@ -113,10 +114,10 @@
self.save(update_fields=['enacted','deleted'], silent=silent)
def save(self, *args, **kwargs):
+ # let the user specify silence as either a kwarg or an instance varible
+ silent = self.silent
if "silent" in kwargs:
- silent=kwargs.pop("silent")
- else:
- silent=False
+ silent=silent or kwargs.pop("silent")
super(PlCoreBase, self).save(*args, **kwargs)
diff --git a/planetstack/hpc_observer/steps/sync_cdnprefix.py b/planetstack/hpc_observer/steps/sync_cdnprefix.py
index b773df9..b887e84 100644
--- a/planetstack/hpc_observer/steps/sync_cdnprefix.py
+++ b/planetstack/hpc_observer/steps/sync_cdnprefix.py
@@ -62,4 +62,5 @@
cp.save()
def delete_record(self, m):
- self.client.onev.Delete("CDNPrefix", m.cdn_prefix_id)
+ if m.cdn_prefix_id is not None:
+ self.client.onev.Delete("CDNPrefix", m.cdn_prefix_id)
diff --git a/planetstack/hpc_observer/steps/sync_contentprovider.py b/planetstack/hpc_observer/steps/sync_contentprovider.py
index c7335d6..cebe186 100644
--- a/planetstack/hpc_observer/steps/sync_contentprovider.py
+++ b/planetstack/hpc_observer/steps/sync_contentprovider.py
@@ -62,5 +62,6 @@
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)
diff --git a/planetstack/hpc_observer/steps/sync_originserver.py b/planetstack/hpc_observer/steps/sync_originserver.py
index 6fb6234..92ac0f4 100644
--- a/planetstack/hpc_observer/steps/sync_originserver.py
+++ b/planetstack/hpc_observer/steps/sync_originserver.py
@@ -69,7 +69,9 @@
url = url[7:]
self.client.cob.UpdateContent(ors.origin_server_id, {"url": url})
+ ors.silent = True
ors.save()
- def delete(self, m):
- self.client.onev.Delete("OriginServer", m.origin_server_id)
+ def delete_record(self, m):
+ if m.origin_server_id is not None:
+ self.client.onev.Delete("OriginServer", m.origin_server_id)
diff --git a/planetstack/hpc_observer/steps/sync_serviceprovider.py b/planetstack/hpc_observer/steps/sync_serviceprovider.py
index 19c6db3..78fd196 100644
--- a/planetstack/hpc_observer/steps/sync_serviceprovider.py
+++ b/planetstack/hpc_observer/steps/sync_serviceprovider.py
@@ -52,5 +52,5 @@
sp.save()
def delete_record(self, m):
- print "XXX delete service provider", m
- self.client.onev.Delete("ServiceProvider", m.service_provider_id)
+ if m.service_provider_id is not None:
+ self.client.onev.Delete("ServiceProvider", m.service_provider_id)