Bug 1126937

Summary: Add @provisioning_type variable to tell when provisioning with a host group
Product: Red Hat Satellite Reporter: Stephen Benjamin <stbenjam>
Component: Provisioning TemplatesAssignee: Stephen Benjamin <stbenjam>
Status: CLOSED WORKSFORME QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0.4CC: bbuckingham, bkearney, cwelton, dcleal, jmontleo, kbidarka, lpramuk, mmccune, peter.vreman, sthirugn, xdmoon
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/6861
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-07 14:17:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1220728, 1337931    
Bug Blocks: 1098183, 1122832, 1126087    

Description Stephen Benjamin 2014-08-05 15:56:02 UTC
A host group provisioned host won't have a token, so the call to foreman_url fails.  We should have a helper to know if we're provisioning by hostgroup/template or an actual host.

Comment 1 Stephen Benjamin 2014-08-05 15:56:04 UTC
Created from redmine issue http://projects.theforeman.org/issues/6861

Comment 2 Stephen Benjamin 2014-08-05 15:56:10 UTC
Upstream bug assigned to stbenjam

Comment 3 Stephen Benjamin 2014-08-05 16:01:25 UTC
This is needed in order to make Host Group provisioning fully work.

Upstream commit:
7d5aaa825a87d308650b6f3ebdea6bbef4f86dce

Comment 5 Bryan Kearney 2014-08-05 16:05:43 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6861 has been closed
-------------
Anonymous
Applied in changeset commit:7d5aaa825a87d308650b6f3ebdea6bbef4f86dce.

Comment 8 Corey Welton 2014-08-20 18:12:40 UTC
Marking this verified since group provisioning appears to be ok.

Satellite-6.0.4-RHEL-6-20140813.2

Comment 15 Peter Vreman 2015-02-25 08:16:55 UTC
Confirmed that it works with 6.0.7, this issue can be closed.

Comment 16 Kedar Bidarkar 2015-03-16 12:08:03 UTC
1) created a host_group
2)associate katello kickstart default to a host-group
3) Deploy default PXE files
4) check the file on sat6  /var/lib/tftpboot/pxelinux.cfg/default

Rendering fails:

http://dhcp201-167.englab.pnq.redhat.com/unattended/template/Katello%20Kickstart%20Default/rhel66_grp

Get the below message when accessing the URL or provisioning.

There was an error rendering the Unnamed template: undefined method 'mac' for Hostgroup::Jail (Hostgroup)

Comment 17 Kedar Bidarkar 2015-03-16 12:09:50 UTC
TESTED with sat6.1 Beta snap6 compose2.

Comment 22 Kedar Bidarkar 2015-07-14 10:21:52 UTC
this bug depends on bug 1220728 which is marked for 6.2.0 and this for 6.1.1.

Comment 23 Bryan Kearney 2015-07-14 13:12:49 UTC
moving to 6.2

Comment 24 Peter Vreman 2015-07-17 18:02:10 UTC
The @provision_type works fine since 6.0.5 or so, we use it on a daily basis for at least 6 months.

The failure on the hostgroup jail that is cannot find the .mac is correct. The accessing of the .mac shall be done only when the @provision_type != hostgroup.

That means that this issue can be closed and then use the "@provision_type != hostgroup" feature to fix the BZ1220728

Comment 26 errata-xmlrpc 2015-08-12 05:13:28 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/RHSA-2015:1592

Comment 27 sthirugn@redhat.com 2015-08-14 20:44:34 UTC
Accidentally closed with 6.1.1 errata

Comment 29 Lukas Pramuk 2016-06-06 11:24:16 UTC
FailedQA.

@satellite-6.2.0-14.2.el7sat.noarch

the behavior is the same as comment #16 had reported:

2016-06-06 06:25:02 [app] [I] Started GET "/unattended/template/Satellite%20Kickstart%20Default/My%20Hostgroup" for <CLIENT_IP> at 2016-06-06 06:25:02 -0400
2016-06-06 06:25:02 [app] [I] Processing by UnattendedController#hostgroup_template as HTML
2016-06-06 06:25:02 [app] [I]   Parameters: {"id"=>"Satellite Kickstart Default", "hostgroup"=>"My Hostgroup"}
2016-06-06 06:25:02 [app] [I]   Rendered inline template (71.7ms)
2016-06-06 06:25:02 [app] [W] There was an error rendering the Unnamed template: 
 | ActionView::Template::Error: undefined method 'mac' for Hostgroup::Jail (Hostgroup)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.2.3/lib/safemode/jail.rb:17:in `method_missing'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.2.3/lib/safemode.rb:89:in `bind'

Comment 30 Bryan Kearney 2016-06-06 12:02:54 UTC
Upstream bug component is Provisioning Templates

Comment 31 Stephen Benjamin 2016-06-07 14:17:40 UTC
I'm just going to close this.  This variable was added over 2 years ago and working just fine since then - but QE wants to verify with the shipped Satellite templates which are always broken with HG provisioning due to other issues.  That's how long hostgroup provisioning has been broken in one fashion or another. 

If you really wanted to verify this, you could create a 1-line template

<%= @provisioning_type %>

and preview the template in a host group or host provsioning scenario, but imho it's a waste of QE's time.  

If users are using hostgroup provisioning, they need to write their own templates, and generally people should be directed to use PXEless discovery anyway.

Comment 32 Lukas Pramuk 2016-06-08 09:32:37 UTC
Then it's OK to close this.
But I need to move my failedqa to more proper bug then.

Moving to > BZ 1126087 
undefined method 'certname' for Hostgroup::Jail (customer reported)
undefined method 'mac' for Hostgroup::Jail (me reported)

Comment 33 Stephen Benjamin 2016-06-08 12:46:55 UTC
We can leave the bug open but not sure that we'll fix it - when I discussed with others on IRC, we agreed to keep HG provisioning as is and only fix regressions. Those errors aren't regressions since they never worked.  Users need to create their own basic templates for use with HG provisioning because it's such a limited feature.

The two errors -- certname is for puppet.conf and mac is from the networking snippet -- can't really work with HG provisioning anyway, you need a real host.