Autoformat code
diff --git a/xos/helloworldservice/admin.py b/xos/helloworldservice/admin.py
index 81528e7..3b14235 100644
--- a/xos/helloworldservice/admin.py
+++ b/xos/helloworldservice/admin.py
@@ -9,6 +9,8 @@
# The class to provide an admin interface on the web for the service.
# We do only configuration here and don't change any logic because the logic
# is taken care of for us by ReadOnlyAwareAdmin
+
+
class HelloWorldServiceAdmin(ReadOnlyAwareAdmin):
# We must set the model so that the admin knows what fields to use
model = HelloWorldService
@@ -72,6 +74,8 @@
# service because tenants vary more than services and there isn't a common form.
# This allows us to change the python behavior for the admin form to save extra
# fields and control defaults.
+
+
class HelloWorldTenantForm(forms.ModelForm):
# Defines a field for the careator of this service. It is a dropbown which
# is populated with all of the users.
@@ -108,7 +112,8 @@
# entered.
def save(self, commit=True):
self.instance.creator = self.cleaned_data.get("creator")
- self.instance.display_message = self.cleaned_data.get("display_message")
+ self.instance.display_message = self.cleaned_data.get(
+ "display_message")
return super(HelloWorldTenantForm, self).save(commit=commit)
class Meta:
@@ -116,6 +121,8 @@
# Define the admin form for the tenant. This uses a similar structure as the
# service but uses HelloWorldTenantForm to change the python behavior.
+
+
class HelloWorldTenantAdmin(ReadOnlyAwareAdmin):
verbose_name = "Hello World Tenant"
verbose_name_plural = "Hello World Tenants"
diff --git a/xos/helloworldservice/models.py b/xos/helloworldservice/models.py
index 8c5e303..4c72416 100644
--- a/xos/helloworldservice/models.py
+++ b/xos/helloworldservice/models.py
@@ -6,13 +6,16 @@
# The class to represent the service. Most of the service logic is given for us
# in the Service class but, we have some configuration that is specific for
# this example.
+
+
class HelloWorldService(Service):
KIND = HELLO_WORLD_KIND
class Meta:
# When the proxy field is set to True the model is represented as
# it's superclass in the database, but we can still change the pyhton
- # behavior. In this case HelloWorldService is a Service in the database.
+ # behavior. In this case HelloWorldService is a Service in the
+ # database.
proxy = True
# The name used to find this service, all directories are named this
app_label = "helloworldservice"
@@ -21,6 +24,8 @@
# This is the class to represent the tenant. Most of the logic is given to use
# in TenantWithContainer, however there is some configuration and logic that
# we need to define for this example.
+
+
class HelloWorldTenant(TenantWithContainer):
class Meta:
@@ -98,6 +103,7 @@
def nat_mac(self):
return self.addresses.get("nat", (None, None))[1]
+
def model_policy_helloworld_tenant(pk):
# This section of code is atomic to prevent race conditions
with transaction.atomic():
diff --git a/xos/observers/helloworldservice/steps/sync_helloworldtenant.py b/xos/observers/helloworldservice/steps/sync_helloworldtenant.py
index e971a96..01a4e71 100644
--- a/xos/observers/helloworldservice/steps/sync_helloworldtenant.py
+++ b/xos/observers/helloworldservice/steps/sync_helloworldtenant.py
@@ -11,6 +11,8 @@
# indicate where the find the YAML for ansible, where to find the SSH key,
# and the logic for determining what tenant needs updating, what additional
# attributes are needed, and how to delete an instance.
+
+
class SyncHelloWorldServiceTenant(SyncInstanceUsingAnsible):
# Indicates the position in the data model, this will run when XOS needs to
# enact a HelloWorldTenant