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
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
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?
I can think of 2 use cases where the “script” solution might have issues.
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).
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.
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.
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.