-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor handling of inventory backend command line flag #1127
Refactor handling of inventory backend command line flag #1127
Conversation
b88be78
to
83c413f
Compare
I was looking at updating the docs, and found that https://kapitan.dev/pages/commands/kapitan_dotfile/#inventory notes that you can set Given that documentation, would it make sense to move the |
Yeah, it would make sense if we want to add every single argument that affects some general kapitan functionality to every command. Another approach (and what I've done for nexenio-dev) would be to group arguments by functionality and not commands. This would mean. that we don't have to check if we in This might be a more complex (maybe breaking) change and needs to be discussed with @ademariag and @ramaro. What do you all think? For now, I think a top level |
Thinking about it again, it would be a breaking change for sure, if we start reading argument values for existing flags from |
Perhaps we could have a I think global could be a good way to start cleaning things up, while still retaining the old behaviour |
Having a |
This commit switches the inventory backend command line flag to the form `--inventory-backend=<backend name>`. Additionally, we restrict the allowed values for the flag to the known backends. To ensure the allowed values for the command line flag, and the known implementations are in sync, we introduce a dict holding the mapping from flag values to `Inventory` subclasses. Finally, we ensure that the selected backend is cached as a string in `cached.args["inventory-backend"]`. Note that this is not how `cached.args` is used otherwise, but since it's unlikely that there ever will be a real command `inventory-backend`, this should be fine.
I've created a PR which implements a possible way to introduce a |
743f60d
to
0c13d11
Compare
Proposed Changes
This PR switches the inventory backend command line flag to the form
--inventory-backend=<backend name>
. Additionally, we restrict the allowed values for the flag to the known backends.To ensure the allowed values for the command line flag, and the known implementations are in sync, we introduce a dict holding the mapping from flag values to
Inventory
subclasses.Finally, we ensure that the selected backend is cached as a string in
cached.args["inventory-backend"]
. Note that this is not howcached.args
is used otherwise, but since it's unlikely that there ever will be a real commandinventory-backend
this should be fine.Docs and Tests