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

[PR #6772/93f5a48b backport][stable-6] Redfish: Filter empty account slots from ListUsers #6793

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Jun 26, 2023

This is a backport of PR #6772 as merged into main (93f5a48).

SUMMARY

Fixes the output for the ListUsers command in redfish.info to suppress empty account slots for services that do not support POST/DELETE to add/remove users.

Fixex #6771

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

redfish_info.py, redfish_utils.py

ADDITIONAL INFORMATION

Sample playbook; requires a Redfish service that shows empty account slots (like an iDRAC on a Dell PowerEdge server)

---
- 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

Before:

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
            }
        }
    }
}

After:

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
            }
        }
    }
}

* Redfish: Filter empty account slots from ListUsers

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Update 6771-redfish-filter-empty-account-slots.yml

* Update changelogs/fragments/6771-redfish-filter-empty-account-slots.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Signed-off-by: Mike Raineri <michael.raineri@dell.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 93f5a48)
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added backport bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type) labels Jun 26, 2023
@felixfontein felixfontein merged commit d7efa7e into stable-6 Jun 27, 2023
@felixfontein felixfontein deleted the patchback/backports/stable-6/93f5a48b8c155ae91cacd44e80a11b7260dfda24/pr-6772 branch June 27, 2023 05:07
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 module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants