ansible-collections / community.network

Ansible Community Network Collection
http://galaxy.ansible.com/community/network
Other
124 stars 90 forks source link

community.network.flowadm without maxbw fails on second run #598

Open dahast opened 4 months ago

dahast commented 4 months ago
SUMMARY

community.network.flowadm without maxbw fails on second run

ISSUE TYPE
COMPONENT NAME

community.network.flowadm

ANSIBLE VERSION
ansible [core 2.14.4]
  config file = None
  configured module search path = ['/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/vendor-packages/ansible
  ansible collection location = /usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.16 (main, Mar 22 2023, 18:24:58) [GCC 7.5.0] (/usr/bin/python3.9)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /usr/lib/python3.9/vendor-packages/ansible_collections
Collection        Version
----------------- -------
community.general 6.5.0
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT

illumos

STEPS TO REPRODUCE

It's legal to create a flow without properties priority or maxbw. In my case it was just to maintain order of udp packages to a certain port.

For the task both properties are optional, priority is set to 'medium' in this case, maxbw is unset.

On first run the task creates the flow without the properties, that's ok.

But on second run the task first determines if flow needs update, which is set to true, because the flowadm show-flowprop returns '?' for maxbw, which is not equal to the required maxbw (''). Then the task tries to run an flowadm set-prop, but add not props. The resulting cmd fails.

The task should handle the '?' properly and moreover the update should do a flowadm reset-prop if maxbw changes from a value to none in the task.

Run this twice:

- name: Add flow control to i40e0 for udp port 5409
  community.network.flowadm:
    link: "i40e0"
    flow: "flow-0"
    transport: udp
    local_port: 5409
    state: present
EXPECTED RESULTS

ok on second run

ACTUAL RESULTS

fail on second run


2024-04-25 17:24:19,670 p=5518 u=name n=ansible | failed: [host] (item={'link': 'i40e0', 'flow': 'flow-0'}) => {"ansible_loop_var": "item", "changed": false, "item": {"flow": "flow-0", "link": "i40e0"}, "msg": "Error while updating flow: \"/sbin/flowadm: flow property must be specified\n\"", "name": "flow-0", "rc": 1, "stderr": "/sbin/flowadm: flow property must be specified\n", "stderr_lines": ["/sbin/flowadm: flow property must be specified"]}```
Andersson007 commented 4 months ago

@dahast hello, thanks for reporting the issue Pinging folks specified as maintainers in BOTMETA.yml @xen0l @danowar2k @fishman @jasperla @jpdasma @mator @scathatheworm @troy2914

danowar2k commented 4 months ago

I'm sorry, but why am I listed as a maintainer here? I have never to my knowledge contributed to this repository...

Andersson007 commented 4 months ago

@danowar2k i don't know, this stuff was moved here from ansible/ansible. Anyway, removed you from the file https://github.com/ansible-collections/community.network/pull/599. If you recall you should be there, please let me know, i'll revert the PR, thanks

danowar2k commented 4 months ago

Thanks for removing me! (A long while back I was a little bit active in some Solaris Ansible modules, maybe this was residue from then)