Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Test include roles dynamically #201

Merged
merged 2 commits into from
Jan 28, 2020
Merged

Test include roles dynamically #201

merged 2 commits into from
Jan 28, 2020

Conversation

fao89
Copy link
Member

@fao89 fao89 commented Dec 27, 2019

@@ -0,0 +1,13 @@
---
pulp_default_admin_password: password
prereq_roles:
Copy link
Member

Choose a reason for hiding this comment

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

We should just call them "roles" or "pulp_roles". Since they aren't prerequisites, they are the meat of the installer.


- name: Dynamically include prereq roles
include_role:
public: yes
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't know about this option. It is newish (Ansilbe 2.7).
This 1 option may solve the entire problem that led us to want to test include_role to begin with.
Did you try leaving it out? According to 1the Katello team (and 1 or 2 other users), they had to workaround an issue by setting a variable globally ("vars:" in playbook.yml.) I forget if that issue is still present.

Copy link
Member Author

Choose a reason for hiding this comment

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

without it, it didn't work, because one role was depending on the vars of other roles. So it was breaking due to "missing vars".

Copy link
Member

@mikedep333 mikedep333 Jan 15, 2020

Choose a reason for hiding this comment

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

Let's figure out if our users are OK with "public" or not for the long-term. I reached out to @jlsherrill .

In the meantime, let's figure out that variable and try to address it as a separate PR that this is rebased on. (Or as a separate commit on this PR.) I think one technique we've used in the past is to do "loose coupling", putting the defaults in both roles that need the variable (even though the variable primarily pertains to 1 role.)

Copy link
Member Author

Choose a reason for hiding this comment

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

done! Added a commit for it here!

Copy link
Member

Choose a reason for hiding this comment

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

It's awesome that you tracked down all these missing variables. I didn't realize there were so many.

Copy link
Member

Choose a reason for hiding this comment

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

So with all the variables added to the defaults, do we still need "public"?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, we don't need public, but I wasn't sure if I had to remove it, wdyt? Remove it or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to remove it, I think it is better for CI to see if it breaks when missing some variable

@fao89 fao89 requested a review from mikedep333 January 15, 2020 21:57
Comment on lines 2 to 6
pulp_content_bind: "127.0.0.1:24816"
pulp_config_dir: "/etc/pulp"
pulp_settings_file: "{{ pulp_config_dir }}/settings.py"
pulp_install_dir: "/usr/local/lib/pulp"
pulp_user: pulp
Copy link
Member

Choose a reason for hiding this comment

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

The role's README.md needs an update about the loose coupling. See pulp-content/README.md's "Shared variables"

pulp_settings_file: "{{ pulp_config_dir }}/settings.py"
pulp_default_admin_password: ""
# Users should not set this variable, instead using `pulp_settings.databases`
pulp_settings_db_defaults:
Copy link
Member

Choose a reason for hiding this comment

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

The role's README.md needs an update about the loose coupling between pulp and pulp-database. See pulp-content/README.md's "Shared variables"

Copy link
Member

Choose a reason for hiding this comment

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

Update still needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I dislike the wording, but I suppose it is good enough.

tox.ini Outdated
@@ -42,3 +42,12 @@ commands =
{env:TRAVIS_WAIT:} molecule idempotence -s source
molecule side-effect -s source
molecule verify -s source
molecule lint -s dynamic
Copy link
Member

Choose a reason for hiding this comment

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

I recently fixed a bug in tox.ini; the "destroy" stage needs to be added for the "source" scenario before we run the "dynamic" scenario.

In other words, only the last scenario should lack a "destroy" task. (It wastes time, and makes debugging more difficult.) (Maybe we should add a comment for this.)

Copy link
Member Author

Choose a reason for hiding this comment

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

+1 to add a comment

@mikedep333
Copy link
Member

FYI: I made a bunch of comments, then made another. It may show only 1 change requested, but there are multiple.

pulp_settings_file: "{{ pulp_config_dir }}/settings.py"
pulp_default_admin_password: ""
# Users should not set this variable, instead using `pulp_settings.databases`
pulp_settings_db_defaults:
Copy link
Member

Choose a reason for hiding this comment

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

Update still needed.

@fao89 fao89 requested a review from mikedep333 January 23, 2020 21:41
@mikedep333
Copy link
Member

Also @fabricio-aguiar , the "Loose coupling pulp roles" commit is fairly substantial. I would recommend quickly creating a redmine ticket real quick so as to ensure that you get credit for making this improvement that addresses many users' use cases.

Copy link
Member

@mikedep333 mikedep333 left a comment

Choose a reason for hiding this comment

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

Awesome, thank you for this!

pulp_settings_file: "{{ pulp_config_dir }}/settings.py"
pulp_default_admin_password: ""
# Users should not set this variable, instead using `pulp_settings.databases`
pulp_settings_db_defaults:
Copy link
Member

Choose a reason for hiding this comment

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

I dislike the wording, but I suppose it is good enough.

@fao89 fao89 merged commit 4649c85 into pulp:master Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants