Error changing lifecycle (undefined method)

Problem:
undefined mthod content_view when trying to allocate host a different lifecycle but same content view
Expected outcome:
the above works, no errors
Foreman and Proxy versions:
3.6 /4.8

Other relevant data:

New setup of Foreman 3.6 with katello 4.8 on EL8. Created the same products, content views and lifecycle environments as our previous Foreman 3.2 setup. Migrated some dev hosts across to this new setup using activation key which puts them into library. Go to the content hosts page and choose the host i want to change to the dev lifecycle environment and once applied, it gives me the below error

sub task:

undefined method `content_view=’ for #Katello::Host::ContentFacet:0x000055ba2b76f2b0
Did you mean? content_views=
content_views
content_view_ids=
content_view_ids

I’ve moved hosts to different CVs and lifecycle env before using this method, so I don’t understand why it now fails

Hi @chatlow

This is fixed by Bug #36504: undefined method `content_view=' for #<Katello::Host::ContentFacet:0x00007fc530855ac8> - Katello - Foreman which is in Katello 4.8.2 and 4.9.0.

ah thats really good to know. I am curently on katello 4.8.1. Can I update katello to 4.8.2 or will i need to update both foreman/katello to 3.7 / 4.9 per Upgrading and Updating Foreman ?

thanks

You can update to Katello 4.8.2 without upgrading Foreman if you so desire.

so just yum install katello-4.8.2-1.el8.noarch on all proxies and master yes?

yep that should do it!

thank you, really appreciate the quick replies

ive updated katello and run foreman-maintain service restart on the master and all proxies, but the issue persists. Anything else need to run?

thanks

do other 4.8.1 packages require updating?

katello-certs-tools-2.9.0-1.el8.noarch
katello-4.8.2-1.el8.noarch
katello-selinux-4.0.2-3.el8.noarch
rubygem-hammer_cli_katello-1.8.1-1.el8.noarch
katello-debug-4.8.1-1.el8.noarch
katello-client-bootstrap-1.7.9-1.el8.noarch
katello-repos-4.8.1-1.el8.noarch
rubygem-katello-4.8.1-1.el8.noarch
katello-common-4.8.2-1.el8.noarch
foreman-installer-katello-3.6.1-1.el8.noarch

Did you run foreman-installer after updating the katello rpm packages?

nope, I did not. just restarted foreman services

just ran foreman-installer on master and proxies. Still the same error unfortunately.

Just foreman-installer on it’s own, it uses the answers file generated
at the last run.

i did. same outcome

If you still get this error, it seems like the upgrade didn’t happen yet. Not sure what happened.

As a workaround, there are a few other places you can change a host’s content view and lifecycle environment:

  1. From the content host details page;
  2. From the new host details page: Hosts > All Hosts > (select your host) > Content view details > (vertical ellipsis) > Edit content view assignment
  3. From the ‘Change Content Source’ page for the host: Hosts > All Hosts > (select your host) > (vertical ellipsis) > Change content source (if the content source didn’t actually change, you don’t have to run the job invocation script on the host.)

thanks yeah im aware of the other methods, but my preferred method (which fails) is good because more than 1 content host can selected and changed in bulk
The katello package definitely updated, but perhaps something else is needed to pull it in

Or I could try upgrading to latest version of Foreman/Katello

I think

rubygem-katello-4.8.1-1.el8.noarch

also needs to be 4.8.2. That’s where the code change is.

intersting. The katello-4.8.2-1 update on the proxies also pulled in newer rubgem-katello, but on the master, it did not
I have updated rubygem on the master, then run foreman-installer, but now I receive an error towards the end of this…

2023-07-07 08:31:05 [ERROR ] [configure] /Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[sv-prod-foreman01.splat.bt.com]: Could not evaluate: Error making GET request to Foreman at https://sv-prod-foreman01.splat.bt.com/api/v2/smart_proxies: Response: 500 Internal Server Error: Check /var/log/foreman/production.log on sv-prod-foreman01.splat.bt.com for detailed information
2023-07-07 08:31:05 [NOTICE] [configure] 1500 configuration steps out of 1502 steps complete.
2023-07-07 08:31:07 [NOTICE] [configure] System configuration has finished.

There were errors detected during install.
Please address the errors and re-run the installer to ensure the system is properly configured.

2023-07-07T08:32:30 [W|app|97f057a4] Action failed
2023-07-07T08:32:30 [I|app|97f057a4] Backtrace for ‘Action failed’ error (ActionView::Template::Error): Cannot find rabl template ‘katello/api/v2/smart_proxies/pulp_info’ within registered ([“/usr/share/foreman/app/views”, “/usr/share/gems/gems/katello-4.8.1/app/views”]) view paths!

Try stopping foreman first:

foreman-maintain service stop

then run:

foreman-installer

again, hopefully that will do the trick

thanks, yeah tried that and managed to get the installer happy again after a few attempts.
also tested the lifecycle change and all good
is there a need to also update katello-debug and katello-repos to 4.8.2.1 or can leave as is?

Will likely perform a full update to 3.7 / 4.9 in the next month or so anyway

1 Like