-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add a way to test module PR's #322
Conversation
Still working on this, but opened this in case anyone has a comment about the general strategy. ATM, passing the module hashes isn't working :-\ From vagrant -> ansible something is happening: It works fine with just a straight playbook, but you get this using the example in the PR desc above.
Also, kafo is unhappy about dumping modules in the directory, I think it's something to do w/ parser caches. |
The code seems to be not correctly moving the passed hash to a python dict:
Notice the ruby syntax in there |
Ah thanks, I'll try to figure it out. Seems like the Vagrant host_vars thing can't handle complex data types |
Looks like you might have to do this? |
Literally on the same stack overflow page :-) The vagrant ansible provisioner also just joins an array with " " so ruby dumps out it's own internal .to_s of the hash. I could fix it, but since the ini file can't have hashes, I'll just refactor them as strings and split on a slash. Blargh. |
This version works. Using the box in the description. (Although, the install itself fails because of https://bugzilla.redhat.com/show_bug.cgi?id=1329327#c8) |
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 think this is also a candidate for the docs. Other than that it looks good.
git clone https://github.com/{{ item.split("/")[0] }}/puppet-{{ item.split("/")[1] }} {{ item.split("/")[1] }} && | ||
cd {{ item.split("/")[1] }} && | ||
git fetch origin pull/{{ item.split("/")[2] }}/head:pr && | ||
git merge pr |
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 think git checkout pr
is cleaner.
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.
It is intentionally this way - the particular PR branch could be out of date and missing something important, and it reflects the reality of what will happen when the PR is actually merged on GitHub.
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.
That's fair.
One downside to this approach is it is tied into the katello module. For example, I was thinking this would be great to test #269 using theforeman/puppet-foreman#488 but cannot due to it not being stand-alone functionality. |
Do you mean the puppet module or the ansible role? |
The reason it's like this is because it has to be between the package install and installer execution. We could make a foreman_installer role, and centralize all the installer calls including module pr's there (one way of solving #304). katello.yml would look like: - hosts: all
become: true
roles:
- etc_hosts
- epel_repositories
- puppet_repositories
- foreman_repositories
- katello_repositories
- katello (maybe call this katello_packages?)
- { role: foreman_installer, scenario: "katello", <some other options> } |
@stbenjam sounds good, I realize its more roles but they kind of make things more composable |
This is a pretty big refactor. Removed versioned playbooks, remove entire katello role. Thoughts? The only capability that isn't present in this is katello/upgrade.yml but as far as I can see doesn't work at all ATM, it references old .yml files that don't exist anymore (when repos were part of katello role). |
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 like this change. It unifies Foreman and Katello to the core components they share
@@ -0,0 +1,13 @@ | |||
- hosts: all |
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.
Not sure why this is named foreman_platform when it installs Katello.
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.
This is an existing playbook, I'm not adding it here, just refactoring it.
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.
But, it is "foreman_platform" as it contains Foreman + many of the most common plugins.
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.
Oh right, you renamed the specific foreman_platform_1.12 and heavily refactored it. Carry on :)
scenario: katello | ||
foreman_installer_options_internal_use_only: "--disable-system-checks --enable-foreman-plugin-discovery --enable-foreman-plugin-bootdisk --enable-foreman-plugin-remote-execution --enable-foreman-plugin-hooks --enable-foreman-plugin-openscap --enable-foreman-proxy-plugin-openscap --enable-foreman-proxy-plugin-remote-execution-ssh" | ||
foreman_installer_additional_packages: | ||
- katello |
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.
Why is this needed? shouldn't the installer handle this or is the the katello scenario?
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.
New foreman_installer role is generic, it only installs foreman-related packages. If you're using an alternate scenario, you need the package(s) that have it, I could make foreman_installer role know which packages are needed for which scenario but this seemed more generic
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.
Ok, so the package katello provides the katello installer scenario. I'd have expected it to be something like foreman-installer-katello. And I'm fine with this more generic solution.
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.
It is indeed named like that, but the katello
package is meta-package that pulls in all the dependencies too. Makes the installer take less time since everything should already be on the box
- katello_repositories | ||
- role: foreman_installer | ||
scenario: katello | ||
foreman_installer_options_internal_use_only: "--disable-system-checks --enable-foreman-plugin-discovery --enable-foreman-plugin-bootdisk --enable-foreman-plugin-remote-execution --enable-foreman-plugin-hooks --enable-foreman-plugin-openscap --enable-foreman-proxy-plugin-openscap --enable-foreman-proxy-plugin-remote-execution-ssh" |
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.
Can this be an array for some readability?
this PR worked as advertised for me Can the readme be updated to include the example from #322 (comment) ? |
--scenario "{{ foreman_installer_scenario }}" | ||
--foreman-admin-password "{{ foreman_installer_admin_password }}" | ||
{{ foreman_installer_options }} | ||
{{ foreman_installer_options_internal_use_only | join(" ") }} |
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 think this looks great, so take tis question as a looking ahead. This seems ripe for an Ansible module. Would you agree or do you think that would be overkill? e.g.
- name: 'Run Installer'
foreman_installer:
scenario: foreman
verbose: false
options: >
-- foreman-admin-password "changeme"
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.
That would seem fine to do - looks cleaner
git clone https://github.com/{{ item.split("/")[0] }}/puppet-{{ item.split("/")[1] }} {{ item.split("/")[1] }} && | ||
cd {{ item.split("/")[1] }} && | ||
git fetch origin pull/{{ item.split("/")[2] }}/head:pr && | ||
git merge pr |
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.
Similar to above, thinking out loud about re-factoring this to a module.
foreman_installer_options_internal_use_only: | ||
- "--disable-system-checks" | ||
foreman_installer_additional_packages: | ||
- katello |
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.
Soon we can hopefully avoid this via installer integration?
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.
Ah yea I would think so, but still maybe needed, e.g. doesn't RHCI or some red hat cloud product bolt onto our installer with another package?
I wanted to test this on a Content Smart Foreman Proxy as well and had to make these changes:
|
@ehelms You can push directly to my branch (new feature)! https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/ |
@stbenjam That felt so wrong, and yet, so right. |
I think this will break the pipeline jobs we use for testing -- I can either work up the update (as I need to do some 3.2 testing) and add it to this PR or do it after the fact. |
@@ -4,4 +4,4 @@ | |||
- epel_repositories |
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.
This playbook also needs become: true
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.
(done)
@ehelms I think fixing it after the fact is fine. |
- "--enable-foreman-proxy-plugin-openscap" | ||
- "--enable-foreman-proxy-plugin-remote-execution-ssh" | ||
foreman_installer_additional_packages: | ||
- katello |
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 should talk about syntax one of these days since we got a few styles creeping up. A quick google search didn't yield me a silver bullet style guide and ansible-lint doesn't check for that.
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.
What other style would there be here?
I've got some fixes for the pipeline's and working on an updated upgrade script I was using for testing as well. I think this is good to go in as is now though. |
Awesome, thanks! |
Used like this for example: