Bug 1517729

Summary: Ensure Satellite isn't installed before starting clone process
Product: Red Hat Satellite Reporter: Tomer Brisker <tbrisker>
Component: Satellite CloneAssignee: John Mitsch <jomitsch>
Status: CLOSED ERRATA QA Contact: sthirugn <sthirugn>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: aperotti, bbuckingham, ktordeur, sthirugn
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-19 17:23:12 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: 1353215, 1533259    

Description Tomer Brisker 2017-11-27 10:29:43 UTC
If satellite-clone is run on a system that already has satellite installed, it could lead to unexpected results. 
Additionally, since satellite-clone is designed to be run on a clean RHEL host, having an existing satellite installed may indicate the user is accidentally attempting to run clone on a production system, which could lead to service disruption.

Before starting the clone process, satellite-clone should verify there is no Satellite package installed on the server.

Comment 3 John Mitsch 2017-11-30 18:21:17 UTC
This was merged upstream https://github.com/RedHatSatellite/satellite-clone/pull/278

Comment 4 John Mitsch 2017-12-18 14:44:25 UTC
This didn't make it into 1.2.0, but will be in 1.2.1+

Comment 6 sthirugn@redhat.com 2018-02-01 19:43:04 UTC
Failed in satellite-clone-1.2.1-1.el7sat.noarch

Test steps:
1. Run satellite-clone. Completed successfully.
2. Run satellite-clone again. This proceeded without satellite check. I was expecting to see an error that satellite is already installed.

output:
<snip>
TASK [satellite-clone : Check if satellite is already installed] *****************
Thursday 01 February 2018  14:33:49 -0500 (0:00:00.039)       0:00:00.150 ***** 
skipping: [localhost]

TASK [satellite-clone : Fail if satellite is already installed] ******************
Thursday 01 February 2018  14:33:50 -0500 (0:00:00.038)       0:00:00.189 ***** 
skipping: [localhost]

TASK [satellite-clone : set fact - satellite_installed] **************************
Thursday 01 February 2018  14:33:50 -0500 (0:00:00.034)       0:00:00.224 ***** 
ok: [localhost]
</snip>

vars file:
# cat /etc/satellite-clone/satellite-clone-vars.yml | grep skip_satellite_rpm_check
#skip_satellite_rpm_check: false

Comment 7 John Mitsch 2018-02-01 21:08:08 UTC
We discussed this off thread, the check is only meant to be run on the first run of the clone tool. The reason for this is if you can sat-clone, it installs the rpm, but satellite-installer fails. Then you go to re-run and you hit the satellite rpm check and the playbook errors out with "satellite rpm already installed". This is why the check will be skipped on subsequent runs after the first one.

Comment 8 sthirugn@redhat.com 2018-02-01 21:16:24 UTC
As John mentioned this check is a precautionary measure so the users doesn't install and run satellite-clone on a box which already has satellite.

Test steps:
1. Run satellite-clone. Completed successfully.
2. Run satellite-clone again. This proceeded without satellite check as expected.  To enforce the check I cleared ansible cache.
   - satellite-clone --flush-cache
3. Now I received an error as expected.

TASK [satellite-clone : Check if satellite is already installed] *****************
Thursday 01 February 2018  15:58:17 -0500 (0:00:00.035)       0:00:04.761 ***** 
changed: [localhost]

cmd: rpm -q satellite

start: 2018-02-01 15:58:18.094218

end: 2018-02-01 15:58:18.135561

delta: 0:00:00.041343

stdout: satellite-6.2.13-4.0.el7sat.noarch

TASK [satellite-clone : Fail if satellite is already installed] ******************
Thursday 01 February 2018  15:58:18 -0500 (0:00:00.271)       0:00:05.032 ***** 
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Satellite is already installed. Satellite-clone should be run on a clean RHEL7 machine. If you would like to force a skip of this check, please set skip_satellite_rpm_check to true in satellite-clone-vars.yml"}.

Comment 11 errata-xmlrpc 2018-02-19 17:23:12 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-2018:0330