openvswitch.openvswitch icon indicating copy to clipboard operation
openvswitch.openvswitch copied to clipboard

openvswitch_db check run broken

Open mstinsky opened this issue 6 months ago • 0 comments

SUMMARY

Checkruns with openvswitch.openvswitch >2.0.2 are broken because the out variable is unbound.

ISSUE TYPE
  • Bug Report
STEPS TO REPRODUCE
- name: ovs-configure | Set ovsdb config
  openvswitch.openvswitch.openvswitch_db:
    table: Open_vSwitch
    record: .
    col: external_ids
    key: ovn-encap-type
    value:geneve
    state: present

->

TASK [ovn_controller : ovs-configure | Set ovsdb config] *****************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnboundLocalError: cannot access local variable 'out' where it is not associated with a value
fatal: [ovn-compute-test]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 107, in <module>\n  File \"<stdin>\", line 99, in _ansiballz_main\n  File \"<stdin>\", line 47, in invoke_module\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_openvswitch.openvswitch.openvswitch_db_payload_d22bodks/ansible_openvswitch.openvswitch.openvswitch_db_payload.zip/ansible_collections/openvswitch/openvswitch/plugins/modules/openvswitch_db.py\", line 314, in <module>\n  File \"/tmp/ansible_openvswitch.openvswitch.openvswitch_db_payload_d22bodks/ansible_openvswitch.openvswitch.openvswitch_db_payload.zip/ansible_collections/openvswitch/openvswitch/plugins/modules/openvswitch_db.py\", line 299, in main\nUnboundLocalError: cannot access local variable 'out' where it is not associated with a value\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

This bug was introduced with https://github.com/ansible-collections/openvswitch.openvswitch/pull/88 Because https://github.com/ansible-collections/openvswitch.openvswitch/blob/2.1.1/plugins/modules/openvswitch_db.py#L299 out will never be defined when running in check_mode (https://github.com/ansible-collections/openvswitch.openvswitch/blob/2.1.1/plugins/modules/openvswitch_db.py#L292-L294)

mstinsky avatar Aug 02 '24 09:08 mstinsky