xlab-si / xopera-opera

xOpera orchestrator compliant with TOSCA YAML v1.3 in the making
https://xlab-si.github.io/xopera-docs/
Apache License 2.0
35 stars 14 forks source link

Save results of deploy and undeploy to a file #174

Closed anzoman closed 2 years ago

anzoman commented 3 years ago

Description

The opera deploy and opera undeploy CLI commands print out the orchestration results during the process. Some users might want to use these later on or would want to save them locally in a file which can be then used by other tools or they just don't want to receive the output in their shell but rather in some text file. Therefore, I suggest that we add a new flag (--output/-o) to these CLI commands so that the outputs can be used like this:

# save validation results
opera validate --inputs inputs.yaml --output outputs.txt service.yaml

# save deploy results
opera deploy --inputs inputs.yaml --output outputs.txt service.yaml

# save undeploy results
opera undeploy --output outputs.txt 

# save update results
opera update --output outputs.txt service.yaml

# save notify results
opera notify -t my_trigger --output outputs.txt

As you can see this addition applies for the following CLI commands

Steps

Add the CLI flag which we already have in opera diff, opera info, opera outputs and opera package. For saving outputs save_outputs helper from src/opera/utils.py can be used.

Current behaviour

Results of some CLI commands cannot be stored to directly a file.

Expected results

To be able to store orchestration results to a file by using a new CLI flag.

Note

This issue is almost similar to #151.

anzoman commented 3 years ago

@sstanovnik would this feature be helpful for xOpera SaaS?

sstanovnik commented 3 years ago

I couldn't use it because SaaS only uses the python API, not the CLI.

anzoman commented 2 years ago

The commands that don't have -o/--output switch are the ones that actually do some orchestration actions (e.g., deploy, undeploy) and changing them to catch their output and save it to a file would mean that we'd have to also deal with updating our thread output printer, which might not be trivial. All in all the user can always do opera deploy service.yaml > output.txt and save the output.

I'm closing this now and we can reopen if we ever need to.