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

ip_netns - some fixes and code rework #58783

Open
wants to merge 5 commits into
base: devel
from

Conversation

Projects
None yet
2 participants
@kb-light
Copy link

commented Jul 5, 2019

SUMMARY

Fixes some Bugs in ip_netns:

  • Check-mode not working correctly (netns exists but check-mode reporting changed=True)
  • No new netns added if name ist part of the name of an existing netns.
  • Require name, because ip netns [add|del] raises the following error: No netns name specified

And some code rework.

ISSUE TYPE
  • Bugfix Pull Request
  • Docs Pull Request
COMPONENT NAME

ip_netns

ADDITIONAL INFORMATION

Reproduce check-mode issue:

  • Create Playbook
  • Run Playbook (netns will be added, changed=True)
  • Run in check-mode (netns already exists but changed=True)
  • Run again in normal mode (everything is fine, changed=False)

Reproduce netns name issue:

  • Create netns red-test
  • Try to create netns red or test (netns won't be added, changed=False)

kb-light added some commits Jul 5, 2019

ip_netns: move to json output
Fixes an issue with netns names that are also part of an existing netns
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jul 5, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jul 5, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/net_tools/ip_netns.py:0:0: E317 Argument 'name' in argument_spec is marked as required but specifies a default. Arguments with a default should not be marked as required

click here for bot help

@ansibot ansibot added the ci_verified label Jul 5, 2019

@kb-light kb-light force-pushed the kb-light:ip_netns branch from 8b12ee0 to fbbff02 Jul 5, 2019

@ansibot ansibot removed the ci_verified label Jul 5, 2019

@kb-light

This comment has been minimized.

Copy link
Author

commented Jul 7, 2019

Here a playbook to reproduce the issues.

- name: test check-mode
  hosts: localhost
  become: yes
  gather_facts: no
  vars:
    netns_name: blue
  tasks:
  - name: check-mode before adding the netns
    ip_netns:
      name: "{{ netns_name }}"
      state: present
    check_mode: yes
  - name: adding the netns
    ip_netns:
      name: "{{ netns_name }}"
      state: present
  - name: check-mode after adding the netns - wrong state
    ip_netns:
      name: "{{ netns_name }}"
      state: present
    check_mode: yes
  - name: run in normal mode again - everything is already fine
    ip_netns:
      name: "{{ netns_name }}"
      state: present

- name: test netns name collisions
  hosts: localhost
  become: yes
  gather_facts: no
  vars:
    netns1_name: red-test
    netns2_name: red
  tasks:
  - name: add netns1
    ip_netns:
      name: "{{ netns1_name }}"
      state: present
  - name: try to add netns2 - won't be added
    ip_netns:
      name: "{{ netns2_name }}"
      state: present

- name: run ip_netns without name - this will fail anyways
  hosts: localhost
  become: yes
  gather_facts: no
  tasks:
  - name: state=present
    ip_netns:
      state: present
    ignore_errors: yes
  - name: state=absent
    ip_netns:
      state: absent
    ignore_errors: yes

@kb-light kb-light changed the title [WIP] ip_netns - some fixes and code rework ip_netns - some fixes and code rework Jul 7, 2019

@ansibot ansibot added community_review and removed WIP labels Jul 7, 2019

@ansibot ansibot added the stale_ci label Jul 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.