Bug 1401188

Summary: The last step of a bootstrap (bootstrap.py) registration resulting in a 201 error, suspect URLLIB2 module
Product: Red Hat Satellite Reporter: Jason R <jason>
Component: BootstrapAssignee: Rich Jerrido <rjerrido>
Status: CLOSED ERRATA QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.2CC: aupadhye, bbuckingham, dlobatog, egolov, jason, jcallaha, mverma, oshtaier
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: katello-client-bootstrap-1.2.0-4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:51:07 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:

Description Jason R 2016-12-03 12:04:11 UTC
Description of problem:

The last step of a bootstrap registration of an older box (likely unpatched) is resulting in a 201 error... Suggestion is that it has todo with the URLLIB2 module not accepting the response properly.

Version-Release number of selected component (if applicable):
6.2.2 SAT
5.9 Client

How reproducible:

Occurring with all fossilized redhats  5.9 definitely, going to try to "patch one up to current and retry" but this is a production system so it will take me some time. The servers are disconnected from all external networks, so the SAT is the first time they have seen a real live connection in years.

Steps to Reproduce:
1. Need an old machine (mine is redhat 5.9 likely not patched since the cold war)

2. Try to connect it to the new shiny SAT I have
	wget http://rhn-satellite.tools.cihs.gov.on.ca/pub/bootstrap.py
	chmod +x bootstrap.py
	./bootstrap.py -l ADMIN -s SATSERVER -o ORG -L LOC  -g GROUP -a AKEY

3. error occurs on JSON post


Actual results:

Gets a 201 but there is no real error I can find

[RUNNING], [2016-12-03 06:34:37], [Calling Foreman API to create a host entry associated with the group, org & location]
Error: The following error occured while talking to the API:
url: https://rhn-satellite.tools.cihs.gov.on.ca:443/api/v2/hosts/
code: 201
data: {
  "host": {
    "managed": "false",
    "name": "xxxxxx",
    "hostgroup_id": 2,
    "organization_id": 1,
    "mac": "00:50:56:AB:21:C1",


Expected results:

should have been clean.


Additional info:

[I think this guy has what I think it is, and it explains the behavior well]

https://access.redhat.com/discussions/2621401

Rich Jerrido 
The error that you are seeing is a red herring. The issue is that the urllib2 (the python library we use for all the calls to the API) doesn't handle the HTTP 201 that the API returns correctly. That is, your host is created properly, but an exception is raised as if it wasn't. If you could open a BZ for this issue, that would be appreciated.

Comment 1 Jason R 2016-12-04 11:56:05 UTC
I cut a RedHat support case for this (CASE 01751585)

Comment 4 Evgeni Golov 2017-06-01 12:37:42 UTC
This is fixed since katello-client-bootstrap-1.2.0, no need to wait for 6.3.

Comment 5 Daniel Lobato Garcia 2017-09-06 09:45:28 UTC
Verified.

Tested on Satellite 6.3 Snap 13 - although I think this is on 6.2 too.

After registering a new host with
./bootstrap.py -l ADMIN -s SATSERVER -o ORG -L LOC  -g GROUP -a AKEY

no urllib2 error is shown on the screen and the Host is created fine.

Comment 6 Satellite Program 2018-02-21 16:51:07 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