Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1584743 - katello-change-hostname does not update db.event_listeners
Summary: katello-change-hostname does not update db.event_listeners
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Documentation
Version: 6.2.14
Hardware: x86_64
OS: Linux
low
low
Target Milestone: Unspecified
Assignee: csherrar
QA Contact: Vlada Grosu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-31 14:23 UTC by Michal Dekan
Modified: 2021-09-09 14:20 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-03 13:56:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Michal Dekan 2018-05-31 14:23:49 UTC
Description of problem:

When changing satellite hostname with katello-change-hostname, it will fail if we set new hostname with hostnamctl set-hostname before calling katello-change hostname:

Updating default Capsule
Error: smart_proxy not found
Couldn't find default Capsule id
Failed 'hammer -u admin -p redhat --output json capsule info --name mdekan-rhel7-sat62' with exit code 70

Its expected to fail, because katello-change-hostname seems to call hostnamectl on its own ...

However tricky part here is that when you change the hostname back to the old hostname with hostnamectl set-hostname, katelllo-change-hostname will succeed but it will not update db.event_listeners with new hostname (old one will remain there)

Version-Release number of selected component (if applicable):

satellite 6.2.14
satellite 6.2.15

How reproducible:

Change satellite hostname with hostnamectl and then run katello-change-hostname:

Updating default Capsule
Error: smart_proxy not found
Couldn't find default Capsule id
Failed 'hammer -u admin -p redhat --output json capsule info --name 'katello.example.com' with exit code 70

Steps to Reproduce:
1. hostnameclt set-hostname katello.example.com
2. katello-change-hostname katello.example.com -u admin -p XXX (will fail with above)

Changing to the old hostname with hostnamectl so katello-change-hostname can pass:

3. hostnamectl set-hostname test2.example.com
4. katello-change-hostname katello.example.com -u admin -p XXX (will pass)

Mongo will contain old hostname:
5. > db.event_listeners.find()
{ "_id" : ObjectId("5b0ff0b0226fa42c34df85b1"), "notifier_config" : { "url" : "https://test2.example.com/katello/api/v2/repositories/sync_complete?token=....

Actual results:

event_listeners collection in mongo contains old hostname when hostnamectl is used before katello-hostname-change to change the satellite hostname

Expected results:

event_listeners should contain correct hostname

Additional info:

Comment 1 John Mitsch 2018-05-31 14:35:16 UTC
You shouldn't change your hostname (via hostnamectl or other means) before running katello-change-hostname since the script relies on grabbing the old hostname for search/replace and other operations. If this isn't clear in the documentation, please file a docs bug.

Does event_listeners not get updated if you use katello-change-hostname without changing things via hostnamectl first? I'm curious if the bug can be reproduced when using k-c-h as intended.

Comment 2 Michal Dekan 2018-05-31 15:15:14 UTC
When the hostname is changed with hostnamectl before running katello-change hostname it fails.

If hostname was never changed and only katello-change-hostname was used to change the hosntame, its working fine, event_listeners gets updated with a new hostname.

My intention here was to handle the described scenario on the code level, since customers are sometimes changing hostname with hostnamectl first and then continue with katello-change-hostname, which fails.

Comment 7 Andrew Dahms 2018-07-31 13:34:52 UTC
Assigning to Clifton for review.

Clifton - see the above comments for the request.

Comment 27 Michal Dekan 2018-08-30 09:11:19 UTC
Hello,

reopening this BZ as katello-change-hostname (satellite 6.2 tool) is mentioned in doc for satellite 6.3. Can be a bit confusing.

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.3/html/administering_red_hat_satellite/chap-red_hat_satellite-administering_red_hat_satellite-backup_and_disaster_recovery#sect-Red_Hat_Satellite-Administering_Red_Hat_Satellite-Renaming_a_Server

========
Warning

Do not change the system host name of your Satellite Server before running the **katello-change-hostname** script. If the system host name has been changed before running this script, the script will fail when searching for the old host name. 
========


https://access.redhat.com/documentation/en-us/red_hat_satellite/6.3/html/administering_red_hat_satellite/chap-red_hat_satellite-administering_red_hat_satellite-backup_and_disaster_recovery#sect-Red_Hat_Satellite-Administering_Red_Hat_Satellite-Renaming_a_Satellite_Server 

========
Ensure the system host name has not been changed before running the **katello-change-hostname** script. If the system host name has been changed, you must revert it to the original host name by using the hostnamectl set-hostname command. 
========

Comment 32 Vlada Grosu 2018-09-03 11:39:17 UTC
(In reply to Michal Dekan from comment #27)
> Hello,
> 
> reopening this BZ as katello-change-hostname (satellite 6.2 tool) is
> mentioned in doc for satellite 6.3. Can be a bit confusing.

Hi Michal,

Thank you for reopening this ticket and point out that these changes were only intended for the 6.2 Server Administration Guide. That's now been done.

Kind regards,
Vlada


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