Bug 2166303

Summary: Edit and Submit is not possible from All Hosts in Satellite 6.13
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: HostsAssignee: kmalyjur
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: aruzicka, pnovotny
Target Milestone: 6.13.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: foreman-3.5.1.8-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-03 13:24:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sayan Das 2023-02-01 13:18:40 UTC
Description of problem:

After editing a host from All Hosts page and changing some data in the same, hitting on Submit results in "The host <host_shortname> does not exist"

This is a regression as I don't see the same behavior in Satellite 6.12.0

Version-Release number of selected component (if applicable):

Satellite 6.13


How reproducible:

Always


Steps to Reproduce:
1. Install a Satellite 6.13
2. Install an RHEL 8 system by name rhel8.example.com
3. Register the system with Satellite 
4. Go to Hosts --> All Hosts page, and click on the edit button for the host "rhel8.example.com"
5. Submit ( with or without making any changes )

Actual results:

URL in browser redirects to https://<satellite-fqdn>/page-not-found

and the error message is 

No host found
The host rhel8 does not exist or there are access permissions needed. Please contact your administrator if this issue continues.

Seems like one of the controller is pointing the "/api/hosts/" to use the shortname of the Host profiles instead of the ID or Full FQDN

Expected results:

The UI should get back to The new UI of that Host after submitting changes. 


Additional info:

Not reproducible in Satellite 6.12

Following trace in production.log of satellite 6.13


2023-02-01T18:36:26 [I|app|351ef1a9] Started PATCH "/hosts/3" for X.X.X.X at 2023-02-01 18:36:26 +0530
2023-02-01T18:36:26 [I|app|351ef1a9] Processing by HostsController#update as */*
2023-02-01T18:36:26 [I|app|351ef1a9]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"hekMC7mCvJtg8qd6dXEzrjC7A6ucs7nh4cvQdHfVPZZ9u5CnDu0V/3vBQkM4/VVRiVbYuZGb0mCTE4qIeD3CkA==", "host"=>{"name"=>"rhel8", "hostgroup_id"=>"", "content_facet_attributes"=>{"lifecycle_environment_id"=>"1", "content_view_id"=>"1", "content_source_id"=>"2"}, "openscap_proxy_id"=>"", "managed"=>"false", "progress_report_id"=>"[FILTERED]", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "mac"=>"00:1a:4a:00:02:7a", "identifier"=>"ens3", "name"=>"rhel8", "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"x.y.z.228", "ip6"=>"2620:52:0:4af8:21a:4aff:fe00:27a", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "tag"=>"", "attached_to"=>"", "id"=>"3"}}, "host_parameters_attributes"=>{"0"=>{"name"=>"host_registration_insights", "parameter_type"=>"boolean", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"10"}, "1"=>{"name"=>"host_registration_remote_execution_pull", "parameter_type"=>"boolean", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"12"}, "2"=>{"name"=>"host_update_packages", "parameter_type"=>"boolean", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"11"}}, "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"2", "comment"=>"", "overwrite"=>"false"}, "id"=>"3"}
2023-02-01T18:36:26 [I|app|351ef1a9] ForemanWebhooks::EventSubscriber: host_updated.event.foreman event received
2023-02-01T18:36:26 [I|app|351ef1a9] Redirected to https://rhel8.example.com/new/hosts/rhel8.example.com
2023-02-01T18:36:26 [I|app|351ef1a9] Completed 302 Found in 70ms (ActiveRecord: 9.2ms | Allocations: 24903)
2023-02-01T18:36:26 [I|app|71f62aaf] Started GET "/new/hosts/rhel8.example.com" for X.X.X.X at 2023-02-01 18:36:26 +0530
2023-02-01T18:36:26 [I|app|71f62aaf] Processing by ReactController#index as */*
2023-02-01T18:36:26 [I|app|71f62aaf]   Parameters: {"id"=>"rhel8.example.com"}
2023-02-01T18:36:26 [I|app|71f62aaf]   Rendered react/index.html.erb within layouts/react_application (Duration: 1.5ms | Allocations: 131)
2023-02-01T18:36:26 [I|app|71f62aaf]   Rendered layouts/base.html.erb (Duration: 42.6ms | Allocations: 37152)
2023-02-01T18:36:26 [I|app|71f62aaf]   Rendered layout layouts/react_application.html.erb (Duration: 45.9ms | Allocations: 37623)
2023-02-01T18:36:26 [I|app|71f62aaf] Completed 200 OK in 62ms (Views: 45.4ms | ActiveRecord: 3.9ms | Allocations: 43450)
2023-02-01T18:36:26 [I|app|9ddc584c] Started GET "/api/hosts/rhel8?show_hidden_parameters=true" for X.X.X.X at 2023-02-01 18:36:26 +0530
2023-02-01T18:36:26 [I|app|8cfee0d1] Started GET "/hosts/rhel8/statuses" for X.X.X.X at 2023-02-01 18:36:26 +0530
2023-02-01T18:36:26 [I|app|ad3cd40d] Started GET "/api/remote_execution_features" for X.X.X.X at 2023-02-01 18:36:26 +0530
2023-02-01T18:36:26 [I|app|8cfee0d1] Processing by HostsController#statuses as JSON
2023-02-01T18:36:26 [I|app|8cfee0d1]   Parameters: {"id"=>"rhel8"}
2023-02-01T18:36:26 [I|app|ad3cd40d] Processing by Api::V2::RemoteExecutionFeaturesController#index as JSON
2023-02-01T18:36:26 [I|app|ad3cd40d]   Parameters: {"apiv"=>"v2"}
2023-02-01T18:36:26 [I|app|9ddc584c] Processing by Api::V2::HostsController#show as JSON
2023-02-01T18:36:26 [I|app|9ddc584c]   Parameters: {"show_hidden_parameters"=>"true", "apiv"=>"v2", "id"=>"rhel8"}
2023-02-01T18:36:26 [I|app|8cfee0d1]   Rendered common/404.html.erb within layouts/application (Duration: 5.0ms | Allocations: 3790)
2023-02-01T18:36:26 [I|app|8cfee0d1]   Rendered layouts/base.html.erb (Duration: 16.8ms | Allocations: 17605)
2023-02-01T18:36:26 [I|app|8cfee0d1]   Rendered layout layouts/application.html.erb (Duration: 34.7ms | Allocations: 33990)
2023-02-01T18:36:26 [I|app|8cfee0d1] Completed 404 Not Found in 52ms (Views: 36.0ms | ActiveRecord: 3.3ms | Allocations: 37872)
2023-02-01T18:36:26 [I|app|b04c51ee] Started GET "/api/hosts/rhel8/power?timeout=30" for X.X.X.X at 2023-02-01 18:36:26 +0530
2023-02-01T18:36:26 [I|app|ccde80bb] Started GET "/api/audits?search=host%3Drhel8&per_page=3" for X.X.X.X at 2023-02-01 18:36:26 +0530
2023-02-01T18:36:26 [I|app|9ddc584c] Couldn't find Host::Managed with 'id'=rhel8 [WHERE "hosts"."type" = $1 AND "hosts"."organization_id" = $2 AND "hosts"."location_id" = $3] (ActiveRecord::RecordNotFound)
2023-02-01T18:36:26 [I|app|9ddc584c]   Rendered api/v2/errors/not_found.json.rabl within api/v2/layouts/error_layout (Duration: 6.7ms | Allocations: 7221)
2023-02-01T18:36:26 [I|app|9ddc584c]   Rendered layout api/v2/layouts/error_layout.json.erb (Duration: 11.7ms | Allocations: 13494)
2023-02-01T18:36:26 [I|app|9ddc584c] Completed 404 Not Found in 77ms (Views: 12.3ms | ActiveRecord: 51.1ms | Allocations: 37687)
2023-02-01T18:36:26 [I|app|ccde80bb] Processing by Api::V2::AuditsController#index as JSON
2023-02-01T18:36:26 [I|app|ccde80bb]   Parameters: {"search"=>"host=rhel8", "per_page"=>"3", "apiv"=>"v2"}
2023-02-01T18:36:26 [I|app|b04c51ee] Processing by Api::V2::HostsController#power_status as JSON
2023-02-01T18:36:26 [I|app|b04c51ee]   Parameters: {"timeout"=>"30", "apiv"=>"v2", "id"=>"rhel8"}


2023-02-01T18:36:26 [I|app|b04c51ee] Couldn't find Host::Managed with 'id'=rhel8 [WHERE "hosts"."type" = $1 AND "hosts"."organization_id" = $2 AND "hosts"."location_id" = $3] (ActiveRecord::RecordNotFound)
2023-02-01T18:36:26 [I|app|b04c51ee]   Rendered api/v2/errors/not_found.json.rabl within api/v2/layouts/error_layout (Duration: 5.5ms | Allocations: 6403)

Comment 3 Bryan Kearney 2023-02-22 20:03:20 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35762 has been resolved.

Comment 5 Peter Ondrejka 2023-03-06 09:21:54 UTC
Verified on Satellite 6.13 snap 13.

Comment 8 errata-xmlrpc 2023-05-03 13:24:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.13 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2097