Bug 1374285

Summary: API lacks ability to modify/specify hostgroup openscap capsule via API or hammer cli
Product: Red Hat Satellite Reporter: Will D <will_darton>
Component: SCAP PluginAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: Sanket Jagtap <sjagtap>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham, bkearney, jcallaha, kdixon, mhulan, nshaik, rballang, riehecky, sghai, sjagtap
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:46:43 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:
Bug Depends On:    
Bug Blocks: 1459226    

Description Will D 2016-09-08 11:57:53 UTC
Description of problem:
API lacks ability to modify/specify hostgroup openscap capsule via API or hammer cli

Version-Release number of selected component (if applicable):
foreman-1.11.0.51-1.el7sat.noarch
foreman-compute-1.11.0.51-1.el7sat.noarch
foreman-debug-1.11.0.51-1.el7sat.noarch
foreman-ec2-1.11.0.51-1.el7sat.noarch
foreman-gce-1.11.0.51-1.el7sat.noarch
foreman-installer-1.11.0.10-1.el7sat.noarch
foreman-installer-katello-3.0.0.56-1.el7sat.noarch
foreman-libvirt-1.11.0.51-1.el7sat.noarch
foreman-openstack-1.11.0.51-1.el7sat.noarch
foreman-ovirt-1.11.0.51-1.el7sat.noarch
foreman-postgresql-1.11.0.51-1.el7sat.noarch
foreman-proxy-1.11.0.5-1.el7sat.noarch
foreman-rackspace-1.11.0.51-1.el7sat.noarch
foreman-selinux-1.11.0.2-1.el7sat.noarch
foreman-vmware-1.11.0.51-1.el7sat.noarch
katello-3.0.0-11.el7sat.noarch
katello-certs-tools-2.4.0-1.el7sat.noarch
katello-client-bootstrap-1.1.0-2.el7sat.noarch
katello-common-3.0.0-11.el7sat.noarch
katello-debug-3.0.0-11.el7sat.noarch
katello-default-ca-1.0-1.noarch
katello-installer-base-3.0.0.56-1.el7sat.noarch
katello-selinux-3.0.1.2-1.el7sat.noarch
katello-server-ca-1.0-1.noarch
katello-service-3.0.0-11.el7sat.noarch
pulp-katello-1.0.1-1.el7sat.noarch
puppet-foreman_scap_client-0.3.3-10.el7sat.noarch
slvdcrvsat02.nfcu.net-foreman-client-1.0-1.noarch
slvdcrvsat02.nfcu.net-foreman-proxy-1.0-1.noarch
slvdcrvsat02.nfcu.net-foreman-proxy-client-1.0-1.noarch
tfm-rubygem-foreman_bootdisk-6.1.0.3-1.el7sat.noarch
tfm-rubygem-foreman_discovery-5.0.0.9-1.el7sat.noarch
tfm-rubygem-foreman_docker-2.0.1.11-1.el7sat.noarch
tfm-rubygem-foreman_hooks-0.3.11-1.el7sat.noarch
tfm-rubygem-foreman_openscap-0.5.3.17-1.el7sat.noarch
tfm-rubygem-foreman-redhat_access-1.0.11-1.el7sat.noarch
tfm-rubygem-foreman_remote_execution-0.3.0.11-1.el7sat.noarch
tfm-rubygem-foreman-tasks-0.7.14.6-3.el7sat.noarch
tfm-rubygem-foreman_theme_satellite-0.1.26-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.5.1.9-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_admin-0.0.5-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_discovery-0.0.2.3-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.6-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_remote_execution-0.0.5.3-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.10.3-1.el7sat.noarch
tfm-rubygem-hammer_cli_katello-0.0.22.25-1.el7sat.noarch
tfm-rubygem-katello-3.0.0.73-1.el7sat.noarch


How reproducible:
Every time

Steps to Reproduce:
1. hammer hostgroup create --help | grep scap (no option for scap
2. Via Foreman/Katello/Satellite API docs, no reference to set openscap capsule for hostgroup
3.

Actual results:
None

Expected results:
Should be able to configure the openscap capsule for a hostgroup via hammer cli or API requests

Additional info:

Comment 1 Marek Hulan 2016-09-08 12:30:56 UTC
Created redmine issue http://projects.theforeman.org/issues/16490 from this bug

Comment 3 Marek Hulan 2016-10-05 08:50:18 UTC
*** Bug 1380654 has been marked as a duplicate of this bug. ***

Comment 13 Marek Hulan 2017-08-21 14:59:55 UTC
Both linked issues must be fixed. They are currently pending review. Once they are in, this will allow do commands such as

> hammer host info --id 2
> hammer hostgroup info --id 2

which will contain e.g. (similar to Puppet Proxy ID)

> OpenSCAP Proxy:         1

also creating/updating will be available

> hammer host update --id 2 --openscap-proxy-id 1
> hammer hostgroup create --name openscap --openscap-proxy-id 1

All is to be found in /apidoc after new apipie cache is generated e.g. by

> foreman-rake apipie:cache

Note for QE: this also touched WebUI, the OpenSCAP proxy field should now support inheriting like other proxy fields. The label and inline helps changed. UI part should be also tested.

Comment 14 Satellite Program 2017-08-21 16:00:37 UTC
Upstream bug assigned to mhulan

Comment 15 Satellite Program 2017-08-21 16:00:44 UTC
Upstream bug assigned to mhulan

Comment 16 Satellite Program 2017-09-14 08:00:37 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20681 has been resolved.

Comment 19 Sanket Jagtap 2017-10-18 10:13:41 UTC
Satellite 6.3.0 snap 20

FOR HOSTGROUP:

hammer hostgroup update --help
--openscap-proxy-id OPENSCAP_PROXY_ID                     ID of OpenSCAP Capsule

hammer hostgroup info --id 1
Id:                     1
'''
'''
Locations:              
    Default Location
Organizations:          
    Default Organization
Parent Id:              
OpenSCAP Proxy:         1
Content View:           RHEL 6 CV
Lifecycle Environment:  DEV
Content Source:         satellite

[root@dell-per630-fc-01 ~]# hammer hostgroup update --id 1 --openscap-proxy-id 1
Hostgroup updated
[root@dell-per630-fc-01 ~]# hammer hostgroup info --id 1
Id:                     1
'''
'''
Locations:              
    Default Location
Organizations:          
    Default Organization
Parent Id:              
OpenSCAP Proxy:         1
Content View:           RHEL 6 CV
Lifecycle Environment:  DEV
Content Source:         dell-per630-fc-01.

hammer> hostgroup create --name test --openscap-proxy-id 1
Hostgroup created
hammer> hostgroup info --id 2
Id:                     2
Name:                   test
Title:                  test
Puppet CA Proxy Id:     
Puppet Master Proxy Id: 
Puppetclasses:          

Parameters:             

Parent Id:              
OpenSCAP Proxy:         1
Content View:           
Lifecycle Environment:  
Content Source:



The new sub-command is exposed for the hostgroup
------------------------------------------------------------------------------
For HOST
According to the https://bugzilla.redhat.com/show_bug.cgi?id=1374285#c13

hammer> host info --id 13
Id:                       13
UUID:                     e72746d7-47a3-4351-b447-a12152c41dcd
Name:                     rocky-pridham.
""""
OpenSCAP Proxy:

There is the OpenScap Proxy field available via INFO command , but on trying to update this
host update --help
No --openscap-proxy-id command

host update --id 13 --openscap-proxy-id 1
Could not update the host:
  Error: Unrecognised option '--openscap-proxy-id'
  
  See: ' host update --help'

We should also be able to manipulate proxy for individual host.

Was this missed or should this be tracked under issue?

Comment 20 Marek Hulan 2017-10-18 14:12:29 UTC
This now fails for host only, the reason is that hosts controller is required before foreman_openscap plugin is initiated. This is caused by katello https://github.com/Katello/katello/blob/7ef4d0cba21d867581bafdf875e366d874c0cefc/lib/katello/plugin.rb#L248

I suggest we change this to VERIFIED since for hostgroups it works, and opening a separate issue for hosts with the information from above. Users should be unblocked by this.

Comment 21 Marek Hulan 2017-10-18 14:43:03 UTC
If you're going to open separate issue, please link it to http://projects.theforeman.org/issues/21382, I sent a fix upstream for it already.

Comment 22 Sanket Jagtap 2017-10-23 08:54:56 UTC
Verifying this as per the comments #19 and #20

New Issue filed for host: https://bugzilla.redhat.com/show_bug.cgi?id=1505295

Comment 23 Bryan Kearney 2018-02-21 16:42:38 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-2018:0336

Comment 24 Bryan Kearney 2018-02-21 16:46:43 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-2018:0336