Bug 1539076

Summary: [RFE] as a user of the bootstrap script, I'd like to specify a location even if I am using the --skip foreman option.
Product: Red Hat Satellite Reporter: Rich Jerrido <rjerrido>
Component: BootstrapAssignee: Rich Jerrido <rjerrido>
Status: CLOSED ERRATA QA Contact: Radovan Drazny <rdrazny>
Severity: low Docs Contact:
Priority: low    
Version: 6.3.0CC: aupadhye, egolov, rdrazny
Target Milestone: 6.4.0Keywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-client-bootstrap-1.6.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 15:30:08 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: 1420851    

Description Rich Jerrido 2018-01-26 15:16:55 UTC
Description of problem:

As a user, when registering a host, I am using --skip foreman to register hosts without username/password as I am registering them for content only. I'd like the ability to set the host's location without needing a username / password


Version-Release number of selected component (if applicable):
katello-client-bootstrap. 

How reproducible:
100%

Comment 2 Rich Jerrido 2018-02-26 19:30:15 UTC
*** Bug 1268429 has been marked as a duplicate of this bug. ***

Comment 3 Rich Jerrido 2018-04-05 13:36:28 UTC
Switching to POST as this commit - https://github.com/Katello/katello-client-bootstrap/commit/c1d5d606cc55d41b930b6f786287ba70a9e1768c is merged upstream.

Comment 5 Rich Jerrido 2018-08-09 23:21:30 UTC
Verification steps:

On a Satellite which has greater than 1 location, run a command similar to the following on the client to register it when using the --skip-foreman option also passing -L to specify a location. 

Option 1: using the --skip foreman option.

# ./bootstrap.py -s foreman.example.com \
    -a ak_Reg_To_Dev_EL7 \
    -o "Red_Hat" \
    --skip foreman \
    -L 'My_Location'

Option 2 : using the --content-only option. This option exists as an alias to --skip foreman.

# ./bootstrap.py -s foreman.example.com \
    -a ak_Reg_To_Dev_EL7 \
    -o "Red_Hat" \
    --content-only \
    -L 'My_Location' 


Ensure that the client is registered in the correct organization & location.

Comment 7 Radovan Drazny 2018-09-11 12:05:05 UTC
Verified on Sat 6.4 Snap 21

hammer> organization list
---|----------------------|----------------------|-------------|----------------------|------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL                | DESCRIPTION
---|----------------------|----------------------|-------------|----------------------|------------
1  | Default Organization | Default Organization |             | Default_Organization |            
5  | Shadow Organization  | Shadow Organization  |             | Shadow_Org           |            
---|----------------------|----------------------|-------------|----------------------|------------
hammer> location list
---|----------------------------------|-----------------------|------------
ID | TITLE                            | NAME                  | DESCRIPTION
---|----------------------------------|-----------------------|------------
2  | Default Location                 | Default Location      |            
4  | SelfSupportedLocation            | SelfSupportedLocation |            
---|----------------------------------|-----------------------|------------



Client 1: 

$ hostname
client1.example.com

$ ./bootstrap.py --force -s satellite.example.com -a TestAK1 -o "Shadow_Org" --skip foreman -L "SelfSupportedLocation"                                                                              
Foreman Bootstrap Script
<...>
[SUCCESS], [2018-09-11 06:28:52], [/usr/sbin/subscription-manager register --org 'Shadow_Org' --name 'client1.example.com' --activationkey 'TestAK1'  --serverurl=https://dell-pem630-01.rhts.eng.bos.redhat.c
om:443/rhsm --baseurl=https://satellite.example.com/pulp/repos --force], completed successfully.
<...>


Client 2:

$ hostname
client2.example.com

$./bootstrap.py --force -s satellite.example.com -a TestAK1 -o "Shadow_Org" --content-only -L "SelfSupportedLocation"
<...>
[SUCCESS], [2018-09-11 07:59:53], [/usr/sbin/subscription-manager register --org 'Shadow_Org' --name 'client2.example.com' --activationkey 'TestAK1'  --serverurl=https://satellite.example.com:443/rhsm --baseurl=https://satellite.example.com/pulp/repos --force], completed successfully.
<...>

Result:
hammer> host list --location-id 4
---|---------------------------------------------------|------------------|------------|--------------|-------------------|--------------|----------------------
ID | NAME                                              | OPERATING SYSTEM | HOST GROUP | IP           | MAC               | CONTENT VIEW | LIFECYCLE ENVIRONMENT
---|---------------------------------------------------|------------------|------------|--------------|-------------------|--------------|----------------------
2  | client1.example.com                               | RedHat 7.4       |            | 172.16.20.40 | fa:16:3e:16:b5:ac | CentosCV     | ShadowEnv            
3  | client2.example.com                               | RHEL Server 7.5  |            | 10.12.0.22   | 00:1a:64:33:d5:08 | CentosCV     | ShadowEnv            
---|---------------------------------------------------|------------------|------------|--------------|-------------------|--------------|----------------------
hammer> host list --organization-id 5
---|---------------------------------------------------|------------------|------------|--------------|-------------------|--------------|----------------------
ID | NAME                                              | OPERATING SYSTEM | HOST GROUP | IP           | MAC               | CONTENT VIEW | LIFECYCLE ENVIRONMENT
---|---------------------------------------------------|------------------|------------|--------------|-------------------|--------------|----------------------
2  | client1.example.com                               | RedHat 7.4       |            | 172.16.20.40 | fa:16:3e:16:b5:ac | CentosCV     | ShadowEnv            
3  | client2.example.com                               | RHEL Server 7.5  |            | 10.12.0.22   | 00:1a:64:33:d5:08 | CentosCV     | ShadowEnv            
---|---------------------------------------------------|------------------|------------|--------------|-------------------|--------------|----------------------

Comment 9 errata-xmlrpc 2018-10-16 15:30:08 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:2927