# Buggy code
def get_type_name(mode_number):
    """
    We need to maintain this type strings, for the __compare_options method,
    for easier comparision.
    """
    modes = [
        "Active-Backup",
        "Load balance (balance-xor)",
        None,
        "Dynamic link aggregation (802.3ad)",
    ]
    if not 0 < mode_number <= len(modes) - 1:
        return None
    return modes[mode_number - 1]


# Traceback (TypeError)
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: deploy
<localhost> EXEC /bin/sh -c 'echo ~deploy &amp;&amp; sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo /home/deploy/.ansible/tmp/ansible-tmp-1569588017.0785801-154242329421198 `" &amp;&amp; echo ansible-tmp-1569588017.0785801-154242329421198="` echo /home/deploy/.ansible/tmp/ansible-tmp-1569588017.0785801-154242329421198 `" ) &amp;&amp; sleep 0'
Using module file /home/deploy/ansible_285_venv/lib/python3.6/site-packages/ansible/modules/cloud/ovirt/ovirt_host_network.py
<localhost> PUT /home/deploy/.ansible/tmp/ansible-local-24097xoko1are/tmpe2zvp1l4 TO /home/deploy/.ansible/tmp/ansible-tmp-1569588017.0785801-154242329421198/AnsiballZ_ovirt_host_network.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1569588017.0785801-154242329421198/ /home/deploy/.ansible/tmp/ansible-tmp-1569588017.0785801-154242329421198/AnsiballZ_ovirt_host_network.py &amp;&amp; sleep 0'
<localhost> EXEC /bin/sh -c '/home/deploy/ansible_285_venv/bin/python3 /home/deploy/.ansible/tmp/ansible-tmp-1569588017.0785801-154242329421198/AnsiballZ_ovirt_host_network.py &amp;&amp; sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/deploy/.ansible/tmp/ansible-tmp-1569588017.0785801-154242329421198/ > /dev/null 2>&amp;1 &amp;&amp; sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_ovirt_host_network_payload_s4fkqwyn/__main__.py", line 395, in main
(nic is None or host_networks_module.has_update(nics_service.service(nic.id)))
File "/tmp/ansible_ovirt_host_network_payload_s4fkqwyn/__main__.py", line 288, in has_update
update = self.__compare_options(get_bond_options(bond.get('mode'), bond.get('options')), getattr(nic.bonding, 'options', []))
File "/tmp/ansible_ovirt_host_network_payload_s4fkqwyn/__main__.py", line 247, in __compare_options
return sorted(get_dict_of_struct(opt) for opt in new_options) != sorted(get_dict_of_struct(opt) for opt in old_options)
TypeError: '<' not supported between instances of 'dict' and 'dict'

fatal: [compute01.ovirt.nullpacket.io -> localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"bond": {
"interfaces": [
"enp61s0f0",
"enp61s0f1"
],
"mode": 4,
"name": "bond0",
"options": {
"lacp_rate": "fast",
"xmit_hash_policy": "layer3+4"
}
},
"check": true,
"fetch_nested": false,
"interface": null,
"labels": null,
"name": "compute01.ovirt.nullpacket.io",
"nested_attributes": [],
"networks": [
{
"address": "10.10.83.2",
"boot_protocol": "static",
"gateway": "10.10.83.1",
"name": "ovirtmgmt",
"netmask": "255.255.255.0"
},
{
"boot_protocol": "none",
"name": "vm_provider"
},
{
"boot_protocol": "none",
"name": "vm_okd"
}
],
"poll_interval": 3,
"save": true,
"state": "present",
"sync_networks": false,
"timeout": 180,
"wait": true
}
},
"msg": "'<' not supported between instances of 'dict' and 'dict'"
}

# Fixed code
def get_type_name(mode_number):
    """
    We need to maintain this type strings, for the __compare_options method,
    for easier comparision.
    """
    modes = [
        "Active-Backup",
        "Load balance (balance-xor)",
        None,
        "Dynamic link aggregation (802.3ad)",
    ]
    if not 0 < mode_number <= len(modes):
        return None
    return modes[mode_number - 1]