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: implement obtaining AccountService config #9403

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/9403-redfish-add-get-accountservice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- redfish_info - add command ``GetAccountServiceConfig`` to get full information about AccountService configuration (https://github.com/ansible-collections/community.general/pull/9403).
18 changes: 18 additions & 0 deletions plugins/module_utils/redfish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3951,3 +3951,21 @@ def check_location_uri(self, resp_data, resp_uri):
"rsp_uri": rsp_uri
}
return res

def get_accountservice_properties(self):
# Find the AccountService resource
response = self.get_request(self.root_uri + self.service_root)
if response['ret'] is False:
return response
data = response['data']
accountservice_uri = data.get("AccountService", {}).get("@odata.id")
if accountservice_uri is None:
return {'ret': False, 'msg': "AccountService resource not found"}

response = self.get_request(self.root_uri + accountservice_uri)
if response['ret'] is False:
return response
return {
'ret': True,
'entries': response['data']
}
12 changes: 11 additions & 1 deletion plugins/modules/redfish_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@
username: "{{ username }}"
password: "{{ password }}"

- name: Get configuration of the AccountService
community.general.redfish_info:
category: Accounts
command: GetAccountServiceConfig
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"

- name: Get default system inventory and user information
community.general.redfish_info:
category: Systems,Accounts
Expand Down Expand Up @@ -396,7 +404,7 @@
"GetBiosAttributes", "GetBootOrder", "GetBootOverride", "GetVirtualMedia", "GetBiosRegistries"],
"Chassis": ["GetFanInventory", "GetPsuInventory", "GetChassisPower",
"GetChassisThermals", "GetChassisInventory", "GetHealthReport", "GetHPEThermalConfig", "GetHPEFanPercentMin"],
"Accounts": ["ListUsers"],
"Accounts": ["ListUsers", "GetAccountServiceConfig"],
"Sessions": ["GetSessions"],
"Update": ["GetFirmwareInventory", "GetFirmwareUpdateCapabilities", "GetSoftwareInventory",
"GetUpdateStatus"],
Expand Down Expand Up @@ -569,6 +577,8 @@ def main():
for command in command_list:
if command == "ListUsers":
result["user"] = rf_utils.list_users()
elif command == "GetAccountServiceConfig":
result["accountservice_config"] = rf_utils.get_accountservice_properties()

elif category == "Update":
# execute only if we find UpdateService resources
Expand Down
Loading