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

Accept interfaces without address family or method #34200

Merged
merged 1 commit into from Feb 9, 2018
Merged

Accept interfaces without address family or method #34200

merged 1 commit into from Feb 9, 2018

Conversation

bobbywatson3
Copy link
Contributor

SUMMARY

Interfaces do not require address family or method to be set. Without this patch, this module cannot parse inventory files that don't have the address family or method set.
fixes #30768

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

interfaces_file

ANSIBLE VERSION
ansible 2.4.2.0
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Dec 22 2016, 09:22:15) [GCC 6.2.1 20160822]
ADDITIONAL INFORMATION

Example interfaces file that triggers bug:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto br0
iface br0

Error seen before change

TASK [Add interface option] ************************************************************************
fatal: [172.x.x.x]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 172.x.x.x closed.\r\n", "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/tmp/ansible_vhT1bm/ansible_module_interfaces_file.py\", line 385, in <module>\r\n    main()\r\n  File \"/tmp/ansible_vhT1bm/ansible_module_interfaces_file.py\", line 366, in main\r\n    lines, ifaces = read_interfaces_file(module, dest)\r\n  File \"/tmp/ansible_vhT1bm/ansible_module_interfaces_file.py\", line 177, in read_interfaces_file\r\n    return read_interfaces_lines(module, f)\r\n  File \"/tmp/ansible_vhT1bm/ansible_module_interfaces_file.py\", line 211, in read_interfaces_lines\r\n    iface_name, address_family_name, method_name = words[1:4]\r\nValueError: need more than 1 value to unpack\r\n", "msg": "MODULE FAILURE", "rc": 0}

After change:

TASK [Add interface option] ************************************************************************
ok: [172.x.x.x]

@ansibot
Copy link
Contributor

ansibot commented Dec 22, 2017

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Dec 22, 2017
@hryamzik
Copy link
Contributor

Awesome, looks good for me. I'd also like to see tests for this case but that's not a show stopper.
shipit

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Dec 25, 2017
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jan 2, 2018
@bobbywatson3
Copy link
Contributor Author

Is this waiting on anything to be merged?

@hryamzik
Copy link
Contributor

hryamzik commented Feb 9, 2018

CC @gundalow

@gundalow
Copy link
Contributor

gundalow commented Feb 9, 2018

Waiting for Shippable to run (currently stale_ci) then I'll merge & cherry-pick into stable-2.5

@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Feb 9, 2018
@gundalow gundalow merged commit 79b0739 into ansible:devel Feb 9, 2018
@hryamzik
Copy link
Contributor

hryamzik commented Feb 9, 2018

Thanks man!

gundalow pushed a commit to gundalow/ansible that referenced this pull request Feb 9, 2018
gundalow added a commit that referenced this pull request Feb 9, 2018
@gundalow
Copy link
Contributor

gundalow commented Feb 9, 2018

Merged into devel and cherry picked into stable-2.5
8e7b250

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

interfaces_file: need more than 1 value to unpack
4 participants