Repository navigation
Closed
Description
Description
salt-ssh fails when using -E (--pcre) option if regular expression is too long.
Steps to Reproduce the behavior
salt-ssh -E 'some-host|some-host|some-host|some-host|some-host|some-host|some-host' cmd.run ls
I think the problem is that Salt performs some checks against the target string that don't make sense when using -E.
[ERROR ] An un-handled exception was caught by salt's global exception handler:
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label too long)
Traceback (most recent call last):
File "/Users/james/.pyenv/versions/3.6.1/lib/python3.6/encodings/idna.py", line 167, in encode
raise UnicodeError("label too long")
UnicodeError: label too long
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/james/.pyenv/versions/ocp-deploy/bin/salt-ssh", line 11, in <module>
load_entry_point('salt-ssh==3000.1', 'console_scripts', 'salt-ssh')()
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/scripts.py", line 470, in salt_ssh
client.run()
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/cli/ssh.py", line 23, in run
ssh = salt.client.ssh.SSH(self.config)
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/client/ssh/__init__.py", line 227, in __init__
self._expand_target()
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/client/ssh/__init__.py", line 355, in _expand_target
salt.utils.network.is_reachable_host(hostname) and \
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/utils/network.py", line 237, in is_reachable_host
assert type(socket.getaddrinfo(entity_name, 0, 0, 0, 0)) == list
File "/Users/james/.pyenv/versions/3.6.1/lib/python3.6/socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label too long)
Traceback (most recent call last):
File "/Users/james/.pyenv/versions/3.6.1/lib/python3.6/encodings/idna.py", line 167, in encode
raise UnicodeError("label too long")
UnicodeError: label too long
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/james/.pyenv/versions/ocp-deploy/bin/salt-ssh", line 11, in <module>
load_entry_point('salt-ssh==3000.1', 'console_scripts', 'salt-ssh')()
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/scripts.py", line 470, in salt_ssh
client.run()
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/cli/ssh.py", line 23, in run
ssh = salt.client.ssh.SSH(self.config)
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/client/ssh/__init__.py", line 227, in __init__
self._expand_target()
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/client/ssh/__init__.py", line 355, in _expand_target
salt.utils.network.is_reachable_host(hostname) and \
File "/Users/james/.pyenv/versions/3.6.1/envs/ocp-deploy/lib/python3.6/site-packages/salt/utils/network.py", line 237, in is_reachable_host
assert type(socket.getaddrinfo(entity_name, 0, 0, 0, 0)) == list
File "/Users/james/.pyenv/versions/3.6.1/lib/python3.6/socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label too long)
Expected behavior
I'd expect there to be no error.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3000.1
Dependency Versions:
cffi: 1.12.2
cherrypy: unknown
dateutil: 2.8.0
docker-py: Not Installed
gitdb: 2.0.6
gitpython: 2.1.15
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.19
pycrypto: 3.8.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.1 (default, Jun 14 2017, 18:29:17)
python-gnupg: 0.4.4
PyYAML: 5.1.2
PyZMQ: 18.0.1
smmap: 3.0.2
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist:
locale: UTF-8
machine: x86_64
release: 19.4.0
system: Darwin
version: 10.15.4 x86_64
Metadata
Metadata
Assignees
Labels
ConfirmedSalt engineer has confirmed bug/feature - often including a MCVECorerelates to code central or existential to SaltSalt-SSHbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Activity
Catch UnicodeError in is_reachable_host for overlong names
Catch UnicodeError in is_reachable_host for overlong names