Bug #24422
Updated by John Mitsch over 6 years ago
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1584776 *Description of problem:* This is to avoid bad tool usage as currently its possible to change the hostname with hostnamectl and then execute katello-change-hostname which leads to the error: Error: smart_proxy not found Couldn't find default Capsule id Failed 'hammer -u admin -p changeme --output json capsule info --name old-hostname' with exit code 70 *Version-Release number of selected component (if applicable):* latest dev Satellite 6.2.14 Satellite 6.2.15 *How reproducible:* Change satellite hostname with hostnamectl and then run katello-change-hostname *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:* katello-change-hostname will run when hostname was already changed with hostnamectl which produces error. *Expected results:* Add check to find out if new hostname used with katello-change-hostname is matching with current hostname from hostnamectl. It should not match, if it does it should error out and not proceed further.