Bug 1170696

Summary: hammer host enable build can be enable also for unmanaged hosts
Product: Red Hat Satellite Reporter: Peter Vreman <peter.vreman>
Component: APIAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Stephen Benjamin <stbenjam>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0.4CC: cwelton, dcleal, stbenjam
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/8587
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:38:28 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:
Bug Depends On:    
Bug Blocks: 1122832    

Description Peter Vreman 2014-12-04 15:53:42 UTC
Description of problem:
It is possible to enable build also for hosts that are not managed. The result is then a no-op, because the PXE templates are not generated.

This behaviour is inconsistent with the UI, that where you cannot click the Build button when the host is not Managed. Also in the situation of enabling build without managed shows in the UI that the node is in Building status, but you are not allowed to view the templates either, these show an error that the host is not managed.


hoiroot@li-lc-1017:~$ sudo -u hoici hammer -c /opt/hoici/etc/hammer-hoici.yaml host update --name li-lc-1014.hag.hilti.com --managed no
Host updated

hoiroot@li-lc-1017:~$ ls -l /var/lib/tftpboot/pxelinux.cfg/
total 16
-rw-r--r-- 1 foreman-proxy foreman-proxy 12361 Dec  4 15:22 default

hoiroot@li-lc-1017:~$ sudo -u hoici hammer -c /opt/hoici/etc/hammer-hoici.yaml host update --name li-lc-1014.hag.hilti.com --build no
Host updated

hoiroot@li-lc-1017:~$ sudo -u hoici hammer -c /opt/hoici/etc/hammer-hoici.yaml host update --name li-lc-1014.hag.hilti.com --build yes
Host updated

hoiroot@li-lc-1017:~$ ls -l /var/lib/tftpboot/pxelinux.cfg/
total 16
-rw-r--r-- 1 foreman-proxy foreman-proxy 12361 Dec  4 15:22 default


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


How reproducible:


Steps to Reproduce:
1. Use the hammer to enable build as shown above
2.
3.

Actual results:


Expected results:
Give an Error that enabling build is only allowed for Managed hosts.


Additional info:

Comment 1 RHEL Program Management 2014-12-04 16:04:06 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Dominic Cleal 2014-12-05 09:01:21 UTC
Created redmine issue http://projects.theforeman.org/issues/8587 from this bug

Comment 5 Bryan Kearney 2015-08-25 18:32:41 UTC
Upstream bug component is API

Comment 6 Bryan Kearney 2016-03-15 16:03:03 UTC
Upstream bug assigned to aruzicka

Comment 7 Adam Ruzicka 2016-03-23 10:31:34 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/8587 has been closed
-------------
Adam Ruzicka
Applied in changeset commit:dac16774f9d741a9ef361f0f6bbce452bdea6b92.

Comment 8 Stephen Benjamin 2016-07-07 18:57:56 UTC
Verified in Satellite 6.2 Snap 19.0 (foreman-1.11.0.43-1.el7sat.noarch)


Host is not managed:

[root@sat-snap-rhel7 ~]# hammer -u admin -p changeme host info --id=1
Id:                 1
Name:               sat-snap-rhel7.example.com
Environment:        production
Puppet CA Id:       1
Puppet Master Id:   1
Cert name:          sat-snap-rhel7.example.com
Managed:            no


Try to change to build=true:

[root@sat-snap-rhel7 ~]# hammer -u admin -p changeme host update --id=1 --build=true
Could not update the host:
  Build mode cannot be enabled for an unmanaged host

Comment 9 Bryan Kearney 2016-07-27 11:38: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/RHBA-2016:1501