community.general
community.general copied to clipboard
Add SetSessionService to redfish_config
adding SetSessionService command to redfish_config to set BMC default session timeout policy.
Fixes #5008
ISSUE TYPE
- Feature Pull Request
COMPONENT NAME
redfish_config
(venv) tj@C02GF4NZMD6R Tests % ANSIBLE_COLLECTIONS_PATH=/Users/tj/ansible ansible-playbook -i s2r8node65.s2r8, SetSessionServiceTests.yml
[WARNING]: Collection community.general does not support Ansible version 2.10.7
PLAY [all] **********************************************************************************************************************************************************************************************************************
TASK [Gather initial BMC lan information] ***************************************************************************************************************************************************************************************
ok: [s2r8node65.s2r8]
TASK [Set BMC IP address as fact] ***********************************************************************************************************************************************************************************************
ok: [s2r8node65.s2r8]
TASK [Set something for SessionService] *****************************************************************************************************************************************************************************************
changed: [s2r8node65.s2r8]
TASK [debug] ********************************************************************************************************************************************************************************************************************
ok: [s2r8node65.s2r8] => {
"redfish_set_sessionservice": {
"changed": true,
"failed": false,
"msg": "Modified SessionService"
}
}
PLAY RECAP **********************************************************************************************************************************************************************************************************************
s2r8node65.s2r8 : ok=4 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
(venv) tj@C02GF4NZMD6R Tests % cat SetSessionServiceTests.yml
---
- hosts: all
gather_facts: false
vars:
bmc_username: root
bmc_password: hunter2
default_uri_timeout: 50
default_uri_retries: 5
tasks:
- name: Gather initial BMC lan information
command: ipmitool lan print
register: ipmitool_output
changed_when: ipmitool_output.rc != 0
become: true
- name: Set BMC IP address as fact
set_fact:
bmc_address: "{{ ipmitool_output.stdout | regex_search('IP Address\\s+:\\s+(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})', '\\1')
| first }}"
- name: Set something for SessionService
community.general.redfish_config:
category: SessionService
command: SetSessionService
sessionservice_config:
SessionTimeout: 800
baseuri: "{{ bmc_address }}"
username: "{{ bmc_username }}"
password: "{{ bmc_password }}"
timeout: "{{ default_uri_timeout }}"
retries: "{{ default_uri_retries }}"
register: redfish_set_sessionservice
- debug:
var: redfish_set_sessionservice
cc @bhavya06 @mraineri @rajeevkallur @renxulei @tomasg2012 @xmadsen click here for bot help
Docs Build 📝
Thank you for contribution!✨
This PR has been merged and your docs changes will be incorporated when they are next published.
The test ansible-test sanity --test pylint
[explain] failed with 4 errors:
plugins/module_utils/redfish_utils.py:3085:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3089:36: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3098:35: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3102:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 4 errors:
plugins/module_utils/redfish_utils.py:3085:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3089:36: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3098:35: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3102:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 4 errors:
plugins/module_utils/redfish_utils.py:3085:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3089:36: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3098:35: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3102:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
@felixfontein I missed the discussion about this Docs Build feature in the PRs. Why do they get so long? It is quite annoying to work in the PR having to scroll multiple pages in the browser up and down.
@felixfontein I missed the discussion about this Docs Build feature in the PRs. Why do they get so long? It is quite annoying to work in the PR having to scroll multiple pages in the browser up and down.
See https://github.com/ansible-community/github-docs-build/issues/3 and https://github.com/ansible-community/github-docs-build/issues/36 for some background. @briantist since this is still happening (and can be very annoying, see the above comment which basically mentions every single plugin and module in this repository), should we reopen one of them, or create a new issue?
@felixfontein I missed the discussion about this Docs Build feature in the PRs. Why do they get so long? It is quite annoying to work in the PR having to scroll multiple pages in the browser up and down.
See ansible-community/github-docs-build#3 and ansible-community/github-docs-build#36 for some background. @briantist since this is still happening (and can be very annoying, see the above comment which basically mentions every single plugin and module in this repository), should we reopen one of them, or create a new issue?
It has probably been long enough to open up a new issue.
We're really kind of stuck between the pros and cons of the virtual merge branch, the PR HEAD commit, or the "merge commit sha" (which has all kinds of other problems as we've seen).
I'm wondering if the next step is that we decide on a cut-off X
for the number of changed files, and if it's > X
then we put the file list in an expanding section with <details></details>
.
While we're not really addressing the underlying issue of what changes are the correct ones, it does address any case where the number of changes (legitimate or not) is large and cumbersome to scroll through.
What do you think?
I think we might as well put it in a
@russoz @briantist I think <details>
only make sense if there are more than, say, 5 changed filenames. Having it there all the time makes it unnecessary hard to use in the common case.
@russoz @briantist I think
<details>
only make sense if there are more than, say, 5 changed filenames. Having it there all the time makes it unnecessary hard to use in the common case.
Right, this is my thinking as well (although I think 5 is too small haha), but our collective disagreement on it is why I want it to be configurable. Most collections are not c.g
and don't need to worry about this. I'd rather let every collection decide the threshold for themselves.
EDIT: I will unsubscribe from this PR for now, please @ me if anything more is needed from me :)
The test ansible-test sanity --test pylint
[explain] failed with 3 errors:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3118:36: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3131:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 3 errors:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3118:36: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3131:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 3 errors:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3118:36: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3131:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
@tejabailey please note that the tests are failing. This needs to be fixed before this can be merged.
@felixfontein working on it, thank you.
The test ansible-test sanity --test pylint
[explain] failed with 2 errors:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3131:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 2 errors:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3131:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 2 errors:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
plugins/module_utils/redfish_utils.py:3131:40: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/redfish_utils.py:3114:31: unnecessary-dict-index-lookup: Unnecessary dictionary index lookup, use 'set_value' instead
Hi! I The last pylint error has been corrected. Is this PR ok to merge now?
One last change request, then we can merge (assuming that @mraineri does not have further comments).
I do not have anything else; everything looks good to me so far.
(The REUSE fail is because the test was changed to not rebase. That way I don't have to manually approve every run :) At least for this PR it can be safely ignored.)
Backport to stable-5: 💚 backport PR created
✅ Backport PR branch: patchback/backports/stable-5/d9d830a1680f7dec4601b41200323a9e1534a4bb/pr-5009
Backported as https://github.com/ansible-collections/community.general/pull/5311
🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.
@tejabailey thanks for this contribution! @mraineri @russoz thanks for reviewing!