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

[BUG]: Chassis Power PIN (ome_device_local_access_configuration) #492

Closed
an0wak opened this issue Apr 7, 2023 · 6 comments
Closed

[BUG]: Chassis Power PIN (ome_device_local_access_configuration) #492

an0wak opened this issue Apr 7, 2023 · 6 comments
Labels
area/ome ome modules needs-triage Issue requires triage. type/bug Something isn't working
Milestone

Comments

@an0wak
Copy link

an0wak commented Apr 7, 2023

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

  tasks:
    - name: Configure KVM, direct access and power button settings of the chassis using device ID.
      dellemc.openmanage.ome_device_local_access_configuration:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        device_id: 25011
        chassis_power_button:
          enable_chassis_power_button: false
          enable_lcd_override_pin: true
         disabled_button_lcd_override_pin: 123456
      tags: lac-device-id

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

@an0wak an0wak added needs-triage Issue requires triage. type/bug Something isn't working labels Apr 7, 2023
@anupamaloke
Copy link
Collaborator

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

@anupamaloke anupamaloke added the area/ome ome modules label Apr 12, 2023
@an0wak
Copy link
Author

an0wak commented Apr 13, 2023

I have tested API and that takes a "string" of 6 decimal characters

@anupamaloke
Copy link
Collaborator

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

`

@an0wak
Copy link
Author

an0wak commented Apr 15, 2023

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.

@anupamaloke
Copy link
Collaborator

@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.")
    

@sachin-apa sachin-apa added this to the v8.1.0 milestone Jul 5, 2023
@sachin-apa
Copy link
Collaborator

Closing the issue as this is fixed with PR # 512 Release 8.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ome ome modules needs-triage Issue requires triage. type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants