r/openstack • • Dec 30 '22

I created a small CLI tool for managing OpenStack configuration files

The project is hosted here: https://github.com/mchlumsky/mracek

Contributions (PRs, issues and even github stars!) are welcome!

(Don't forget to backup your current configs first!)

7 Upvotes

1 comment sorted by

0

u/[deleted] Dec 30 '22

[deleted]

3

u/MartinChlumsky Dec 31 '22

Thank you for this feedback!

Clearly I have work to do in the README. The CLI tool does in fact manage clouds.yaml/secure.yaml/clouds-public.yaml with commands like "mracek create-cloud", "mracek show-cloud", "mracek set-cloud", "mracek delete-cloud", etc... It's mracek's main purpose in fact!

Injecting OS_* variables into the environment (it reads from clouds.yaml, secure.yaml, cloud-public.yaml and exports environment variables) is but one of the things it does. There are some older clients that still only support environment variables (the swift client in particular) and it's with these older clients in mind that I added the "export OS_* variables" feature.

I was on the fence about whether or not to inject all the OS_* environment variables, but now, after your feedback, I am leaning to either remove them completely or make them configurable or something else.

There is one env variable that I will most likely keep which is OS_CLOUD. The OpenStack CLI reads OS_CLOUD and uses it like the "openstack --os-cloud" option. Having the OS_CLOUD variable set also plays nicely with other tools like starship ( https://starship.rs/config/#openstack ).

I work in an environment with almost 20 different OpenStack regions and use multiple projects. Managing aliases like you propose would mean dozens of aliases to maintain.
This is why I wrote mracek: to manage this complexity.
Example: I have a cloud called "region1-project1" for project "project1" in region "region1". I have a new project "project2" in the same region that I would like to add to my clouds.yaml as cloud "region1-project2". I can simply copy the first cloud into a new cloud while updating the project name like this:
mracek copy-cloud --project-name project2 region1-project1 region1-project2
After that I can use this new cloud with:
mracek region1-project2 # tab-completion for the cloud name works here

Followed by whatever openstack commands I want. And tab-completion will work for the openstack commands which is not the case with the aliases you proposed.
I'm a huge fan of tab-completion.
Thanks again!