Ansible Collection and Sample Playbooks for HPE iLO
Apache License 2.0
42
stars
22
forks
source link
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
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:
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 `
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