summaryrefslogtreecommitdiff
path: root/src/automationstatus/views.py
diff options
context:
space:
mode:
authorckonstanski <kostcarl@isu.edu>2026-07-30 18:17:14 -0600
committerckonstanski <kostcarl@isu.edu>2026-07-30 18:17:14 -0600
commit640ff61422bc0ee3966941b93d9889ddbbd38d77 (patch)
treeabf1c08f5d38ee53ec8b29dc4f425722517505e6 /src/automationstatus/views.py
parent22dae02a86c1fce71091bfa5289cf99abba1b217 (diff)
more filesHEADmaster
Diffstat (limited to 'src/automationstatus/views.py')
-rw-r--r--src/automationstatus/views.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/automationstatus/views.py b/src/automationstatus/views.py
new file mode 100644
index 0000000..df75868
--- /dev/null
+++ b/src/automationstatus/views.py
@@ -0,0 +1,19 @@
+from rest_framework import viewsets
+from caas.models import Cluster, Location, Server
+from .models import AutomationStatus
+from .serializers import AutomationStatusSerializer
+
+class AutomationStatusViewSet(viewsets.ModelViewSet):
+ queryset = AutomationStatus.objects.all().order_by('created_at')
+ serializer_class = AutomationStatusSerializer
+
+ def perform_create(self, serializer):
+ # Lookup cluster name based on the ilo_host_address
+ server = Server.objects.get(ilo_host_address=self.request.data['ilo_host_address'])
+ cluster = Cluster.objects.get(id=server.cluster_id)
+ fuze_id = cluster.location_id
+ location = Location.objects.get(id=fuze_id)
+ serializer.save(
+ cluster_name=cluster.cluster_name,
+ fuze_spm_site_name=location.fuze_spm_site_name,
+ fuze_spm_site_id=location.fuze_spm_site_id)