-
Notifications
You must be signed in to change notification settings - Fork 140
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
common: Handle aliases correctly #71
base: main
Are you sure you want to change the base?
Conversation
Fixed get_api_client API to handle `aliases` that are passed via inventory configuration or module parameters. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Codecov Report
@@ Coverage Diff @@
## main #71 +/- ##
=======================================
Coverage 23.17% 23.17%
=======================================
Files 1 1
Lines 151 151
Branches 24 24
=======================================
Hits 35 35
Misses 111 111
Partials 5 5 Continue to review full report at Codecov.
|
I don't understand, shouldn't ansible already handle this? If I pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, shouldn't ansible already handle this? If I pass
ssl_ca_cert
and then domodule.params.get('ca_cert')
, won't it already work without this change? If I remove your changes, the tests still pass.
I don't understand, shouldn't ansible already handle this? If I pass
ssl_ca_cert
and then domodule.params.get('ca_cert')
, won't it already work without this change? If I remove your changes, the tests still pass.
I think using module it should work, assuming the core engine will convert argument from aliases to true name
but for inventory plugin, there is no such a conversion, so this has to be done manually.
We should add some inventory
test cases
@@ -10,6 +10,20 @@ | |||
debug: | |||
var: output | |||
|
|||
- name: Use aliases and check if those values are picked up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may need to cover all aliases cert_file
, key_file
, verify_ssl
@@ -131,6 +131,12 @@ def _raise_or_fail(exc, msg): | |||
for true_name, arg_name in AUTH_ARG_MAP.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest some validation step to avoid having both alias and true name set as input, otherwise the behavior of the api will be undefined. for instance using
k8s:
...
validate_certs: yes
verify_ssl: no
the process will the k8s configuration item with the first value in alpha num ?
note: Typing this all out, I'm feeling like maybe I should have left this as a comment way back when I added it 😅 |
@Akasurde What do you think about adding some inventory test cases? |
SUMMARY
Fixed get_api_client API to handle
aliases
thatare passed via inventory configuration or module parameters.
Signed-off-by: Abhijeet Kasurde akasurde@redhat.com
ISSUE TYPE
COMPONENT NAME
changelogs/fragments/honor_aliases.yml
molecule/default/tasks/full.yml
plugins/module_utils/common.py