Project

General

Profile

Bug #3948

Cant update user data

Added by Martin Bacovsky over 5 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
High
Category:
Hammer core
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

The report is copied from mailing list. The issue affect all users not just the admin.

I just installed the latest version of foreman 1.3.2 + hammer, but I can not change the admin defaults.
See the examples below:

foreman /etc/foreman # hammer --verbose user list
[ INFO 2013-12-30 10:24:28 Init] Initialization of Hammer CLI (0.0.14) has started...
[ INFO 2013-12-30 10:24:28 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2013-12-30 10:24:29 Modules] Extension module hammer_cli_foreman (0.0.15) loaded
[ INFO 2013-12-30 10:24:29 HammerCLI::MainCommand] Called with options: {"verbose"=>true}
[ INFO 2013-12-30 10:24:29 HammerCLIForeman::User] Called with options: {}
[ INFO 2013-12-30 10:24:29 HammerCLIForeman::User::ListCommand] Called with options: {}
[DEBUG 2013-12-30 10:24:29 HammerCLIForeman::User::ListCommand] Retrieved data:
[
[0] {
"admin" => true,
"login" => "admin",
"full_name" => "Admin User",
"updated_at" => "2013-12-30T09:24:29Z",
"compute_resources_andor" => "or",
"filter_on_owner" => nil,
"lastname" => "User",
"hostgroups_andor" => "or",
"domains_andor" => "or",
"last_login_on" => "2013-12-30T09:24:29Z",
"role_id" => nil,
"firstname" => "Admin",
"created_at" => "2013-12-30T08:37:59Z",
"auth_source_id" => 1,
"id" => 1,
"facts_andor" => "or",
"mail" => ""
}
]
----------------------------------------------
ID | LOGIN | NAME | EMAIL
----------------------------------------------
1 | admin | Admin User |
----------------------------------------------

foreman /etc/foreman # hammer --verbose user update --id 1 --lastname Test123
[ INFO 2013-12-30 10:23:52 Init] Initialization of Hammer CLI (0.0.14) has started...
[ INFO 2013-12-30 10:23:52 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2013-12-30 10:23:53 Modules] Extension module hammer_cli_foreman (0.0.15) loaded
[ INFO 2013-12-30 10:23:53 HammerCLI::MainCommand] Called with options: {"verbose"=>true}
[ INFO 2013-12-30 10:23:53 HammerCLIForeman::User] Called with options: {}
[ INFO 2013-12-30 10:23:53 HammerCLIForeman::User::UpdateCommand] Called with options: {"id"=>"1", "lastname"=>"Test123"}
[ERROR 2013-12-30 10:23:53 Exception] Invalid username or password
Could not update the user:
Invalid username or password
[ERROR 2013-12-30 10:23:53 Exception]

RestClient::Request::Unauthorized (401 Unauthorized):
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:72:in `put'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:78:in `send'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:78:in `http_call'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:61:in `perform_call'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/resources/user.rb:60:in `update'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/resource.rb:38:in `send'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/resource.rb:38:in `call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/commands.rb:34:in `send_request'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/write_command.rb:10:in `execute'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:125:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61
/usr/bin/hammer:19:in `load'
/usr/bin/hammer:19

---> So far it looks like username/password issue, but for example "adding the group" is working fine:

foreman /etc/foreman # hammer --verbose hostgroup create --name test12345
[ INFO 2013-12-30 10:32:59 Init] Initialization of Hammer CLI (0.0.14) has started...
[ INFO 2013-12-30 10:32:59 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2013-12-30 10:32:59 Modules] Extension module hammer_cli_foreman (0.0.15) loaded
[ INFO 2013-12-30 10:32:59 HammerCLI::MainCommand] Called with options: {"verbose"=>true}
[ INFO 2013-12-30 10:32:59 HammerCLIForeman::Hostgroup] Called with options: {}
[ INFO 2013-12-30 10:32:59 HammerCLIForeman::Hostgroup::CreateCommand] Called with options: {"name"=>"test12345"}
Hostgroup created

I also tried to specify the username + password - but it's the same:

foreman /etc/foreman # hammer --verbose --username admin --password changeme user update --id 1 --lastname Test123
[ INFO 2013-12-30 10:33:49 Init] Initialization of Hammer CLI (0.0.14) has started...
[ INFO 2013-12-30 10:33:49 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2013-12-30 10:33:50 Modules] Extension module hammer_cli_foreman (0.0.15) loaded
[ INFO 2013-12-30 10:33:50 HammerCLI::MainCommand] Called with options: {"username"=>"admin", "verbose"=>true, "password"=>"***"}
[ INFO 2013-12-30 10:33:50 HammerCLIForeman::User] Called with options: {}
[ INFO 2013-12-30 10:33:50 HammerCLIForeman::User::UpdateCommand] Called with options: {"lastname"=>"Test123", "id"=>"1"}
[ERROR 2013-12-30 10:33:50 Exception] Invalid username or password
Could not update the user:
Invalid username or password
[ERROR 2013-12-30 10:33:50 Exception]

RestClient::Request::Unauthorized (401 Unauthorized):
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:72:in `put'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:78:in `send'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:78:in `http_call'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:61:in `perform_call'
/usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/resources/user.rb:60:in `update'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/resource.rb:38:in `send'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/resource.rb:38:in `call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/commands.rb:34:in `send_request'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/write_command.rb:10:in `execute'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:125:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61
/usr/bin/hammer:19:in `load'
/usr/bin/hammer:19

When I'm trying to modify something else specifying the username/password on command line it's working as well:

foreman ~ # hammer --verbose --username admin --password changeme medium update --name "CentOS mirror" --path 'ftp://ftp.cvut.cz/centos/$major.$minor/os/$arch' --os-family Redhat
[ INFO 2013-12-30 10:42:39 Init] Initialization of Hammer CLI (0.0.14) has started...
[ INFO 2013-12-30 10:42:39 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2013-12-30 10:42:40 Modules] Extension module hammer_cli_foreman (0.0.15) loaded
[ INFO 2013-12-30 10:42:40 HammerCLI::MainCommand] Called with options: {"verbose"=>true, "username"=>"admin", "password"=>"***"}
[ INFO 2013-12-30 10:42:40 HammerCLIForeman::Medium] Called with options: {}
[ INFO 2013-12-30 10:42:40 HammerCLIForeman::Medium::UpdateCommand] Called with options: {"current_name"=>"CentOS mirror", "os_family"=>"Redhat", "path"=>"ftp://ftp.cvut.cz/centos/$major.$minor/os/$arch"}
Installation medium updated

Actually it looks like the hammer doesn't care much about "wrong" username/password command line parameters:

foreman ~ # hammer --verbose --username adminxxxx --password changemexxxxx medium update --name "CentOS mirror" --path 'ftp://ftp.cvut.cz/centos/$major.$minor/os/$arch' --os-family Redhat
[ INFO 2013-12-30 10:44:08 Init] Initialization of Hammer CLI (0.0.14) has started...
[ INFO 2013-12-30 10:44:08 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2013-12-30 10:44:08 Modules] Extension module hammer_cli_foreman (0.0.15) loaded
[ INFO 2013-12-30 10:44:08 HammerCLI::MainCommand] Called with options: {"password"=>"***", "verbose"=>true, "username"=>"adminxxxx"}
[ INFO 2013-12-30 10:44:08 HammerCLIForeman::Medium] Called with options: {}
[ INFO 2013-12-30 10:44:08 HammerCLIForeman::Medium::UpdateCommand] Called with options: {"path"=>"ftp://ftp.cvut.cz/centos/$major.$minor/os/$arch", "current_name"=>"CentOS mirror", "os_family"=>"Redhat"}
Installation medium updated

-> Anyway - it's strange why it's not possible to change the admin user details using hammer...

This was working fine in previous foreman release "1.3.1" + hammer (cli_foreman-0.0.10-1.el6.noarch rubygem-hammer_cli-0.0.9-1.el6.noarch)
Everything is working fine when I'm using the web browser with login credentials admin/changeme

  • Version details:
foreman /etc/foreman # cat /etc/foreman/cli_config.yml
:modules:
- hammer_cli_foreman
  1. - hammer_cli_katello_bridge

:foreman:
:host: 'https://localhost/'
:username: 'admin'
:password: 'changeme'

:log_dir: '~/.foreman/log'
#:log_level: 'error'
:log_level: 'debug'
:log_api_calls: false

foreman /etc/foreman # rpm -qa | egrep 'foreman|hammer'
foreman-mysql-1.3.2-1.el6.noarch
rubygem-foreman_api-0.1.9-1.el6.noarch
foreman-1.3.2-1.el6.noarch
foreman-ovirt-1.3.2-1.el6.noarch
foreman-installer-1.3.1-1.el6.noarch
foreman-proxy-1.3.0-1.el6.noarch
foreman-selinux-1.3.0-1.el6.noarch
foreman-release-1.3.2-1.el6.noarch
rubygem-hammer_cli-0.0.14-1.el6.noarch
foreman-compute-1.3.2-1.el6.noarch
rubygem-hammer_cli_foreman-0.0.15-1.el6.noarch
foreman-mysql2-1.3.2-1.el6.noarch

foreman /etc/foreman # hammer --version
hammer (0.0.14) * hammer_cli_foreman (0.0.15)


Related issues

Has duplicate Hammer CLI - Bug #4156: Creating new users fail with a 401Duplicate2014-01-21

Associated revisions

Revision 8f37ae01 (diff)
Added by Martin Bacovsky over 5 years ago

Fixed #3948 - can't update user data

Revision aa79cd20
Added by mbacovsky over 5 years ago

Merge pull request #66 from mbacovsky/3948_update_user

Fixed #3948 - can't update user data

History

#1 Updated by Dominic Cleal over 5 years ago

  • Status changed from New to Assigned
  • Target version set to 1.9.2

#2 Updated by Martin Bacovsky over 5 years ago

  • Category changed from Foreman commands (obsolete) to Hammer core
  • Status changed from Assigned to Ready For Testing
  • Assignee set to Martin Bacovsky
  • Legacy Backlogs Release (now unused) set to 2

#3 Updated by Martin Bacovsky over 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Applied in changeset foreman:hammer-cli|commit:8f37ae012c04809d1bb9d31c1bf365c176737047.

#4 Updated by Dominic Cleal over 5 years ago

  • Has duplicate Bug #4156: Creating new users fail with a 401 added

Also available in: Atom PDF