Bug 1651131 - "hammer user list" doesn't show admin user
Summary: "hammer user list" doesn't show admin user
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.4.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Sachin Ghai
Depends On:
TreeView+ depends on / blocked
Reported: 2018-11-19 09:26 UTC by Masatake YAMATO
Modified: 2019-08-14 15:48 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-08-14 15:48:39 UTC
Target Upstream Version:

Attachments (Terms of Use)
The output of hammer -d user list (9.19 KB, application/octet-stream)
2018-11-20 02:53 UTC, Masatake YAMATO
no flags Details

Description Masatake YAMATO 2018-11-19 09:26:41 UTC
Description of problem:

"hammer user list" doesn't show admin user.

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


How reproducible:

Steps to Reproduce:
1. Run "hammer user list" 

Actual results:

"admin" is not listed.

Expected results:

"admin" user is shown.

Additional info:

Comment 1 Martin Bacovsky 2018-11-19 12:18:26 UTC
Thanks for the report,
is it possible the admin user is in different org then the org used to list the users? Are there any defaults set? (Check "hammer defaults list") 
What user is the current user and has permissions to see the admin user?
Does hammer user list --organization NIL --location NIL show the desired results?

If the questions above didn't help could you please share/attach output of "hammer -d user list"

Comment 2 Marek Hulan 2018-11-19 12:24:30 UTC
Also admin might not be assigned to any org/loc (default state) hence regular user is unable to see this account.

Comment 3 Masatake YAMATO 2018-11-20 02:52:47 UTC
I tried some more commands.

[root@satellite-test ~]# hammer defaults list
organization_id | 1    
location_id     | 2    
[root@satellite-test ~]# hammer organization list
[root@satellite-test ~]# hammer location list
ID | TITLE            | NAME             | DESCRIPTION
2  | Default Location | Default Location |            
[root@satellite-test ~]# hammer user list --organization NIL --location NIL
[root@satellite-test ~]# hammer organization info --id 1
Id:                     1
Title:                  example-com
Name:                   example-com

Smart proxies:

Compute resources:

Installation media:
    CentOS mirror
    CoreOS mirror
    Debian mirror
    Fedora Atomic mirror
    Fedora mirror
    FreeBSD mirror
    OpenSUSE mirror
    RancherOS mirror
    Ubuntu mirror
    Alterator default (provision)
    Alterator default finish (finish)
    Alterator default PXELinux (PXELinux)
    alterator_pkglist ()
    ansible_provisioning_callback ()
    ansible_tower_callback_script ()
    ansible_tower_callback_service ()
    Atomic Kickstart default (provision)
    AutoYaST default (provision)
    AutoYaST default iPXE (iPXE)
    AutoYaST default PXELinux (PXELinux)
    AutoYaST default user data (user_data)
    AutoYaST SLES default (provision)
    bmc_nic_setup ()
    Boot disk iPXE - generic host (Bootdisk)
    Boot disk iPXE - host (Bootdisk)
    chef_client ()
    coreos_cloudconfig ()
    CoreOS provision (provision)
    CoreOS PXELinux (PXELinux)
    create_users ()
    epel ()
    fix_hosts ()
    FreeBSD (mfsBSD) finish (finish)
    FreeBSD (mfsBSD) provision (provision)
    FreeBSD (mfsBSD) PXELinux (PXELinux)
    freeipa_register ()
    Grubby default (script)
    http_proxy ()
    Jumpstart default (provision)
    Jumpstart default finish (finish)
    Jumpstart default PXEGrub (PXEGrub)
    Junos default finish (finish)
    Junos default SLAX (provision)
    Junos default ZTP config (ZTP)
    Kickstart default (provision)
    Kickstart default finish (finish)
    Kickstart default iPXE (iPXE)
    Kickstart default PXEGrub (PXEGrub)
    Kickstart default PXEGrub2 (PXEGrub2)
    Kickstart default PXELinux (PXELinux)
    Kickstart default user data (user_data)
    kickstart_ifcfg_bonded_interface ()
    kickstart_ifcfg_bond_interface ()
    kickstart_ifcfg_generic_interface ()
    kickstart_ifcfg_get_identifier_names ()
    kickstart_networking_setup ()
    Kickstart oVirt-RHVH (provision)
    Kickstart oVirt-RHVH PXELinux (PXELinux)
    NX-OS default POAP setup (POAP)
    Preseed default (provision)
    Preseed default finish (finish)
    Preseed default iPXE (iPXE)
    Preseed default PXEGrub2 (PXEGrub2)
    Preseed default PXELinux (PXELinux)
    Preseed default user data (user_data)
    preseed_networking_setup ()
    puppet.conf ()
    puppetlabs_repo ()
    puppet_setup ()
    pxegrub2_chainload ()
    PXEGrub2 default local boot (PXEGrub2)
    pxegrub2_discovery ()
    PXEGrub2 global default (PXEGrub2)
    pxegrub_chainload ()
    PXEGrub default local boot (PXEGrub)
    pxegrub_discovery ()
    PXEGrub global default (PXEGrub)
    PXELinux chain iPXE (PXELinux)
    PXELinux chain iPXE UNDI (PXELinux)
    pxelinux_chainload ()
    PXELinux default local boot (PXELinux)
    PXELinux default memdisk (PXELinux)
    pxelinux_discovery ()
    PXELinux global default (PXELinux)
    rancheros_cloudconfig ()
    RancherOS provision (provision)
    RancherOS PXELinux (PXELinux)
    redhat_register ()
    remote_execution_ssh_keys ()
    saltstack_minion ()
    saltstack_setup ()
    UserData default (user_data)
    WAIK default PXELinux (PXELinux)
    XenServer default answerfile (provision)
    XenServer default finish (finish)
    XenServer default PXELinux (PXELinux)




Created at:             2018/11/14 07:52:06
Updated at:             2018/11/14 12:13:45
Label:                  example-com
Red Hat Repository URL: https://cdn.redhat.com
Service Levels:         Self-Support

Comment 4 Masatake YAMATO 2018-11-20 02:53:38 UTC
Created attachment 1507342 [details]
The output of hammer -d user list

Comment 5 Marek Hulan 2018-11-20 06:57:28 UTC
What I effectively asked for is this

hammer --username admin user info --login admin

you'll need to specify admin's password. We're interested in what locations and organization admin is assigned to. My guess is that there are none.

Comment 6 Masatake YAMATO 2018-11-20 14:17:03 UTC
Here is the output:

[root@satellite-test roles]# hammer --username admin user info --login admin
Id:                    4
Login:                 admin
Name:                  Admin User
Email:                 root@localhost
Admin:                 yes
Last login:            2018/11/20 15:47:08
Authorized by:         Internal
Effective admin:       yes
Locale:                default
Timezone:              Tokyo
Default organization:  example-com
Default location:      

User groups:           

Inherited User groups: 

Created at:            2018/11/14 07:52:04
Updated at:            2018/11/19 18:35:02

Comment 8 Martin Bacovsky 2018-12-11 23:15:23 UTC
I noticed an unexpected output of "hammer user list --organization NIL --location NIL" in your reply.
Could you please confirm that you can see the admin user if you use "hammer user list --organization-id NIL --location-id NIL"? (notice the "-id" added).

I was able to reproduce what you describe and I can see the admin user in "hammer user list --organization-id NIL --location-id NIL" output.

From the log you attached we can see that the defaults were used and effectively "hammer user list --organisation-id 1 --location-id 2" was executed.
As the user is not in that organization we don't see it in the output. So the output you are describing is expected with your setup.

In next Satellite version there should be option to disable the defaults temporarily to make user experience with defaults better.

Comment 9 Masatake YAMATO 2019-01-16 13:58:50 UTC
I'm very sorry to be late to reply.

I visited locatoins page of web ui. I found a "Fix mismatch" button.
I tried the button without thinking deep.
And I got 
"All mismatches between hosts and locations/organizations have been fixed"

After that I tried hammer user list.
I got:

ID | LOGIN | NAME       | EMAIL          | ADMIN | LAST LOGIN          | AUTHORIZED BY
4  | admin | Admin User | root@localhost | yes   | 2019/01/16 13:37:16 | Internal     

It works fine.
I wonder why.

Comment 10 Oleh Fedorenko 2019-08-14 15:48:39 UTC
Unfortunately, I can't reproduce this bug on 6.4 with/out various options (--org/loc NIL/id). Everything works as it should.

I'm closing this bug, but if you still experience the problem, please reopen the bug.

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