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

Handle ipv6 in _netlink_tool_remote_on #52780

Merged
merged 2 commits into from May 2, 2019

Conversation

@sbrennan4
Copy link

commented May 1, 2019

What does this PR do?

Fixes exception thrown on ipv6 addresses

ValueError: invalid literal for int() with base 10: ':ffff:1.2.3.4:5678'

What issues does this PR fix or reference?

Previous Behavior

>>> s = '::ffff:1.2.3.4:5678'
>>> s.split(':', 1)
['', ':ffff:1.1.3.4:5678']
Exception occurred in runner manage.list_state: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 397, in _low
    data['return'] = self.functions[fun](*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/salt/runners/manage.py", line 270, in list_state
    minions = ckminions.connected_ids(show_ipv4=show_ipv4, subset=subset, include_localhost=True)
  File "/usr/lib/python2.7/site-packages/salt/utils/minions.py", line 625, in connected_ids
    addrs = salt.utils.network.local_port_tcp(int(self.opts['publish_port']))
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 1376, in local_port_tcp
    ret = _remotes_on(port, 'local_port')
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 1394, in _remotes_on
    ret = _netlink_tool_remote_on(port, which_end)
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 1485, in _netlink_tool_remote_on
    if which_end == 'local_port' and int(local_port) != port:
ValueError: invalid literal for int() with base 10: ':ffff:1.232.14.3:58688'

New Behavior

Split the address from the right instead of the left

>>> s.rsplit(':', 1)
['::ffff:1.2.3.4', '5678']

Tests written?

No

Commits signed with GPG?

No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

Sean Brennan
Fixes exception thrown on ipv6 addresses

ValueError: invalid literal for int() with base 10: ':ffff:1.2.3.4:5678'
Copy link
Contributor

left a comment

Can you add a test so we ensure this does not regress in the future?

Sean Brennan
@Ch3LL Ch3LL merged commit 2e55ff0 into saltstack:2018.3 May 2, 2019
18 checks passed
18 checks passed
WIP Ready for review
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint Python lint test has passed
Details
jenkins/pr/py2-centos-6 The py2-centos-6 job has passed
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
Details
jenkins/pr/py2-debian-8 The py2-debian-8 job has passed
Details
jenkins/pr/py2-debian-9 The py2-debian-9 job has passed
Details
jenkins/pr/py2-ubuntu-1404 The py2-ubuntu-1404 job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py2-ubuntu-1804 The py2-ubuntu-1804 job has passed
Details
jenkins/pr/py2-windows-2016 The py2-windows-2016 job has passed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has passed
Details
jenkins/pr/py3-debian-8 The py3-debian-8 job has passed
Details
jenkins/pr/py3-debian-9 The py3-debian-9 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
jenkins/pr/py3-ubuntu-1804 The py3-ubuntu-1804 job has passed
Details
jenkins/pr/py3-windows-2016 The py3-windows-2016 job has passed
Details
@Ch3LL

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

@sbrennan4 how does this affect salt when you are running it? When do you see this exception? I'm just trying to figure out if this should be added to 2019.2.1 release.

@sbrennan4

This comment has been minimized.

Copy link
Author

commented May 2, 2019

The exception occurs when running basically anything in runners.manage if there are minions connected to the master using ipv6. I ran into it when running manage.list_state.

@sbrennan4 sbrennan4 deleted the bloomberg:manage-fix branch May 3, 2019
garethgreenaway added a commit that referenced this pull request May 7, 2019
Backport #52780 into 2019.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.