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 #38084 - Add new REX job templates for bootc upgrade/switch/rollback #11256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lfu
Copy link
Member

@lfu lfu commented Dec 12, 2024

What are the changes introduced in this pull request?

  1. New REX feature katello_bootc_upgrade
  2. New REX feature katello_bootc_switch
  3. New REX feature katello_bootc_rollback
  4. New REX feature katello_bootc_status

Considerations taken when implementing this change?

What are the testing steps for this pull request?

To import the new job template:

# in Rails console
ForemanInternal.all.first.delete

Then run

bundle exec rails db:seed

In Hosts > Tempaltes > Job Templates, you'll see new added templates.
Select one of the new bootc job templates and run 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.

I got the following error when trying the Bootc status template:

2024-12-12T19:16:51 [E|bac|db1af636] Failed rendering template: error during rendering: ERF90-0026 [TemplateInput::UnsatisfiedRequiredInput]: Value for required input 'target' was not specified (RuntimeError)

Edit: same thing for the Bootc rollback command.

required: true
%>

bootc <%= input('action') %> <%= input('options') %> <%= input('target') %>
Copy link
Member

Choose a reason for hiding this comment

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

When I selected the bootc rollback command, I noticed that target was still marked as a required option, even though bootc rollback takes no arguments.

Copy link
Member

Choose a reason for hiding this comment

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

The same goes for bootc upgrade. In fact, switch is the only action that has a required target.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this is only an issue for the top-level action that has a dropdown with the action you pick.

Copy link
Member

Choose a reason for hiding this comment

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

Edit: I verified that I also get the "no target" error for the upgrade task.

@lfu lfu force-pushed the 28995_job_templates_bootc branch 2 times, most recently from dbdc89e to 6cf6b9a Compare December 12, 2024 21:02
job_category: Katello
description_format: 'bootc %{action} %{options}'
provider_type: script
template_inputs:
Copy link
Member

Choose a reason for hiding this comment

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

A sort of common thing is to include an option to reboot the machine once the action is done, maybe that could be used here as well https://github.com/theforeman/foreman_leapp/blob/master/app/views/foreman_leapp/job_templates/leapp_upgrade.erb#L16 ?

Copy link
Member Author

@lfu lfu Dec 13, 2024

Choose a reason for hiding this comment

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

Thanks for your review and the comment @adamruzicka.

From bootc document:

However, in the future this is likely to change such that reboots outside of a `bootc upgrade --apply` do *not* automatically apply the update in addition.

With that information, maybe we just allow users decide if a reboot is necessary with --apply option. What is your opinion, @ianballou?

Copy link
Member

Choose a reason for hiding this comment

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

@lfu I'm asking around about if there is more information about that change. I do like the reboot strategy that Adam mentioned, it seems pretty straight-forward. I'll update here when I hear more from the bootc team.

Copy link
Member

Choose a reason for hiding this comment

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

The future of this command is still a bit unclear, so I think we can leave the scripts as-is and update them as bootc changes in the future.

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.

The actions are working a lot better now!

I did notice that the target input is available still for the bootc rollback command on the main bootc action template, but I suspect there isn't much we can do there since it's a global page.

Just one comment:

@@ -696,6 +696,9 @@ def katello_template_setting_values(name)
RemoteExecutionFeature.register(:katello_module_stream_action, N_("Katello: Module Stream Actions"),
:description => N_("Perform a module stream action via Katello interface"),
:provided_inputs => ['action', 'module_spec', 'options'])
RemoteExecutionFeature.register(:katello_bootc_upgrade, N_("Katello: Bootc Upgrade"), :description => N_("Bootc upgrade via Katello interface"), :provided_inputs => ['options'])
RemoteExecutionFeature.register(:katello_bootc_switch, N_("Katello: Bootc Switch"), :description => N_("Bootc switch via Katello interface"), :provided_inputs => ['options,target'])
RemoteExecutionFeature.register(:katello_bootc_rollback, N_("Katello: Bootc Rollback"), :description => N_("Bootc rollback via Katello interface"), :provided_inputs => [])
Copy link
Member

Choose a reason for hiding this comment

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

Do we need one for Bootc status too?

@lfu lfu force-pushed the 28995_job_templates_bootc branch from 6cf6b9a to 7de8ce8 Compare December 16, 2024 14:39
@ianballou
Copy link
Member

Looks like the DB seeder broke in the latest test run

@lfu
Copy link
Member Author

lfu commented Dec 16, 2024

Local db:seed worked fine. Is there a way to check on the PR environment?

@ianballou
Copy link
Member

Local db:seed worked fine. Is there a way to check on the PR environment?

One thing worth checking might be a fresh environment, I wonder if one of the newer changes broke something but it only shows up if the templates aren't already present.

@lfu lfu force-pushed the 28995_job_templates_bootc branch 10 times, most recently from df83381 to 9901f1d Compare December 17, 2024 22:11
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.

I'm not sure what changed, but the action is now below the options input:
image

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.

I wonder if it makes sense to throw a subscription-manager facts --update at the end of the commands. It won't help of course if a reboot happens, but for most other cases it would trigger the UI to show the new status.

@ianballou
Copy link
Member

Besides my two comments above, everything seems to be working great!

@lfu
Copy link
Member Author

lfu commented Dec 18, 2024

Mine looks just fine. Could you check other templates? Like Package action.
bootc

@lfu lfu force-pushed the 28995_job_templates_bootc branch from 9901f1d to 7d322c0 Compare December 18, 2024 18:02
@ianballou
Copy link
Member

Strangely, the old Katello / Bootc action has the inputs in the right order, it's only the new Bootc / Bootc action that has the order wrong. I don't see what could be causing it, so maybe it's just an issue on my box?

@ianballou
Copy link
Member

This is looking good to me, although I want to double check that the action / options ordering isn't reproducible. Perhaps it's worth installing to a production machine via the packit RPM and double checking.

name: Bootc Action - Script Default
model: JobTemplate
job_category: Bootc
description_format: 'bootc %{action} %{options}'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description_format: 'bootc %{action} %{options}'
description_format: 'bootc %{action} %{target} %{options}'

@ianballou
Copy link
Member

Took a closer look -- I can't tell why the arguments would be out of order just based on the templates here.

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.

3 participants