Closed an0wak closed 1 year ago
@an0wak, thank you for submitting this bug. We will check and accordingly update. From what I see in the code, the disabled_button_lcd_override_pin
argument has the type defined as int
and that could be a reason it might be treating 000000 as just 0. Changing the module argument type to string
might fix it but we need to check the API first.
I have tested API and that takes a "string" of 6 decimal characters
@an0wak, thank you for confirming it. While we try to take a look at our end, meanwhile, could you may be try changing the argument type to str
and try it once?
`
changing it to string is not a problem - it also needs regexp check to see if they are digits... Still new to Githubs and ansibles workings.
@an0wak, could you please may be try with following changes:
Change disabled_button_lcd_override_pin
argument type to str
:
Line# 420:
"disabled_button_lcd_override_pin": {"type": "str", "required": False, "no_log": True}}
Add below import statement to import re
before line # 258:
import re
Before Line#462, add a check to make sure that the pin contains all digits:
# make sure that the LCD override pin is 6 digits in total and within range 000000-999999
chassis_power_button = module.params.get('chassis_power_button')
if chassis_power_button:
disabled_button_lcd_override_pin = chassis_power_button.get('disabled_button_lcd_override_pin')
if disabled_button_lcd_override_pin:
if re.match("^[0-9]{6,6}$", disabled_button_lcd_override_pin):
if 999999 < int(disabled_button_lcd_override_pin) < 0:
module.fail_json(msg="LCD override pin must be 6 digits long and within range 000000-999999.")
else:
module.fail_json(msg="LCD override pin must be 6 digits long and within range 000000-999999.")
Closing the issue as this is fixed with PR # 512 Release 8.1.0
Bug Description
MX7000 OME-M GUI allows a PIN of 6 numerical digits 000000-999999. This module only allows for 6 digits as integer 100000-999999.
Component or Module Name
ome_device_local_access_configuration
Ansible Version
Ansible 2.12.10
Python Version
Python 3.9.2
iDRAC/OME/OME-M version
OME-M 1.30.10
Operating System
Debian 11.6
Playbook Used
ome_device_local_access_configuration.yml
Logs
fatal: [OMEM]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "error_info": {"error": {"@Message.ExtendedInfo": [{"Message": "Unable to set the LcdOverridePin value because the value entered is not a numeric of 6 digits.", "MessageArgs": ["6"], "MessageId": "CGEN4019", "RelatedProperties": [], "Resolution": "Enter a valid LcdOverridePin value that matches the value of pin length specified in the message to set the pin or an empty string to reset the pin, and then retry the operation. For more information about setting the LcdOverridePin values, see the OpenManageEnterprise-Modular User's Guide available on the support site.", "Severity": "Critical"}], "code": "Base.1.0.GeneralError", "message": "A general error has occurred. See ExtendedInfo for more information."}}, "msg": "HTTP Error 400: Bad Request"}
Using an empty string fatal: [OMEM]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "argument 'disabled_button_lcd_override_pin' is of type <class 'str'> found in 'chassis_power_button'. and we were unable to convert to int: <class 'str'> cannot be converted to an int"}
Steps to Reproduce
Change the value between 000000 - 099999 disabled_button_lcd_override_pin: 000000
Expected Behavior
The OME-M Web Gui allows a PIN between 000000-999999. Expected behaviour is to have value 001100 as a PIN.
Actual Behavior
The playbook errors when you try to have a PIN less than 100000 and it has a 0 in front.
Screenshots
No response
Additional Information
No response