Skip to content

Conversation

bbezak
Copy link
Member

@bbezak bbezak commented Aug 18, 2022

Add name to pulp container to fix setting admin password

this part is checking for name:
https://github.com/stackhpc/stackhpc-kayobe-config/blob/stackhpc/wallaby/etc/kayobe/containers/pulp/post.yml#L13

error log:

TASK [deploy-containers : Set the Pulp admin password] ********************************************************************************************************************************************************* fatal: [intern-os-seed-vm]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'name'\n\nThe error appears to be in '/home/stackhpc/wallaby-upgrade/src/kayobe-config/etc/kayobe/containers/pulp/post.yml': line 10, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set the Pulp admin password\n ^ here\n"}

@bbezak bbezak requested a review from a team as a code owner August 18, 2022 10:58
Copy link
Contributor

@markgoddard markgoddard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you instead fix the post task? The dict key defines the container's name.

@bbezak
Copy link
Member Author

bbezak commented Aug 22, 2022

Could you instead fix the post task? The dict key defines the container's name.

I didn't find a elegant way to do it programatically, except that: {{ seed_pulp_container.keys()[0] }}
However this looks like bike shedding way as this post task is only for that container which has hardcoded name to pulp anyway. Moreover this enumerating method it seems is unstable across python versions - https://stackoverflow.com/questions/5629023/order-of-keys-in-dictionaries-in-old-versions-of-python#:~:text=As%20of%20Python%203.6%2C%20for,across%20other%20implementations%20of%20Python

@bbezak bbezak requested a review from markgoddard August 22, 2022 09:19
@bbezak bbezak changed the title Add name to pulp container to fix setting admin password fix setting admin password for pulp Aug 22, 2022
@markgoddard
Copy link
Contributor

Could you instead fix the post task? The dict key defines the container's name.

I didn't find a elegant way to do it programatically, except that: {{ seed_pulp_container.keys()[0] }} However this looks like bike shedding way as this post task is only for that container which has hardcoded name to pulp anyway. Moreover this enumerating method it seems is unstable across python versions - https://stackoverflow.com/questions/5629023/order-of-keys-in-dictionaries-in-old-versions-of-python#:~:text=As%20of%20Python%203.6%2C%20for,across%20other%20implementations%20of%20Python

Yes, it doesn't really work like that. There has to be some immutable way to reference the item in the dict/list, and in this case we are reusing that key as the container name. So hard coding is fine.

@markgoddard markgoddard merged commit ee636f2 into stackhpc/wallaby Aug 22, 2022
@markgoddard markgoddard deleted the fix-pulp-password-set branch August 22, 2022 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants