Project

General

Profile

Bug #25914

Not able to delete user associated with usergroup

Added by Marek Hulán 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Users
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

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

Description of problem:

Could not delete user if it is added to any usergroup.

Version-Release number of selected component (if applicable):
Satellite 6.5 snap 12

How reproducible: always

Steps to Reproduce:

1. # hammer user create --login test_user --auth-source-id 1 --mail a@a.com --password changeme
User [test_user] created.

2. # hammer user-group create --name test_usergroup --users test_user
User group [test_usergroup] created.

3. # hammer user-group info --name test_usergroup
Id: 4
Name: test_usergroup
Admin: no
Users:
test_user
User groups:

External user groups:

Roles:

Created at: 2019/01/20 05:24:28
Updated at: 2019/01/20 05:24:28

4. # hammer --debug user delete --login test_user
[ INFO 2019-01-20T00:26:09 Init] Initialization of Hammer CLI (0.15.1) has started...
[DEBUG 2019-01-20T00:26:09 Init] Running at ruby 2.5.3-p105
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/csv.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_core.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_katello.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_ansible.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_openscap.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_remote_execution.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_templates.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_virt_who_configure.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[ INFO 2019-01-20T00:26:09 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2019-01-20T00:26:09 SSLoptions] SSL options: {
:ssl_ca_file => "/etc/pki/katello/certs/katello-server-ca.crt",
:verify_ssl => true
}
[DEBUG 2019-01-20T00:26:09 API] Global headers: {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
}
[DEBUG 2019-01-20T00:26:09 API] Follow redirects: never
[DEBUG 2019-01-20T00:26:09 Connection] Registered: foreman
[ INFO 2019-01-20T00:26:09 Modules] Extension module hammer_cli_foreman (0.15.1) loaded.
[ INFO 2019-01-20T00:26:09 Modules] Extension module hammer_cli_foreman_admin (0.0.8) loaded.
[ INFO 2019-01-20T00:26:10 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3.3) loaded.
[ INFO 2019-01-20T00:26:10 Modules] Extension module hammer_cli_foreman_discovery (1.0.0) loaded.
[ INFO 2019-01-20T00:26:10 Modules] Extension module hammer_cli_foreman_openscap (0.1.6) loaded.
[ INFO 2019-01-20T00:26:10 Modules] Extension module hammer_cli_foreman_templates (0.1.2) loaded.
[ INFO 2019-01-20T00:26:10 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2019-01-20T00:26:10 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2019-01-20T00:26:10 Modules] Extension module hammer_cli_katello (0.16.0.4) loaded.
[DEBUG 2019-01-20T00:26:10 Init] Using locale 'en'
[DEBUG 2019-01-20T00:26:10 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/locale'
[DEBUG 2019-01-20T00:26:10 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.15.1/locale'
[DEBUG 2019-01-20T00:26:10 Init] 'mo' files for locale domain 'hammer-cli-csv' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.3.1/locale'
[DEBUG 2019-01-20T00:26:10 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.6/locale'
[DEBUG 2019-01-20T00:26:10 Init] 'mo' files for locale domain 'hammer-cli-foreman-virt-who-configure' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_virt_who_configure-0.0.3/locale'
[DEBUG 2019-01-20T00:26:10 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.16.0.4/locale'
[ INFO 2019-01-20T00:26:10 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ INFO 2019-01-20T00:26:10 HammerCLIForeman::User] Called with options: {}
[ INFO 2019-01-20T00:26:10 API] Server: https://satellite.example.com
[ INFO 2019-01-20T00:26:10 API] GET /api/users
[DEBUG 2019-01-20T00:26:10 API] Params: {
:search => "login = \"test_user\""
}
[DEBUG 2019-01-20T00:26:10 API] Headers: {
:params => {
:search => "login = \"test_user\""
}
}
[DEBUG 2019-01-20T00:26:10 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2019-01-20T00:26:10 API] Response: {
"total" => 4,
"subtotal" => 1,
"page" => 1,
"per_page" => 20,
"search" => "login = \"test_user\"",
"sort" => {
"by" => nil,
"order" => nil
},
"results" => [
[0] {
"firstname" => nil,
"lastname" => nil,
"mail" => "a@a.com",
"admin" => false,
"auth_source_id" => 1,
"auth_source_name" => "Internal",
"timezone" => nil,
"locale" => nil,
"last_login_on" => nil,
"created_at" => "2019-01-20 05:23:19 UTC",
"updated_at" => "2019-01-20 05:23:19 UTC",
"id" => 7,
"login" => "test_user",
"description" => nil,
"ssh_keys" => [],
"default_location" => nil,
"locations" => [],
"default_organization" => nil,
"organizations" => [],
"effective_admin" => false
}
]
}
[DEBUG 2019-01-20T00:26:10 API] Response headers: {
:date => "Sun, 20 Jan 2019 05:26:10 GMT",
:server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
:foreman_version => "1.20.1.7",
:foreman_api_version => "2",
:apipie_checksum => "1ce4980481c260d7668c4e22659d94a5e4998036",
:cache_control => "max-age=0, private, must-revalidate",
:x_request_id => "859951f1-4f04-4a8d-820e-35eebdd36ace",
:x_runtime => "0.049984",
:strict_transport_security => "max-age=631139040; includeSubdomains",
:x_frame_options => "sameorigin",
:x_content_type_options => "nosniff",
:x_xss_protection => "1; mode=block",
:x_download_options => "noopen",
:x_permitted_cross_domain_policies => "none",
:content_security_policy => "default-src 'self'; child-src 'self'; connect-src 'self' ws: wss:; img-src 'self' data: *.gravatar.com; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'",
:x_powered_by => "Phusion Passenger 4.0.18",
:set_cookie => [
[0] "_session_id=0724368cbc8dbce4ac52fb15b27f4d0a; path=/; secure; HttpOnly; SameSite=Lax"
],
:etag => "W/\"d1f8a644b02478df200b0100a3304c57-gzip\"",
:status => "200 OK",
:vary => "Accept-Encoding",
:content_encoding => "gzip",
:content_length => "313",
:content_type => "application/json; charset=utf-8"
}
[ INFO 2019-01-20T00:26:10 HammerCLIForeman::User::DeleteCommand] Called with options: {"option_login"=>"test_user", "option_id"=>7}
[ INFO 2019-01-20T00:26:10 API] Server: https://satellite.example.com
[ INFO 2019-01-20T00:26:10 API] DELETE /api/users/7
[DEBUG 2019-01-20T00:26:10 API] Params: {}
[DEBUG 2019-01-20T00:26:10 API] Headers: {
:params => {}
}
[DEBUG 2019-01-20T00:26:10 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2019-01-20T00:26:10 API] 500 Internal Server Error
[DEBUG 2019-01-20T00:26:10 API] {
"error" => {
"message" => "Failed to save the record"
}
}
[DEBUG 2019-01-20T00:26:10 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_internal_error
[ERROR 2019-01-20T00:26:10 Exception] Failed to save the record
Could not delete the user:
Failed to save the record
[ERROR 2019-01-20T00:26:10 Exception]

RestClient::InternalServerError (500 Internal Server Error):
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:223:in `exception_with_response'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:103:in `return!'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:353:in `block in rest_client_call_block'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:807:in `process_result'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:725:in `block in transmit'
/opt/rh/rh-ruby25/root/usr/share/ruby/net/http.rb:910:in `start'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:715:in `transmit'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:145:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:52:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/resource.rb:94:in `delete'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:327:in `call_client'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:240:in `http_call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:190:in `call_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:185:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/resource.rb:21:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/apipie/command.rb:51:in `send_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.15.1/lib/hammer_cli_foreman/commands.rb:168:in `send_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/apipie/command.rb:34:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:29:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:29:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:29:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/bin/hammer:147:in `<top (required)>'
/usr/bin/hammer:23:in `load'
/usr/bin/hammer:23:in `<main>'

Actual results: Error - Could not delete the user:
Failed to save the record

Expected results: User should delete.

Additional info: This is regression. User deleted successfully with satellite 6.4.1.

  1. hammer user create --login test_user --auth-source-id 1 --mail a@a.com --password changeme
    User [test_user] created.
  1. hammer user-group create --name test_usergroup --users test_user
    User group [test_usergroup] created.
  1. hammer user-group info --name test_usergroup
    Id: 2
    Name: test_usergroup
    Admin: no
    Users:
    test_user
    User groups:

Inherited User groups:
1) Usergroup:
Roles:
External user groups:

Roles:

Created at: 2019/01/20 05:27:27
Updated at: 2019/01/20 05:27:27

  1. hammer user delete --login test_user
    User [test_user] deleted.
  1. rpm -q satellite
    satellite-6.4.1-1.el7sat.noarch

Related issues

Related to Foreman - Bug #26603: Deleting a user athorized by ldap doesn't workDuplicate

Associated revisions

Revision dd082933 (diff)
Added by Marek Hulán 8 months ago

Fixes #25914 - fix user deletion

History

#1 Updated by The Foreman Bot 8 months ago

  • Assignee set to Marek Hulán
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6435 added

#2 Updated by Ondřej Pražák 8 months ago

  • Status changed from Ready For Testing to Closed
  • Category set to Users
  • Subject changed from Not able to delete user associated with usergroup to Not able to delete user associated with usergroup
  • Fixed in Releases 1.22.0 added

#3 Updated by Tomer Brisker 8 months ago

  • Fixed in Releases 1.21.0 added
  • Fixed in Releases deleted (1.22.0)

#4 Updated by Lukas Zapletal 5 months ago

  • Related to Bug #26603: Deleting a user athorized by ldap doesn't work added

Also available in: Atom PDF