Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1364544 - Discovery auto provisioning fails in Satellite 6.2 (undefined method path for media)
Discovery auto provisioning fails in Satellite 6.2 (undefined method path for...
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Content Views (Show other bugs)
6.2.0
Unspecified Unspecified
urgent Severity high (vote)
: 6.2.5
: Unused
Assigned To: Lukas Zapletal
Sachin Ghai
http://projects.theforeman.org/issues...
: Regression, Reopened
Depends On:
Blocks: 1319283 1394363
  Show dependency treegraph
 
Reported: 2016-08-05 12:31 EDT by sthirugn@redhat.com
Modified: 2016-12-12 12:12 EST (History)
8 users (show)

See Also:
Fixed In Version: rubygem-katello-3.0.0.86-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-12 12:12:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2475281 None None None 2016-11-19 22:25 EST
Foreman Issue Tracker 16063 None None None 2016-08-11 09:04 EDT
Red Hat Product Errata RHBA-2016:2940 normal SHIPPED_LIVE Satellite 6.2.5 Async Bug Release 2016-12-12 17:08:21 EST

  None (edit)
Description sthirugn@redhat.com 2016-08-05 12:31:07 EDT
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 12:32 EDT
Created attachment 1187974 [details]
discovery_failure
Comment 2 sthirugn@redhat.com 2016-08-05 12:33:06 EDT
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 02:18:03 EDT
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 12:32:38 EDT
@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 02:28:01 EDT
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 08:48:11 EDT
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 14:17:33 EDT
Upstream bug assigned to lzap@redhat.com
Comment 14 Lukas Zapletal 2016-09-06 08:10:03 EDT
This is 6.2 regression, high impact, we are working on a fix.
Comment 16 Lukas Zapletal 2016-10-18 07:21:02 EDT
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 10:11:54 EDT
Upstream bug component is Content Views
Comment 19 Bryan Kearney 2016-10-31 22:09:29 EDT
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 05:25:24 EDT
I guess it's correct now. Thanks.
Comment 23 Lukas Zapletal 2016-11-03 09:07:18 EDT
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 16:25:41 EST
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 08:20:57 EST
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 08:23:38 EST
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 09:08:10 EST
Moving this verified as per comments26 & 27.
Comment 29 Lukas Zapletal 2016-12-02 06:01:24 EST
*** Bug 1400708 has been marked as a duplicate of this bug. ***
Comment 30 errata-xmlrpc 2016-12-12 12:12:17 EST
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.