CORD-1913: Restore execution of custom service save() methods in attics
Change-Id: I989aef8f1efa9a61ea6ca88fec2eec7f1e24ac83
diff --git a/xos/attic/monitoringchannel_model.py b/xos/attic/monitoringchannel_model.py
index 458759a..250d6c1 100644
--- a/xos/attic/monitoringchannel_model.py
+++ b/xos/attic/monitoringchannel_model.py
@@ -30,7 +30,7 @@
#Allow creation of this model instances for non-admin users also
return True
-def save(self, *args, **kwargs):
+def __xos_save_base(self, *args, **kwargs):
if not self.creator:
if not getattr(self, "caller", None):
# caller must be set when creating a monitoring channel since it creates a slice
@@ -45,8 +45,8 @@
if channel_count > 0:
raise XOSValidationError("Already %s channels exist for user Can only create max 1 MonitoringChannel instance per user" % str(channel_count))
- super(MonitoringChannel, self).save(*args, **kwargs)
model_policy_monitoring_channel(self.pk)
+ return False
def delete(self, *args, **kwargs):
self.cleanup_container()
@@ -183,4 +183,4 @@
ceilometer_services = CeilometerService.get_service_objects().all()
if not ceilometer_services:
return None
- return ceilometer_services[0].kafka_url
\ No newline at end of file
+ return ceilometer_services[0].kafka_url
diff --git a/xos/attic/onosservicemonitoringpublisher_model.py b/xos/attic/onosservicemonitoringpublisher_model.py
index 1f6137f..037227e 100644
--- a/xos/attic/onosservicemonitoringpublisher_model.py
+++ b/xos/attic/onosservicemonitoringpublisher_model.py
@@ -21,7 +21,7 @@
#Don't allow creation of this model instances for non-admin users also
return False
-def save(self, *args, **kwargs):
+def __xos_save_base(self, *args, **kwargs):
if not self.creator:
if not getattr(self, "caller", None):
# caller must be set when creating a monitoring channel since it creates a slice
@@ -36,4 +36,4 @@
if publisher_count > 0:
raise XOSValidationError("Already %s openstack publishers exist for user Can only create max 1 ONOSServiceMonitoringPublisher instance per user" % str(publisher_count))
- super(ONOSServiceMonitoringPublisher, self).save(*args, **kwargs)
\ No newline at end of file
+ return False
diff --git a/xos/attic/openstackservicemonitoringpublisher_model.py b/xos/attic/openstackservicemonitoringpublisher_model.py
index 23102f5..c6dfa7e 100644
--- a/xos/attic/openstackservicemonitoringpublisher_model.py
+++ b/xos/attic/openstackservicemonitoringpublisher_model.py
@@ -21,7 +21,7 @@
#Don't allow creation of this model instances for non-admin users also
return False
-def save(self, *args, **kwargs):
+def __xos_save_base(self, *args, **kwargs):
if not self.creator:
if not getattr(self, "caller", None):
# caller must be set when creating a monitoring channel since it creates a slice
@@ -36,4 +36,5 @@
if publisher_count > 0:
raise XOSValidationError("Already %s openstack publishers exist for user Can only create max 1 OpenStackServiceMonitoringPublisher instance per user" % str(publisher_count))
- super(OpenStackServiceMonitoringPublisher, self).save(*args, **kwargs)
\ No newline at end of file
+ return False
+
diff --git a/xos/attic/sflowtenant_model.py b/xos/attic/sflowtenant_model.py
index 3132df1..2c0227c 100644
--- a/xos/attic/sflowtenant_model.py
+++ b/xos/attic/sflowtenant_model.py
@@ -56,7 +56,7 @@
raise XOSProgrammingError("SFlowTenant: Only UDP listening endpoint URLs are accepted...valid syntax is: udp://ip:port")
self.set_attribute("listening_endpoint", value)
-def save(self, *args, **kwargs):
+def __xos_save_base(self, *args, **kwargs):
if not self.creator:
if not getattr(self, "caller", None):
# caller must be set when creating a SFlow tenant since it creates a slice
@@ -74,7 +74,7 @@
if channel_count > 0:
raise XOSValidationError("Already %s sflow channels exist for user Can only create max 1 tenant per user and listening endpoint" % str(channel_count))
- super(SFlowTenant, self).save(*args, **kwargs)
+ return False
def delete(self, *args, **kwargs):
super(MonitoringChannel, self).delete(*args, **kwargs)
diff --git a/xos/attic/userservicemonitoringpublisher_model.py b/xos/attic/userservicemonitoringpublisher_model.py
index 9bee3eb..5ac3335 100644
--- a/xos/attic/userservicemonitoringpublisher_model.py
+++ b/xos/attic/userservicemonitoringpublisher_model.py
@@ -90,7 +90,7 @@
self.cached_service_monitoring_agent = None
self.set_attribute("service_monitoring_agent", value)
-def save(self, *args, **kwargs):
+def __xos_save_base(self, *args, **kwargs):
if not self.creator:
if not getattr(self, "caller", None):
# caller must be set when creating a monitoring channel since it creates a slice
@@ -128,4 +128,6 @@
tenancy_from_target_service.delete()
if service_monitoring_agent:
service_monitoring_agent.delete()
- raise
\ No newline at end of file
+ raise
+
+ return True # Indicate that we called super.save()