Skip to content

Commit 2965bdf

Browse files
committed
react on svm_created, not svm_enabled
- svm_enabled is a variable/output that tells if particular project is configured to have an SVM created in NetApp - svm_created is a variable that records if the SVM was created in a particular workflow run (not that it exists or that is expected to exist). This distinction allows us to gracefully react to a situation where an end-user updates a project by adding additional tag that is not NetApp related. Prior to this commit, this would trigger a workflow that checks if the SVM already exists and that first part of the workflow (oslo_event handler specifically) would terminate gracefully without a problem. But in the next step, the ansible-to-nautobot workflow would still get triggered even though it should not.
1 parent f695ead commit 2965bdf

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

python/understack-workflows/understack_workflows/oslo_event/keystone_project.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def handle_project_created(
6767
try:
6868
netapp_manager = NetAppManager()
6969
svm_name = _create_svm_and_volume(netapp_manager, event)
70+
_save_output("svm_created", str(True))
7071
finally:
7172
if not svm_name:
7273
svm_name = "not_returned"
@@ -104,8 +105,12 @@ def handle_project_updated(
104105
)
105106
netapp_manager.cleanup_project(event.project_id)
106107
# Tag added
107-
elif project_is_svm_enabled and not svm_exists:
108-
svm_name = _create_svm_and_volume(netapp_manager, event)
108+
elif project_is_svm_enabled:
109+
if svm_exists:
110+
_save_output("svm_created", str(False))
111+
else:
112+
svm_name = _create_svm_and_volume(netapp_manager, event)
113+
_save_output("svm_created", str(True))
109114
finally:
110115
if not svm_name:
111116
svm_name = "not_returned"

workflows/argo-events/workflowtemplates/openstack-oslo-event.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ spec:
7070
- name: svm_enabled
7171
valueFrom:
7272
path: /var/run/argo/output.svm_enabled
73+
- name: svm_created
74+
valueFrom:
75+
path: /var/run/argo/output.svm_created

workflows/openstack/sensors/sensor-keystone-oslo-event.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ spec:
9595
print(str(uuid.UUID(project_id_without_dashes)))
9696
9797
- - name: ansible-to-nautobot
98-
when: "{{steps.oslo-events.outputs.parameters.svm_enabled}} == True"
98+
when: "{{steps.oslo-events.outputs.parameters.svm_created}} == True"
9999
inline:
100100
container:
101101
image: ghcr.io/rss-engineering/undercloud-nautobot/ansible:latest

0 commit comments

Comments
 (0)