Transform CLI profile to JSON format

Description

Currently our CLI profile is in YAML, and uses tags like this !CloudifyProfileContext which point to a YAML object that PyYaml uses serialize/deserialize this class.
This can't be loaded safely in YAML, forcing us to use the unsafe method yaml.load() instead of yaml.safe_load() for the profile.

suggests that we store the profile in JSON instead, then we won't need YAML to load it

Activity

Show:
Michael Glokhman
October 14, 2020, 9:12 AM

I think it’s probably best if we have a separate script to do the conversion, otherwise it kinda beats the purpose of getting rid of an unsafe command in the CLI.
We could write the script so it can batch-convert e.g. all profile yamls in a folder

Ofer Yarom
October 14, 2020, 9:43 AM

well, the upside for “runtime conversion” is that there is zero chance for failure. if as a user I forget to run the conversion script I would still get full functionality and my system will be updated in runtime. once all customers will upgrade to this version we can get rid of the “old” code.

That said, if someone is using the Cloudify profile through an automation tool of some sort, they may have the profile files maintained elsewhere and use them ad hoc. the runtime conversion will not do the trick here; the script option will work if executed on the source of the files.

can you please share your take on this?

Jonathan Abramsohn
October 14, 2020, 10:14 AM

I can think of 2 use cases where the “script” solution might have issues.

  1. One of our customers that uses profiles located on different folders so they can reach each cluster from a separate folder using CFY_WORKDIR env var (security and access perms issues).

  2. Support and PS teams that still uses all supported version and need CLI profiles for all these versions.

I would vote for the runtime conversion although it’s much more complicated.

Łukasz Maksymczuk
October 14, 2020, 11:53 AM

for 1, you would just run the script on all these folders
For 2, new profile format would still support old managers.

I think let's make it a separate conversion script indeed. The new cli will detect an old profile, and show a message telling you how to upgrade. You will be able to use the old CLI venv to do it.

Łukasz Maksymczuk
October 14, 2020, 11:55 AM

Oh, but now notes that we have pyyaml anyway in the cli, if only for the `--inputs`, so we can just do runtime indeed. Nevermind then, let's do runtime.

Done

Assignee

Łukasz Maksymczuk

Reporter

Michael Glokhman

Labels

None

Target Version

5.2

Premium Only

no

Release Notes

yes

Priority

None

Why Blocked?

None

Sprint

None

Priority

Unprioritized
Configure