Update references
diff --git a/xos/helloworldservice_complete/admin.py b/xos/helloworldservice_complete/admin.py
index 4db2f57..9a3e4f7 100644
--- a/xos/helloworldservice_complete/admin.py
+++ b/xos/helloworldservice_complete/admin.py
@@ -4,14 +4,14 @@
from core.models import User
from django import forms
from django.contrib import admin
-from helloworldservice.models import HelloWorldService, HelloWorldTenant, HELLO_WORLD_KIND
+from helloworldservice_complete.models import HelloWorldServiceComplete, HelloWorldTenantComplete, HELLO_WORLD_KIND
# 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):
+class HelloWorldServiceCompleteAdmin(ReadOnlyAwareAdmin):
# We must set the model so that the admin knows what fields to use
- model = HelloWorldService
+ model = HelloWorldServiceComplete
verbose_name = "Hello World Service"
verbose_name_plural = "Hello World Services"
@@ -65,14 +65,14 @@
# Used to get the objects for this model that are associated with the
# requesting user.
def queryset(self, request):
- return HelloWorldService.get_service_objects_by_user(request.user)
+ return HelloWorldServiceComplete.get_service_objects_by_user(request.user)
# Class to represent the form to add and edit tenants.
# We need to define this instead of just using an admin like we did for the
# 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):
+class HelloWorldTenantCompleteForm(forms.ModelForm):
# Defines a field for the creator of this service. It is a dropdown which
# is populated with all of the users.
creator = forms.ModelChoiceField(queryset=User.objects.all())
@@ -80,13 +80,13 @@
display_message = forms.CharField(required=False)
def __init__(self, *args, **kwargs):
- super(HelloWorldTenantForm, self).__init__(*args, **kwargs)
+ super(HelloWorldTenantCompleteForm, self).__init__(*args, **kwargs)
# Set the kind field to readonly
self.fields['kind'].widget.attrs['readonly'] = True
# Define the logic for obtaining the objects for the provider_service
# dropdown of the tenant form.
self.fields[
- 'provider_service'].queryset = HelloWorldService.get_service_objects().all()
+ 'provider_service'].queryset = HelloWorldServiceComplete.get_service_objects().all()
# Set the initial kind to HELLO_WORLD_KIND for this tenant.
self.fields['kind'].initial = HELLO_WORLD_KIND
# If there is an instance of this model then we can set the initial
@@ -99,8 +99,8 @@
# If there is not an instance then we need to set initial values.
if (not self.instance) or (not self.instance.pk):
self.fields['creator'].initial = get_request().user
- if HelloWorldService.get_service_objects().exists():
- self.fields["provider_service"].initial = HelloWorldService.get_service_objects().all()[0]
+ if HelloWorldServiceComplete.get_service_objects().exists():
+ self.fields["provider_service"].initial = HelloWorldServiceComplete.get_service_objects().all()[0]
# This function describes what happens when the save button is pressed on
# the tenant form. In this case we set the values for the instance that were
@@ -109,16 +109,16 @@
self.instance.creator = self.cleaned_data.get("creator")
self.instance.display_message = self.cleaned_data.get(
"display_message")
- return super(HelloWorldTenantForm, self).save(commit=commit)
+ return super(HelloWorldTenantCompleteForm, self).save(commit=commit)
class Meta:
- model = HelloWorldTenant
+ model = HelloWorldTenantComplete
# Define the admin form for the tenant. This uses a similar structure as the
-# service but uses HelloWorldTenantForm to change the python behavior.
+# service but uses HelloWorldTenantCompleteForm to change the python behavior.
-class HelloWorldTenantAdmin(ReadOnlyAwareAdmin):
+class HelloWorldTenantCompleteAdmin(ReadOnlyAwareAdmin):
verbose_name = "Hello World Tenant"
verbose_name_plural = "Hello World Tenants"
list_display = ('id', 'backend_status_icon', 'instance', 'display_message')
@@ -129,13 +129,13 @@
'display_message'],
'classes': ['suit-tab suit-tab-general']})]
readonly_fields = ('backend_status_text', 'instance',)
- form = HelloWorldTenantForm
+ form = HelloWorldTenantCompleteForm
suit_form_tabs = (('general', 'Details'),)
def queryset(self, request):
- return HelloWorldTenant.get_tenant_objects_by_user(request.user)
+ return HelloWorldTenantComplete.get_tenant_objects_by_user(request.user)
# Associate the admin forms with the models.
-admin.site.register(HelloWorldService, HelloWorldServiceAdmin)
-admin.site.register(HelloWorldTenant, HelloWorldTenantAdmin)
+admin.site.register(HelloWorldServiceComplete, HelloWorldServiceCompleteAdmin)
+admin.site.register(HelloWorldTenantComplete, HelloWorldTenantCompleteAdmin)
diff --git a/xos/helloworldservice_complete/models.py b/xos/helloworldservice_complete/models.py
index 8923bc3..f0f42bd 100644
--- a/xos/helloworldservice_complete/models.py
+++ b/xos/helloworldservice_complete/models.py
@@ -6,13 +6,13 @@
# 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):
+class HelloWorldServiceComplete(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
+ # behavior. In this case HelloWorldServiceComplete is a Service in the
# database.
proxy = True
# The name used to find this service, all directories are named this
@@ -22,10 +22,10 @@
# 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 HelloWorldTenantComplete(TenantWithContainer):
class Meta:
- # Same as a above, HelloWorldTenant is represented as a
+ # Same as a above, HelloWorldTenantComplete is represented as a
# TenantWithContainer, but we change the python behavior.
proxy = True
@@ -43,16 +43,16 @@
default_attributes = {'display_message': 'Hello World!'}
def __init__(self, *args, **kwargs):
- helloworld_services = HelloWorldService.get_service_objects().all()
+ helloworld_services = HelloWorldServiceComplete.get_service_objects().all()
# When the tenant is created the default service in the form is set
- # to be the first created HelloWorldService
+ # to be the first created HelloWorldServiceComplete
if helloworld_services:
self._meta.get_field(
"provider_service").default = helloworld_services[0].id
- super(HelloWorldTenant, self).__init__(*args, **kwargs)
+ super(HelloWorldTenantComplete, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
- super(HelloWorldTenant, self).save(*args, **kwargs)
+ super(HelloWorldTenantComplete, self).save(*args, **kwargs)
# This call needs to happen so that an instance is created for this
# tenant is created in the slice. One instance is created per tenant.
model_policy_helloworld_tenant(self.pk)
@@ -60,7 +60,7 @@
def delete(self, *args, **kwargs):
# Delete the instance that was created for this tenant
self.cleanup_container()
- super(HelloWorldTenant, self).delete(*args, **kwargs)
+ super(HelloWorldTenantComplete, self).delete(*args, **kwargs)
# Getter for the message that will appear on the webpage
# By default it is "Hello World!"
@@ -104,7 +104,7 @@
# This section of code is atomic to prevent race conditions
with transaction.atomic():
# We find all of the tenants that are waiting to update
- tenant = HelloWorldTenant.objects.select_for_update().filter(pk=pk)
+ tenant = HelloWorldTenantComplete.objects.select_for_update().filter(pk=pk)
if not tenant:
return
# Since this code is atomic it is safe to always use the first tenant
diff --git a/xos/helloworldservice_complete/templates/helloworldserviceadmin.html b/xos/helloworldservice_complete/templates/helloworldserviceadmin.html
index 0c60f1a..ba418ee 100644
--- a/xos/helloworldservice_complete/templates/helloworldserviceadmin.html
+++ b/xos/helloworldservice_complete/templates/helloworldserviceadmin.html
@@ -1,8 +1,8 @@
-<!-- Template used to for the button leading to the HelloWorldTenant form. -->
+<!-- Template used to for the button leading to the HelloWorldTenantComplete form. -->
<div class = "left-nav">
<ul>
<li>
- <a href="/admin/helloworldservice/helloworldtenant/">
+ <a href="/admin/helloworldservice_complete/helloworldtenantcomplete/">
Hello World Tenants
</a>
</li>
diff --git a/xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.py b/xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.py
index f12344b..67d159f 100644
--- a/xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.py
+++ b/xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.py
@@ -1,7 +1,7 @@
import os
import sys
from django.db.models import Q, F
-from helloworldservice.models import HelloWorldService, HelloWorldTenant
+from helloworldservice_complete.models import HelloWorldServiceComplete, HelloWorldTenantComplete
from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
parentdir = os.path.join(os.path.dirname(__file__), "..")
@@ -11,12 +11,12 @@
# 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):
+class SyncHelloWorldTenantComplete(SyncInstanceUsingAnsible):
# Indicates the position in the data model, this will run when XOS needs to
- # enact a HelloWorldTenant
- provides = [HelloWorldTenant]
+ # enact a HelloWorldTenantComplete
+ provides = [HelloWorldTenantComplete]
# The actual model being enacted, usually the same as provides.
- observes = HelloWorldTenant
+ observes = HelloWorldTenantComplete
# Number of milliseconds between interruptions of the observer
requested_interval = 0
# The ansible template to run
@@ -26,19 +26,19 @@
service_key_name = "/opt/xos/observers/helloworldservice_complete/helloworldservice_private_key"
def __init__(self, *args, **kwargs):
- super(SyncHelloWorldServiceTenant, self).__init__(*args, **kwargs)
+ super(HelloWorldTenantComplete self).__init__(*args, **kwargs)
- # Defines the logic for determining what HelloWorldTenants need to be
+ # Defines the logic for determining what HelloWorldTenantCompletes need to be
# enacted.
def fetch_pending(self, deleted):
# If the update is not a deletion, then we get all of the instnaces that
# have been updated or have not been enacted.
if (not deleted):
- objs = HelloWorldTenant.get_tenant_objects().filter(
+ objs = HelloWorldTenantComplete.get_tenant_objects().filter(
Q(enacted__lt=F('updated')) | Q(enacted=None), Q(lazy_blocked=False))
else:
# If this is a deletion we get all of the deleted tenants..
- objs = HelloWorldTenant.get_deleted_tenant_objects()
+ objs = HelloWorldTenantComplete.get_deleted_tenant_objects()
return objs