Skip to content
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

aap_setup_install assumes dictionaries in aap_setup_prep_inv_nodes var #197

Closed
jon4hz opened this issue Sep 19, 2023 · 3 comments · Fixed by #220
Closed

aap_setup_install assumes dictionaries in aap_setup_prep_inv_nodes var #197

jon4hz opened this issue Sep 19, 2023 · 3 comments · Fixed by #220
Assignees
Labels
bug Something isn't working

Comments

@jon4hz
Copy link
Contributor

jon4hz commented Sep 19, 2023

Hi, quick follow up to #192 because I figured out what caused my issue.

controller_hostname: "{{ (aap_setup_prep_inv_nodes['automationcontroller'].keys() | list)[0] }}"

This should probably be something like {{ aap_setup_prep_inv_nodes['automationcontroller'] | first }}. Same goes for ah_hostname and eda_hostname - or you keep the role as it is and adjust the example in the readme :)

@jon4hz jon4hz added bug Something isn't working new labels Sep 19, 2023
@sean-m-sullivan
Copy link
Collaborator

sean-m-sullivan commented Sep 19, 2023

Can you point to me where in the documentation it shows dicts, as we would need to change that, I've looked at the aap setup install, download, and prep, and I see lists used in the examples. Its never meant to be a dict. ever.

Like this:
https://github.com/redhat-cop/aap_utilities/tree/devel/roles/aap_setup_prepare#example-inventory-variables

@jon4hz
Copy link
Contributor Author

jon4hz commented Sep 19, 2023

It doesn't show dicts in any documentation. The issue is that the defaults from the aap_setup_install assume dicts.

controller_hostname: "{{ (aap_setup_prep_inv_nodes['automationcontroller'].keys() | list)[0] }}"

ah_hostname: "{{ (aap_setup_prep_inv_nodes['automationhub'].keys() | list)[0] }}"

eda_hostname: "{{ (aap_setup_prep_inv_nodes['automationedacontroller'].keys() | list)[0] }}"

See the code snippets above. You're calling the keys() method on aap_setup_prep_inv_nodes['automationcontroller'] which will throw the error: 'list object' has no attribute 'keys'.

This behavior was introduced by #133 as "fix hostnames".

@ericzolf
Copy link
Contributor

They should all be dictionaries and they can all be dictionaries, in order to allow for host variables in the ini files (not the nicest way to do it, but rather common for setup.sh). The truth was and is in aap_setup_prepare: "aap_setup_prep_inv_nodes [...] a dictionary of dictionaries, the first level key is the inventory group name, the 2nd level key is the hostname with the value being its inventory host variables in INI-format".

I'll close both #196 and #197 with a documentation update.

@ericzolf ericzolf self-assigned this Jan 22, 2024
ericzolf added a commit that referenced this issue Jan 22, 2024
It was partially assuming lists where dictionaries are expected everywhere.
This allows to have hosts values as... values to the hosts as keys.

Closes #196, Closes #197
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants