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

line 1538, in create_logical_drives_with_particular_physical_drives\n File \"/tmp/ansible_ilo_storage_payload_o5ww7v9e/ansible_ilo_storage_payload.zip/ansible_collections/hpe/ilo/plugins/module_utils/ilo_oem_utils.py\", line 1253, in check_physical_drives\nTypeError: '<' not supported between instances of 'int' and 'str'\n", #29

Open
ekrimi opened this issue Mar 2, 2024 · 0 comments

Comments

@ekrimi
Copy link

ekrimi commented Mar 2, 2024

Hello Team,
I am getting the error below when I try to use the role create logical drive with particular physical drives,
Please note that I am using the get_physical_drives in order to collect server drives details and registred into variable, which in a second task will be processed in order to collect the datadrives Location and total capacity based in a specific condition,

line 1538, in create_logical_drives_with_particular_physical_drives\n File "/tmp/ansible_ilo_storage_payload_o5ww7v9e/ansible_ilo_storage_payload.zip/ansible_collections/hpe/ilo/plugins/module_utils/ilo_oem_utils.py", line 1253, in check_physical_drives\nTypeError: '<' not supported between instances of 'int' and 'str'\n",

So I didn't have any issue with datadrives location variables neither on counting the disks that I will use to create the the RAID , but the error has been raised on create logical drive with particular physical drives as CapacityGB result is being rescated as string
when I use the set_fact , I have confirmed that it's a normal behavior for set_facts since always recast the variable to string

using the debug: msg and after registring the count results it always end up as dict type

in both case forcing the CapacityGB variable to int using the jinja template filter | int didn't solve the issue and raise the same error above as it appears to be Variable is being cast back to String type.

Is there any way to force the type convert from string to int inside the ilo_oem_utils.py python script and avoid this

below the main playbook
`

  • name: check logical drives on HPE server through iLO
    hosts: localhost
    gather_facts: no
    collections:
    • community.general
    • hpe.ilo
      vars_files:
    • vars/main.yml
      roles:
    • get_physical_drives
    • role: configure_raid
      physical_drives: "{{ physical_drives_details }}"
    • role: create_logical_drives_with_particular_physical_drives
      vars:
      raid_details:
      - LogicalDriveName: "LD1"
      Raid: "Raid1"
      CapacityGB: "{{ total_capacity_R1 | int }}"
      DataDrives: "{{ datadrive_locations_raid1 }}"
      `

role configure_raid:
`

  • name: Group RAID1 physical drives by location
    set_fact:
    physical_drives_int: "{{ physical_drives.ilo_storage.GetPhysicalDrives.msg.physical_drives['array_controller_0'] | map(attribute='CapacityGB') | map('int') | list }}"

  • name: Count RAID1 Disk Total Capacity
    vars:
    total_capacity_R1: 0
    loop: "{{ physical_drives_int }}"
    loop_control:
    label: "{{ item }}"
    when: item | int == 300
    set_fact:
    total_capacity_R1: "{{ (total_capacity_R1 | int + item | int) | int }}"
    `
    Thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant