Skip to content

Commit 397b249

Browse files
committed
create_svm workflow: save results to a file
1 parent f2f6524 commit 397b249

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,30 @@ def handle_project_created(
5555
logger.debug("Project %s has tags: %s", event.project_id, tags)
5656
if SVM_PROJECT_TAG not in tags:
5757
logger.info("The %s is missing, not creating SVM.", SVM_PROJECT_TAG)
58-
exit(0)
58+
return 0
5959

6060
netapp_manager = NetAppManager()
6161
netapp_manager.create_svm(
6262
project_id=event.project_id, aggregate_name=AGGREGATE_NAME
6363
)
64-
netapp_manager.create_volume(
64+
svm_name = netapp_manager.create_volume(
6565
project_id=event.project_id,
6666
volume_size=VOLUME_SIZE,
6767
aggregate_name=AGGREGATE_NAME,
6868
)
69+
with open("/var/run/argo/output.svm_name", "w") as f: # noqa: S108
70+
if not svm_name:
71+
svm_name = "not_returned"
72+
73+
f.write(svm_name)
74+
75+
_save_result("success", 0)
6976
return 0
77+
78+
79+
def _save_result(msg, exit_code):
80+
with open("/var/run/argo/output.msg", "w") as f: # noqa: S108
81+
f.write(msg)
82+
with open("/var/run/argo/output.exit_code", "w") as f: # noqa: S108
83+
f.write(str(exit_code))
84+
exit(exit_code)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,11 @@ spec:
6262
- name: netapp-ini
6363
secret:
6464
secretName: netapp-config
65+
outputs:
66+
parameters:
67+
- name: exit_code
68+
valueFrom:
69+
path: /var/run/argo/output.exit_code
70+
- name: msg
71+
valueFrom:
72+
path: /var/run/argo/output.msg

0 commit comments

Comments
 (0)