Bug 1154373 - [RFE] Request for Satellite 6 equivalent of bootstrap.sh from Satellite 5
Summary: [RFE] Request for Satellite 6 equivalent of bootstrap.sh from Satellite 5
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: katello-agent
Version: 6.0.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Mike McCune
QA Contact: Lukas Pramuk
URL:
Whiteboard:
: 1178194 1220631 1250903 (view as bug list)
Depends On:
Blocks: 1285918
TreeView+ depends on / blocked
 
Reported: 2014-10-19 11:14 UTC by Rich Jerrido
Modified: 2021-08-30 13:19 UTC (History)
29 users (show)

Fixed In Version: katello-installer-base-3.0.0.18-1,katello-client-bootstrap-1.0.0-1
Doc Type: Enhancement
Doc Text:
A bootstrap script has been included with Red Hat Satellite 6.2. This script takes a machine that has been provisioned outside of Red Hat Satellite 6.2 and registers the host, installs the appropriate certificates, and configures puppet. If the host was previously registered with Red Ht Satellite 5, the script selects the correct subscriptions based on the channels that are assigned to the host.
Clone Of:
Environment:
Last Closed: 2016-07-27 11:05:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14320 0 Normal Closed Add client bootstrap script 2020-11-04 12:50:51 UTC
Foreman Issue Tracker 14534 0 Normal Closed Install client-bootstrap package on both Katello and Capsule servers 2020-11-04 12:50:51 UTC
Red Hat Issue Tracker SAT-4777 0 None None None 2021-08-30 13:04:25 UTC
Red Hat Knowledge Base (Solution) 1345773 0 None None None Never

Description Rich Jerrido 2014-10-19 11:14:09 UTC
Description of problem:
This RFE requests the creation of a script to assist a user of another Red Hat Systems Management Platform (Satellite 5.x, RHN Classic, RHSM, SAM) to easily migrate a system from that platform to Satellite 6.x. Currently, there are a number of very manual steps that a user must take to get a system deregistered from their existing platform and properly registered against Satellite 6. 

Satellite 5.x provided this capability as a base script that took a number of user provided variables, such as hostname (of the satellite), activation keys, etc. and make it quite trivial to get an existing (not provisioned via Satellite system) into Satellite.

Comment 2 RHEL Program Management 2014-10-19 11:22:53 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 4 Tomas Lestach 2014-10-20 09:26:08 UTC
Handling migrations from RHN Classic, RHSM and SAM to Sat6 isn't within the scope of the Transition project.
If we talk about a Sat5's equivalent of the bootstrap script, I think it's a regular Sat6 RFE.

Comment 8 Clifford Perry 2014-11-05 19:32:18 UTC
This isn't a Transition Tooling need. This is a general Sat6 product need for anyone who has existing RHEL systems that were registered to Sat 6 and were not provisioned via Sat6. 

Changing from Transitions to Registration. 

Cliff

Comment 10 Bryan Kearney 2015-01-05 15:23:50 UTC
*** Bug 1178194 has been marked as a duplicate of this bug. ***

Comment 13 Bryan Kearney 2015-05-28 15:21:33 UTC
*** Bug 1220631 has been marked as a duplicate of this bug. ***

Comment 16 Xixi 2015-08-23 23:21:39 UTC
*** Bug 1250903 has been marked as a duplicate of this bug. ***

Comment 35 Lukas Pramuk 2016-04-21 14:40:39 UTC
FailedQA.

@Sat6.2.0-Beta-Snap9
katello-client-bootstrap-1.0.0-1.el7sat.noarch

Found issues:

1)
It says: "Must specify server, login, hostgroup, location, and organization options".
But it apparently requires also activation-key, I'd like it to be listed too.

# ./bootstrap.py -l admin -p <PASSWORD> -s <SAT_FQDN> -o Defult_Organization -L Default_Location -g My_Hostgroup
Must specify server, login, hostgroup, location, and organization options. See usage:
...

>>> I'd like activation-key option to be listed too.

2)
If it cannot find an entity (e.g. hostgroup, location) it just tracebacks
# ./bootstrap.py -l admin -p <PASSWORD> -s <SAT_FQDN> -o Defult_Organization -L Default_Location -g Mistyped_Hostgroup -a My_Activation_Key
...
Traceback (most recent call last):
  File "./bootstrap.py", line 432, in <module>
    create_host()
  File "./bootstrap.py", line 358, in create_host
    myhgid = return_matching_id('hostgroups', 'title=%s' % options.hostgroup, False)
  File "./bootstrap.py", line 317, in return_matching_id
    print_error("%d element in array for search key %s in API %s. Fatal error." % result_len, search_key, api_name)
TypeError: not enough arguments for format string

>>> I'd like to see an error "No such hostgroup", "No such location" etc... instead of just traceback.

Comment 36 Lukas Pramuk 2016-04-21 14:57:20 UTC
3) Some entities no longer have labels (locations, hostgroups)
  -g HOSTGROUP, --hostgroup=HOSTGROUP
                        *Label* of the Hostgroup in Foreman that the host is to

>>>  not true, it's a Name (or Title) of that entity

Comment 37 Lukas Pramuk 2016-04-21 15:05:52 UTC
Most important issue:

4) It cannot handle entities having space in name, like Default Organization, Default Location 

Traceback (most recent call last):
  File "./bootstrap.py", line 432, in <module>
    create_host()
  File "./bootstrap.py", line 360, in create_host
    myorgid = return_matching_id('organizations', 'name=%s' % options.org, False)
  File "./bootstrap.py", line 317, in return_matching_id
    print_error("%d element in array for search key %s in API %s. Fatal error." % result_len, search_key, api_name)
TypeError: not enough arguments for format string

Traceback (most recent call last):
  File "./bootstrap.py", line 432, in <module>
    create_host()
  File "./bootstrap.py", line 359, in create_host
    mylocid = return_matching_id('locations', 'title=%s' % options.location, False)
  File "./bootstrap.py", line 317, in return_matching_id
    print_error("%d element in array for search key %s in API %s. Fatal error." % result_len, search_key, api_name)

Comment 38 Evgeni Golov 2016-04-21 15:24:07 UTC
(In reply to Lukas Pramuk from comment #35)

> 2)
> If it cannot find an entity (e.g. hostgroup, location) it just tracebacks
> # ./bootstrap.py -l admin -p <PASSWORD> -s <SAT_FQDN> -o Defult_Organization
> -L Default_Location -g Mistyped_Hostgroup -a My_Activation_Key
> ...
> Traceback (most recent call last):
>   File "./bootstrap.py", line 432, in <module>
>     create_host()
>   File "./bootstrap.py", line 358, in create_host
>     myhgid = return_matching_id('hostgroups', 'title=%s' %
> options.hostgroup, False)
>   File "./bootstrap.py", line 317, in return_matching_id
>     print_error("%d element in array for search key %s in API %s. Fatal
> error." % result_len, search_key, api_name)
> TypeError: not enough arguments for format string
> 
> >>> I'd like to see an error "No such hostgroup", "No such location" etc... instead of just traceback.

https://github.com/Katello/katello-client-bootstrap/issues/57
https://github.com/Katello/katello-client-bootstrap/pull/59

:)

Comment 39 Evgeni Golov 2016-04-21 15:39:42 UTC
(In reply to Lukas Pramuk from comment #37)
> Most important issue:
> 
> 4) It cannot handle entities having space in name, like Default
> Organization, Default Location 
> 

https://github.com/Katello/katello-client-bootstrap/issues/54
https://github.com/Katello/katello-client-bootstrap/pull/60

Comment 41 Bryan Kearney 2016-04-27 19:07:31 UTC
Upstream bug assigned to mmccune

Comment 42 Bryan Kearney 2016-04-27 19:07:38 UTC
Upstream bug component is Client & Agent

Comment 46 Evgeni Golov 2016-05-06 13:07:18 UTC
The version shipped in Beta does not call "subscription-manager repos --enable=rhel-*-satellite-tools-*-rpms", thus failing to install katello-agent afterwards.

Comment 54 Bryan Kearney 2016-05-31 00:28:53 UTC
The latest fixes should be in. Please close out this bug as "The script has been delivered" and open any subsequent issues under new bugs.

Comment 55 Mike McCune 2016-05-31 21:45:37 UTC
1.1.0 release

https://github.com/Katello/katello-packaging/pull/231

Comment 59 Lukas Pramuk 2016-06-07 11:48:31 UTC
VERIFIED.

@satellite-6.2.0-14.2.el7sat.noarch

Bootstrap Script is installed with latest snap:

# rpm -qf /var/www/html/pub/bootstrap.py 
katello-client-bootstrap-1.1.0-1.el7sat.noarch


Issues to consider:

1) Script assumes that client is in the same domain as Satellite is.
If it is not the case, then you have to pre-create client's domain in Satellite.

 ./bootstrap.py -l admin -p changeme -s <SAT_FQDN> -o 'Default Organization' -L 'Default Location' -g 'My Hostgroup' -a My_Activation_Key
Foreman Bootstrap Script
This script is designed to register new systems or to migrate an existing system to a Foreman server with Katello
[NOTIFICATION], [2016-06-06 08:47:27], [This system is not registered to RHN. Attempting to register via subscription-manager] 
[NOTIFICATION], [2016-06-06 08:47:27], [Retrieving Client CA Certificate RPMs] 
[RUNNING], [2016-06-06 08:47:27], [rpm -Uvh http://<SAT_FQDN>/pub/katello-ca-consumer-latest.noarch.rpm] 
Retrieving http://<SAT_FQDN>/pub/katello-ca-consumer-latest.noarch.rpm
Preparing...                ##################################################
katello-ca-consumer-<SAT_FQD##################################################
[SUCCESS], [2016-06-06 08:47:32], [rpm -Uvh http://<SAT_FQDN>/pub/katello-ca-consumer-latest.noarch.rpm], completed successfully.

[ERROR], [2016-06-06 08:47:33], EXITING: [0 element in array for search key 'name="<CLIENT_DOMAIN>"' in API '/api/v2/domains'. Please note that all searches are case-sensitive. Fatal error.] failed to execute properly.


2) Either "rpm -Uvh" or "subscription-manager register" should use force, not inner one, but an option "--force"

[ERROR], [2016-06-06 08:49:13], EXITING: [rpm -Uvh http://<SAT_FQDN>/pub/katello-ca-consumer-latest.noarch.rpm] failed to execute properly.
Retrieving http://<SAT_FQDN>/pub/katello-ca-consumer-latest.noarch.rpm
Preparing...                ##################################################
	package katello-ca-consumer-<SAT_FQDN>-1.0-1.noarch is already installed

[ERROR], [2016-06-07 06:28:08], EXITING: [/usr/sbin/subscription-manager register --org 'Default_Organization' --name '<CLIENT_FQDN>' --activationkey 'My Activation Key'  --serverurl=https://<SAT_FQDN>:443/rhsm --baseurl=https://<SAT_FQDN>/pulp/repos] failed to execute properly.
This system is already registered. Use --force to override


3) Quite often you end up with Error 422 (Un-processable entity) related to a Hostgroup used.
The Hostgroup needs to be setup properly, otherwise you get various errors:

"Ip can't be blank" => missing subnet configuration
"Environment can't be blank" => missing Puppet Environment configuration
"Subnet is not defined for host's location." (luckily this one is more self-explanatory)

Comment 60 Lukas Pramuk 2016-06-07 12:46:30 UTC
BZ 1343546 - Bootstrap script should run commands with --force

Comment 61 Lukas Pramuk 2016-06-07 13:57:49 UTC
BZ 1343585 - Bootstrap script assumes that host is in the same domain as Satellite is

Comment 62 Bryan Kearney 2016-07-27 11:05:45 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


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