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

Do not make Salt CLI to crash when there are IPv6 established connections #52888

Conversation

meaksh
Copy link
Contributor

@meaksh meaksh commented May 7, 2019

What does this PR do?

This PR fixes an issue in utils/network.py which is making the Salt CLI to crash when some of the targeted minions cannot be reached.

Currently, the _netlink_tool_remote_on function is not taking care of possible IPv6 entries returned by ss -ant.

When there are minions that did not response on time, then this code is executed. In case the underlying call to ss -ant returns an IPv6 entry, this would make the Salt CLI to crash while trying to parse the host/port.

Previous Behavior

# salt '*' test.ping
minion1:
    True
minion2:
    True
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
ValueError: invalid literal for int() with base 10: ':ffff:10.111.111.111]:9100'
Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    salt_main()
  File "/usr/lib/python3.6/site-packages/salt/scripts.py", line 516, in salt_main
    client.run()
  File "/usr/lib/python3.6/site-packages/salt/cli/salt.py", line 194, in run
    for full_ret in cmd_func(**kwargs):
  File "/usr/lib/python3.6/site-packages/salt/client/__init__.py", line 746, in cmd_cli
    **kwargs):
  File "/usr/lib/python3.6/site-packages/salt/client/__init__.py", line 1508, in get_cli_event_returns
    connected_minions = salt.utils.minions.CkMinions(self.opts).connected_ids()
  File "/usr/lib/python3.6/site-packages/salt/utils/minions.py", line 643, in connected_ids
    addrs = salt.utils.network.local_port_tcp(int(self.opts['publish_port']))
  File "/usr/lib/python3.6/site-packages/salt/utils/network.py", line 1384, in local_port_tcp
    ret = _remotes_on(port, 'local_port')
  File "/usr/lib/python3.6/site-packages/salt/utils/network.py", line 1402, in _remotes_on
    ret = _netlink_tool_remote_on(port, which_end)
  File "/usr/lib/python3.6/site-packages/salt/utils/network.py", line 1494, in _netlink_tool_remote_on
    if which_end == 'local_port' and int(local_port) != port:
ValueError: invalid literal for int() with base 10: ':ffff:10.111.111.111]:9100'

New Behavior

# salt '*' test.ping
minion1:
    True
minion2:
    True
minion3:
    Minion did not return. [No response]
ERROR: Minions returned with non-zero exit code

Tests written?

Yes

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

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

@cmcmarrow
Copy link
Contributor

Thanks for the test! Good Work

@meaksh
Copy link
Contributor Author

meaksh commented Dec 10, 2019

Closing in favor of #55583

@meaksh meaksh closed this Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants