Bug #22250

After upgrading hammer credentials are not migrated to new location - Invalid username or password

Added by Martin Bacovsky 13 days ago. Updated 13 days ago.

Status:New
Priority:High
Assigned To:Martin Bacovsky
Category:-
Target version:-
Difficulty: Bugzilla link:1526828
Found in release:1.16.0 Pull request:
Story points-
Velocity based estimate-

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1526828

Description of problem:

Upgrading 6.2 -> 6.3 public beta does not migrate hammer login credentials from ~/.hammer/cli_config.yml (6.1, 6.2) to ~/.hammer/cli.modules.d/foreman.yml (new location in 6.3) which leads to error

  1. hammer organization list
    Invalid username or password

~/.hammer/cli.modules.d/foreman.yml contained some random string as a password

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

satellite 6.2.12 upgraded to 6.3 public beta

[root@provisioning ~]# rpm -qa | egrep "satellite|hammer"
satellite-cli-6.3.0-21.0.beta.el7sat.noarch
satellite-common-6.3.0-21.0.beta.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_admin-0.0.7-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_remote_execution-0.0.6-1.fm1_15.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.11.0.3-1.el7sat.noarch
tfm-rubygem-foreman_theme_satellite-1.0.4.11-1.el7sat.noarch
tfm-rubygem-hammer_cli_csv-2.3.0-1.el7sat.noarch
satellite-6.3.0-21.0.beta.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.6-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_discovery-1.0.0-1.el7sat.noarch
satellite-installer-6.3.0.9-1.beta.el7sat.noarch
tfm-rubygem-hammer_cli-0.11.0.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_openscap-0.1.5-1.fm1_15.el7sat.noarch
tfm-rubygem-hammer_cli_katello-0.11.3.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.12-1.fm1_15.el7sat.noarch
satellite-capsule-6.3.0-21.0.beta.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_virt_who_configure-0.0.3-1.el7sat.noarch

How reproducible:

Steps to Reproduce:
1. Upgrade to 6.3 with stored hammer credentials
2. Run hammer command

Actual results:

  1. hammer organization list
    Invalid username or password

After satellite upgrade

History

#1 Updated by Martin Bacovsky 13 days ago

  • Found in release set to 1.16.0
  • Description updated (diff)
  • Subject changed from After upgrading to 6.3 hammer credentials are not migrated to new location - Invalid username or password to After upgrading hammer credentials are not migrated to new location - Invalid username or password

#2 Updated by Martin Bacovsky 13 days ago

The hammer configs are now installed by foreman-installer https://github.com/theforeman/puppet-foreman/blob/master/manifests/cli.pp. It uses value of admin_password from answer file. This value may become outdated when admin password is changed in the UI later.

In previous versions users had hammer credentials configured on various locations:
- /etc/hammer/cli_conig.yml
- /etc/hammer/cli.modules.d/foreman.yml
- /root/.hammer/cli_conig.yml
- /root/.hammer/cli.modules.d/foreman.yml

When upgrading and the password was changed in UI and the /root/.hammer/cli.modules.d/foreman.yml does not exist installer creates the config with the outdated value in password.

#3 Updated by Martin Bacovsky 13 days ago

To prevent this make sure the admin_password is set correctly in installer answerfile or run the upgrade with --admin-password <current pwd>.
To fix after the error happened just update /root/.hammer/cli.modules.d/foreman.yml with correct password

Also available in: Atom PDF