Cleaned up models.py
diff --git a/xos/helloworldservice/models.py b/xos/helloworldservice/models.py
index ed09e50..bc94e07 100644
--- a/xos/helloworldservice/models.py
+++ b/xos/helloworldservice/models.py
@@ -3,28 +3,32 @@
HELLO_WORLD_KIND = "helloworldservice"
+
class HelloWorldService(Service):
KIND = HELLO_WORLD_KIND
class Meta:
- proxy = True
- app_label = "helloworldservice"
- verbose_name = "Hello World Service"
+ proxy = True
+ app_label = "helloworldservice"
+ verbose_name = "Hello World Service"
+
class HelloWorldTenant(TenantWithContainer):
+
class Meta:
proxy = True
KIND = HELLO_WORLD_KIND
- sync_attributes = ("private_ip", "private_mac",
- "nat_ip", "nat_mac",)
+ sync_attributes = ("nat_ip", "nat_mac",)
default_attributes = {'display_message': 'Hello World!'}
+
def __init__(self, *args, **kwargs):
- helloworld_services = HelloWorldService.get_service_objects().all();
- if helloworld_services:
- self._meta.get_field("provider_service").default = helloworld_services[0].id
- super(HelloWorldTenant, self).__init__(*args, **kwargs)
+ helloworld_services = HelloWorldService.get_service_objects().all()
+ if helloworld_services:
+ self._meta.get_field(
+ "provider_service").default = helloworld_services[0].id
+ super(HelloWorldTenant, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
super(HelloWorldTenant, self).save(*args, **kwargs)
@@ -37,8 +41,8 @@
@property
def display_message(self):
return self.get_attribute(
- "display_message",
- self.default_attributes['display_message'])
+ "display_message",
+ self.default_attributes['display_message'])
@display_message.setter
def display_message(self, value):
@@ -53,8 +57,6 @@
for ns in self.instance.ports.all():
if "nat" in ns.network.name.lower():
addresses["nat"] = (ns.ip, ns.mac)
- elif "private" in ns.network.name.lower():
- addresses["private"] = (ns.ip, ns.mac)
return addresses
@property
@@ -65,14 +67,6 @@
def nat_mac(self):
return self.addresses.get("nat", (None, None))[1]
- @property
- def private_ip(self):
- return self.addresses.get("private", (None, None))[0]
-
- @property
- def private_mac(self):
- return self.addresses.get("private", (None, None))[1]
-
def model_policy_helloworld_tenant(pk):
with transaction.atomic():
tenant = HelloWorldTenant.objects.select_for_update().filter(pk=pk)