Bug 1364544 - Discovery auto provisioning fails in Satellite 6.2 (undefined method path for media)
Summary: Discovery auto provisioning fails in Satellite 6.2 (undefined method path for...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: Unspecified
Assignee: Lukas Zapletal
QA Contact: Sachin Ghai
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1319283 1394363
TreeView+ depends on / blocked
 
Reported: 2016-08-05 16:31 UTC by sthirugn@redhat.com
Modified: 2020-03-11 15:11 UTC (History)
8 users (show)

Fixed In Version: rubygem-katello-3.0.0.86-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-12 17:12:17 UTC
Target Upstream Version:


Attachments (Terms of Use)
production.log (27.97 KB, text/plain)
2016-08-05 16:31 UTC, sthirugn@redhat.com
no flags Details
discovery_failure (26.30 KB, image/png)
2016-08-05 16:32 UTC, sthirugn@redhat.com
no flags Details


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 16063 Urgent Closed Autoprovisioning fails with Katello plugin installed 2020-10-20 21:29:02 UTC
Red Hat Knowledge Base (Solution) 2475281 None None None 2016-11-20 03:25:49 UTC
Red Hat Product Errata RHBA-2016:2940 normal SHIPPED_LIVE Satellite 6.2.5 Async Bug Release 2016-12-12 22:08:21 UTC

Description sthirugn@redhat.com 2016-08-05 16:31:07 UTC
Created attachment 1187973 [details]
production.log

Description of problem:
Discovery auto provisioning fails

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

How reproducible:
Always

Steps to Reproduce:
1. Setup a hostgroup and configure all required settings including PuppetCA, Puppet Master
2. Setup rules for autoprovisioning of discovered hosts
2. Automatically discover/provision a host via PXE

Actual results:
Error as shown in the attachment - production.log

Expected results:


Additional info:

Comment 1 sthirugn@redhat.com 2016-08-05 16:32:18 UTC
Created attachment 1187974 [details]
discovery_failure

Comment 2 sthirugn@redhat.com 2016-08-05 16:33:06 UTC
error:
2016-08-05 12:32:10 [app] [W] Fetch TFTP boot files for <hostname> task failed with the following error: undefined method `path' for nil:NilClass
 | NoMethodError: undefined method `path' for nil:NilClass
 | /usr/share/foreman/app/models/operatingsystem.rb:121:in `medium_uri'

Comment 6 Lukas Zapletal 2016-08-09 06:18:03 UTC
This is not a bug in discovery or our code. It's misconfiguration on your instance. Media is not available, check your hostgroup, try to provision a host via PXE first.

We should not raise this ugly error and give nicer error dialog instead, we are tracking this as a low priority ticket:

http://projects.theforeman.org/issues/16014

Comment 7 sthirugn@redhat.com 2016-08-09 16:32:38 UTC
@lzap: The hostgroup has the Media associated to it.  I did not mention this in the bug but I was also able to provision a new host using this hostgroup via UI.


Installation Media info:

Name: Default_Organization/Library/Red_Hat_Server/Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_2

Path: http://$host/pulp/repos/Default_Organization/Library/content/dist/rhel/server/7/7.2/x86_64/kickstart/

Operating System Family: Red Hat

Locations: Default Location

Organization: Default Organization

Comment 8 Lukas Zapletal 2016-08-10 06:28:01 UTC
Is the media in correct taxonomy? Can you give me access to the box? Please ping me on IRC.

Comment 10 Lukas Zapletal 2016-08-11 12:48:11 UTC
I apologize, this looked like a clear case as we haven't changed any code in regard to auto-provisioning, but it's a regression introduced by ContentFacet - changes in core and Katello plugin towards host unification.

Blocker bug, z-stream, and solution will be challenging.

Comment 12 Bryan Kearney 2016-08-12 18:17:33 UTC
Upstream bug assigned to lzap@redhat.com

Comment 14 Lukas Zapletal 2016-09-06 12:10:03 UTC
This is 6.2 regression, high impact, we are working on a fix.

Comment 16 Lukas Zapletal 2016-10-18 11:21:02 UTC
WORKAROUND PATCH:

--- /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-5.0.0.9/app/controllers/concerns/foreman/controller/discovered_extensions.rb.org    2016-10-18 13:20:07.108052846 +0200
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-5.0.0.9/app/controllers/concerns/foreman/controller/discovered_extensions.rb        2016-10-18 13:15:27.838908657 +0200
@@ -57,6 +57,12 @@
     # explicitly set all inheritable attributes from hostgroup
     host.attributes = host.apply_inherited_attributes(hostgroup_id: rule.hostgroup_id)
     host.set_hostgroup_defaults
+    # fix katello content facet
+    host.build_content_facet(
+        :kickstart_repository_id => rule.hostgroup.inherited_kickstart_repository_id,
+        :content_source_id => rule.hostgroup.content_source_id,
+        :content_view_id => rule.hostgroup.content_view_id,
+        :lifecycle_environment_id => rule.hostgroup.lifecycle_environment_id)
     # save! does not work here
     host.save ? host : false
   end

Comment 18 Bryan Kearney 2016-10-18 14:11:54 UTC
Upstream bug component is Content Views

Comment 19 Bryan Kearney 2016-11-01 02:09:29 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16063 has been resolved.

Comment 21 Lukas Zapletal 2016-11-03 09:25:24 UTC
I guess it's correct now. Thanks.

Comment 23 Lukas Zapletal 2016-11-03 13:07:18 UTC
HOTFIX FOR 6.2.2 AVAILABLE AT:

http://people.redhat.com/~lzapleta/hotfix/content-autoprovisioning-satellite-6.2.2-1364544/

Customers should not upgrade to 6.2.3 as the official fix is scheduled for 6.2.4.

Comment 24 Mike McCune 2016-11-17 21:25:41 UTC
HOTFIX FOR 6.2.4 AVAILABLE AT:

http://people.redhat.com/~mmccune/hotfix/1364544/

install via the rpm or yum command and run 'katello-service restart'

Comment 26 Sachin Ghai 2016-12-01 13:20:57 UTC
Verified with sat6.2.5 snap1.

auto provisioning works fine with pxe and pxe-less provisioning. I tried both ways:

1. enabled auto-provisioning from settings and define a discovery-rule for auto-provisioning
2. discovered a host via pxe.
3. auto-provisioning started as as soon as host get discovered.
4. host was successfully provisioned.

same steps performed with pxe-less(iso) discovery and auto-prov works via kexec.

-------
2016-12-01 08:16:05 [app] [I] Started POST "/discovered_hosts/mac525400a22a38/auto_provision" for 10.67.7.22 at 2016-12-01 08:16:05 -0500
2016-12-01 08:16:05 [app] [I] Processing by DiscoveredHostsController#auto_provision as HTML
2016-12-01 08:16:05 [app] [I]   Parameters: {"authenticity_token"=>"UfVY7Uq+AaCxCivb2ycVwr/zwQZzVrXPcW1IGL7gy10=", "id"=>"mac525400a22a38"}
2016-12-01 08:16:05 [app] [I] Match found for host mac525400a22a38 (5) rule rule1 (1)
2016-12-01 08:16:06 [app] [I] Create DHCP reservation for mac525400a22a38.idmqe.lab.eng.bos.redhat.com-52:54:00:a2:2a:38/192.168.100.14
2016-12-01 08:16:06 [app] [I] Add DNS A record for mac525400a22a38.idmqe.lab.eng.bos.redhat.com/192.168.100.14
2016-12-01 08:16:06 [app] [I] Add DNS PTR record for 192.168.100.14/mac525400a22a38.idmqe.lab.eng.bos.redhat.com
2016-12-01 08:16:08 [app] [I] Redirected to https://cloud-qe-4.idmqe.lab.eng.bos.redhat.com/discovered_hosts
2016-12-01 08:16:08 [app] [I] Completed 302 Found in 2621ms (ActiveRecord: 123.9ms)
2016-12-01 08:16:08 [app] [I] Started GET "/discovered_hosts" for 10.67.7.22 at 2016-12-01 08:16:08 -0500
2016-12-01 08:16:08 [app] [I] Processing by DiscoveredHostsController#index as HTML
2016-12-01 08:16:08 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-5.0.0.9/app/views/discovered_hosts/_discovered_hosts_list.html.erb (6.1ms)
2016-12-01 08:16:08 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-5.0.0.9/app/views/discovered_hosts/index.html.erb within layouts/application (9.8ms)
2016-12-01 08:16:08 [app] [I]   Rendered common/_searchbar.html.erb (2.4ms)
2016-12-01 08:16:08 [app] [I]   Rendered layouts/_application_content.html.erb (2.9ms)
2016-12-01 08:16:08 [app] [I]   Rendered home/_submenu.html.erb (1.2ms)
2016-12-01 08:16:08 [app] [I]   Rendered home/_user_dropdown.html.erb (1.3ms)
2016-12-01 08:16:08 [app] [I] Read fragment views/tabs_and_title_records-3 (0.1ms)
2016-12-01 08:16:08 [app] [I]   Rendered home/_topbar.html.erb (3.5ms)
2016-12-01 08:16:08 [app] [I]   Rendered layouts/base.html.erb (4.6ms)
2016-12-01 08:16:08 [app] [I] Completed 200 OK in 42ms (Views: 17.0ms | ActiveRecord: 4.9ms)
2016-12-01 08:16:18 [app] [I] Started GET "/unattended/provision?token=3de791d5-a2c2-4844-a6c8-09c160d2121e&static=yes" for 192.168.100.14 at 2016-12-01 08:16:18 -0500
2016-12-01 08:16:18 [app] [I] Processing by UnattendedController#host_template as */*
2016-12-01 08:16:18 [app] [I]   Parameters: {"token"=>"3de791d5-a2c2-4844-a6c8-09c160d2121e", "static"=>"yes", "kind"=>"provision"}
2016-12-01 08:16:18 [app] [I] Found mac525400a22a38.idmqe.lab.eng.bos.redhat.com
2016-12-01 08:16:19 [app] [I]   Rendered inline template (336.6ms)
2016-12-01 08:16:19 [app] [I] Completed 200 OK in 1576ms (Views: 320.7ms | ActiveRecord: 26.7ms)

Comment 27 Sachin Ghai 2016-12-01 13:23:38 UTC
Later, I disabled the discovery rule and discovered a host via pxe/pxe-less and then enable the rule and manually click on 'Auto-provision'. This time too provisioning auto-started. I don't see the reported issue.

Comment 28 Sachin Ghai 2016-12-01 14:08:10 UTC
Moving this verified as per comments26 & 27.

Comment 29 Lukas Zapletal 2016-12-02 11:01:24 UTC
*** Bug 1400708 has been marked as a duplicate of this bug. ***

Comment 30 errata-xmlrpc 2016-12-12 17:12:17 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, 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/RHBA-2016:2940


Note You need to log in before you can comment on or make changes to this bug.