Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redfish_info: Accounts ListUsers shows empty account slots #6771

Closed
1 task done
mraineri opened this issue Jun 23, 2023 · 3 comments
Closed
1 task done

redfish_info: Accounts ListUsers shows empty account slots #6771

mraineri opened this issue Jun 23, 2023 · 3 comments
Labels
bug This issue/PR relates to a bug has_pr module_utils module_utils module module plugins plugin (any type)

Comments

@mraineri
Copy link
Contributor

mraineri commented Jun 23, 2023

Summary

Some Redfish services model empty account slots instead of using typical POST/DELETE semantics for adding/removing users. When invoking redfish.info Accounts ListUsers, it returns the empty account slots, which are not real user accounts. These empty accounts should be filtered from the response to not confuse users.

Issue Type

Bug Report

Component Name

redfish_info.py, redfish_utils.py

Ansible Version

$ ansible --version
ansible [core 2.13.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/rainem1/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
  ansible collection location = /home/rainem1/.ansible/collections:/usr/share/ansible/collections
  executable location = /bin/ansible
  python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

Configuration

$ ansible-config dump --only-changed
# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.3  

# /usr/local/lib/python3.10/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 5.7.0  

# /home/rainem1/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 7.2.0

OS / Environment

Ubuntu

Steps to Reproduce

---
- hosts: all
  gather_facts: false
  vars:
    username: <REDACTED>
    password: <REDACTED>
    baseuri: <REDACTED>
    default_uri_timeout: 5
    default_uri_retries: 5
  tasks:
  - name: Get users
    community.general.redfish_info:
      category: Accounts
      command: ListUsers
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
    retries: "{{ default_uri_retries }}"
    register: redfish_results
  - debug:
      var: redfish_results

This needs to target a Redfish service that expose empty account slots like iDRAC on Dell PowerEdge servers.

Expected Results

Expected output

ok: [localhost] => {
    "redfish_results": {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python3"
        },
        "changed": false,
        "failed": false,
        "redfish_facts": {
            "user": {
                "entries": [
                    {
                        "Enabled": true,
                        "Id": "2",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "Administrator",
                        "UserName": "root"
                    }
                ],
                "ret": true
            }
        }
    }
}

Actual Results

ok: [localhost] => {
    "redfish_results": {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python3"
        },
        "changed": false,
        "failed": false,
        "redfish_facts": {
            "user": {
                "entries": [
                    {
                        "Enabled": false,
                        "Id": "1",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "None",
                        "UserName": ""
                    },
                    {
                        "Enabled": true,
                        "Id": "2",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "Administrator",
                        "UserName": "root"
                    },
                    {
                        "Enabled": false,
                        "Id": "3",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "4",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "5",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "6",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "7",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "8",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "9",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "10",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "11",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "12",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": true,
                        "Id": "13",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "14",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "15",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    },
                    {
                        "Enabled": false,
                        "Id": "16",
                        "Locked": false,
                        "Name": "User Account",
                        "RoleId": "ReadOnly",
                        "UserName": ""
                    }
                ],
                "ret": true
            }
        }
    }
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module module_utils module_utils plugins plugin (any type) labels Jun 23, 2023
@russoz russoz changed the title redfish.info Accounts ListUsers shows empty account slots redfish_info: Accounts ListUsers shows empty account slots Jul 3, 2023
@russoz
Copy link
Collaborator

russoz commented Jul 3, 2023

Change has been merged. Thanks @mraineri !

@russoz russoz closed this as completed Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module_utils module_utils module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

3 participants