Bug 1260697 - [RFE] As a CLI user, I should be able to set the Content Source for a host and hostgroup. [NEEDINFO]
[RFE] As a CLI user, I should be able to set the Content Source for a host an...
Status: VERIFIED
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Content Management (Show other bugs)
6.0.4
Unspecified Unspecified
high Severity high (vote)
: GA
: --
Assigned To: Katello Bug Bin
Martin Korbel
http://projects.theforeman.org/issues...
: FutureFeature, PrioBumpGSS, Triaged
: 1332908 1351773 (view as bug list)
Depends On: 1316897
Blocks: GSS_Sat6Beta_Tracker/GSS_Sat6_Tracker 1122832
  Show dependency treegraph
 
Reported: 2015-09-07 09:14 EDT by Bryan Kearney
Modified: 2018-01-10 10:46 EST (History)
30 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
mhulan: needinfo? (tomckay)


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2763741 None None None 2016-11-13 14:17 EST
Foreman Issue Tracker 7597 None None None 2016-04-26 13:10 EDT

  None (edit)
Description Bryan Kearney 2015-09-07 09:14:18 EDT
Currently in Satellite6, the hammer tool cant be used to set the "Katello - Content Source" and I have to use the WebUI. This is currently the only element that I need to use the WebUI for, hammer can do the rest
Comment 1 Bryan Kearney 2015-09-07 09:14:21 EDT
Created from redmine issue http://projects.theforeman.org/issues/7597
Comment 3 Tom McKay 2016-04-07 09:33:18 EDT
My comment from redmine: I see that --content-source-id is available to both hammer host and hostgroup update, is this issue resolved?
Comment 4 Bryan Kearney 2016-04-10 18:02:57 EDT
Moving to POST since upstream bug http://projects.theforeman.org/issues/7597 has been closed
Comment 5 Bryan Kearney 2016-04-12 14:15:26 EDT
I show it for hostgroup in 6.2, but not host

[root@sat-test-rhel7 scenarios.d]# hammer hostgroup update --help | grep content
 --content-source-id CONTENT_SOURCE_ID                
 --content-view CONTENT_VIEW_NAME                    Name to search by
 --content-view-id CONTENT_VIEW_ID                   content view numeric identifier
[root@sat-test-rhel7 scenarios.d]# hammer host update --help | grep content
[root@sat-test-rhel7 scenarios.d]# 



Moving this to POST in 6.3 to get caught int he next rebase from upstream.
Comment 6 Julio Entrena Perez 2016-05-24 10:17:05 EDT
http://projects.theforeman.org/issues/14762 ?
Comment 8 Martin Korbel 2016-10-18 08:55:36 EDT
FAILQA on version tfm-rubygem-hammer_cli-0.8.0-1

Hammer return error for this case, the variant with id works well.

> hammer hostgroup update --content-view "test view" --id 1 
Could not update the hostgroup:
  Error: Missing options to search organization


The note for parameter "--content-source-id". It works well but we cannot get status via hammer.

> hammer hostgroup info --id 1
Id:                     1
Name:                   Test Group
Title:                  Test Group
Puppet CA Proxy Id:     
Puppet Master Proxy Id: 
Puppetclasses:          

Parameters:             

Locations:              
    Default Location
Organizations:          
    Default Organization
Parent Id:              
Content View:           Default Organization View
Lifecycle Environment:  Library



Other options look good, it works as we expect.

> hammer hostgroup update --content-view-id 2 --id 1
> hammer hostgroup info --id 1
...
  Content View:           test view
...


> hammer host update --content-view "test view" --id 2
> hammer host info --id 2
...
  Content View:          test view
...
> hammer host update --content-view-id 1 --id 2
  Content View:          Default Organization View



DOC:

> hammer hostgroup update --help | grep content
 --content-source-id CONTENT_SOURCE_ID               Content source ID
 --content-view CONTENT_VIEW_NAME                    Name to search by
 --content-view-id CONTENT_VIEW_ID                   content view numeric identifier


> hammer host update --help | grep content
 --content-view CONTENT_VIEW_NAME                    Name to search by
 --content-view-id CONTENT_VIEW_ID                   content view numeric identifier
Comment 9 Bryan Kearney 2016-10-18 10:04:04 EDT
Upstream bug component is Hammer - Content
Comment 11 Stuart Auchterlonie 2016-10-28 07:02:56 EDT
Is https://bugzilla.redhat.com/show_bug.cgi?id=1332908 a DUP of this bugzilla?
Comment 12 Marek Hulan 2016-10-31 04:58:20 EDT
*** Bug 1332908 has been marked as a duplicate of this bug. ***
Comment 13 Bryan Kearney 2016-11-03 11:00:00 EDT
*** Bug 1351773 has been marked as a duplicate of this bug. ***
Comment 14 Marek Hulan 2016-11-14 02:15:57 EST
Update: Host part seems to be fixed by bz 1390153, host group will take more time, since host group does not support facets. Further progress is blocked on following upstream issue http://projects.theforeman.org/issues/16630
Comment 15 Tomas Strachota 2017-03-01 06:00:56 EST
Displaying the content source in info action is tracked here:
https://bugzilla.redhat.com/show_bug.cgi?id=1313056

Usage of --content-view was fixed by (requires --query-organization now):
https://bugzilla.redhat.com/show_bug.cgi?id=1416862

--content-source-id is present in both host and hostgroup create and update in upstream so I'm switching this to ON_QA for verification.
Comment 18 Kedar Bidarkar 2017-08-18 09:46:07 EDT
[root@qe-rhel7 ~]# hammer -u admin -p changeme host create --help | grep -i content-source
 --content-source-id CONTENT_SOURCE_ID                
[root@qe-hel7 ~]# hammer -u admin -p changeme host update  --help | grep -i content-source
 --content-source-id CONTENT_SOURCE_ID                
[root@qe-rhel7 ~]# hammer -u admin -p changeme hostgroup create  --help | grep -i content-source
 --content-source-id CONTENT_SOURCE_ID               Content source ID
[root@qe-rhel7 ~]# hammer -u admin -p changeme hostgroup update  --help | grep -i content-source
 --content-source-id CONTENT_SOURCE_ID               Content source ID

[root@qe-rhel7 ~]# hammer -u admin -p changeme hostgroup info --id 2 | grep -i "content source"
Content Source:         sat6-hostname.redhat.com


VERIFIED with Sat6.3.0-snap11.0
Comment 19 Kedar Bidarkar 2017-08-18 11:01:45 EDT
hammer -u admin -p changeme hostgroup create --name='RHEL 7 Server 64-bit HG' --content-view='RHEL 7 CV' --environment-id=1 --lifecycle-environment='DEV' --content-source-id="1" --puppet-proxy="$(hostname)" --puppet-ca-proxy="$(hostname)" --query-organization-id="1" --puppet-classes='access_insights_client,foreman_scap_client' --domain-id="1" --subnet="katello_latest" --architecture='x86_64' --operatingsystem-id="3" --partition-table='Kickstart default' --location-ids="2"
Hostgroup created

--------------------------------

hammer -u admin -p changeme  host create --name='rhel-7-libvirt2' --root-password='changeme' --organization-id="1" --location-id="2" --hostgroup="RHEL 7 Server 64-bit HG" --compute-resource="libvirt" --compute-attributes="cpus=1, memory=1073741824, start=1" --interface="primary=true, compute_type=bridge, compute_bridge=katello_latest, compute_model=virtio" --volume="capacity=10G,format_type=qcow2" --operatingsystem-id "2" --pxe-loader 'PXELinux BIOS' --provision-method build
Host created

After creating the HOST, checked whether the content-source was set from the UI and it was indeed set. Will upload a screenshot shortly.

-------------------------------

# hammer -u admin -p changeme hostgroup info --id 2
Id:                     2
Name:                   RHEL 7 Server 64-bit HG
Title:                  RHEL 7 Server 64-bit HG
Operating System:       RedHat 7.3
Environment:            production
Subnet:                 katello_latest
Domain:                 sat6-domainname.redhat.com
Architecture:           x86_64
Partition Table:        Kickstart default
Puppet CA Proxy Id:     1
Puppet Master Proxy Id: 1
Puppetclasses:          
    access_insights_client
    foreman_scap_client
Parameters:             

Locations:              
    Default Location
Organizations:          
    Default Organization
Parent Id:              
Content View:           RHEL 7 CV
Lifecycle Environment:  DEV
Content Source:         sat6-hostname.redhat.com
Comment 20 Kedar Bidarkar 2017-08-18 11:02:54 EDT
currently there is no "content source" information available from "host info --id <id>"
Comment 28 Ashish Humbe 2017-10-31 02:00:58 EDT
As per discussion with Partha on this issue.

On Satellite v 6.2.12 using below API command, we can set the content source ID successfully 

# curl -H "Content-Type:application/json" -X PUT -u 'username:password' -k -d '{"host":{"content_source_id": "2"}}'  https://satellite.example.com/api/v2/hosts/123

Replace below values appropriately: 

123 : with the host ID for which content source ID needs to be updated.
satellite.example.com : with FADN of the satellite server
username:password   : with appropriate admin user credentials 
"2" (content_source_id) : with appropriate capsule server ID 

To get the host ID and content source ID one can use below commands 

# hammer host list      << To get host ID

# hammer capsule list   << To get content source ID

This can be used as a workaround for now.

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