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

Fixes #36597 - Rename 'Change content source' job template #10652

Merged

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Jul 17, 2023

What are the changes introduced in this pull request?

The user was confused because running the job template on the host didn't change the host's content source. In actuality, it updates subscription-manager configuration on the host based on the host's current content source. It's meant to only be run just after changing the content source on the server, as part of the 'Change Content Source' feature.

So, the changes here are

  1. Change the name of the job template Change content source to Configure host for new content source. This reflects what the job template actually does. Includes a DB migration similar to https://github.com/theforeman/foreman/blob/develop/db/migrate/20220204155632_rename_job_report_template.rb (thanks for the tip @ianballou)
  2. Change the name of the method change_content_source to configure_host_for_new_content_source
  3. Rename files accordingly
  4. Add (hopefully) helpful comments to the job template

Considerations taken when implementing this change?

I didn't update the name of the remote execution feature, since that would require a code change in foreman_remote_execution.

What are the testing steps for this pull request?

Run migrations:

bundle exec rails db:migrate

Run seeds and restart the server:

bundle exec rails runner "ForemanInternal.all.first.destroy" && bundle exec foreman start

Test the following:

  1. In Hosts > Job Templates, verify that the "Change content source" template is gone and the new "Configure host for new content source" template is there.
  2. test changing a host's content source and verify everything still works I guess

@theforeman-bot
Copy link

Issues: #36597

@jeremylenz jeremylenz force-pushed the 36597-change-change-content-source branch 3 times, most recently from e522db4 to 829aa1d Compare July 17, 2023 18:06
@jeremylenz jeremylenz force-pushed the 36597-change-change-content-source branch from 829aa1d to fafa2e5 Compare July 17, 2023 21:05
@jeremylenz
Copy link
Member Author

I changed the ERB comments to regular Bash comments.

See theforeman/foreman_remote_execution#822

Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

Code is looking fine, now I just need to actually test it.

Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

Working for me! I tested the case of having a same-named job template already and it was backed up properly. New template works as well.

@jeremylenz jeremylenz merged commit 8bbb1ff into Katello:master Jul 21, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants