1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #1650 from dagwieers/port-not-integer-exception

Provide a proper error when the remote_port is not an integer
This commit is contained in:
Michael DeHaan 2012-11-21 06:39:24 -08:00
commit 41af2fce64

View file

@ -382,6 +382,11 @@ class Runner(object):
try: try:
if actual_port is not None: if actual_port is not None:
actual_port = int(actual_port) actual_port = int(actual_port)
except ValueError, e:
result = dict(failed=True, msg="FAILED: Configured port \"%s\" is not a valid port, expected integer" % actual_port)
return ReturnData(host=host, comm_ok=False, result=result)
try:
conn = self.connector.connect(actual_host, actual_port) conn = self.connector.connect(actual_host, actual_port)
if delegate_to or host != actual_host: if delegate_to or host != actual_host:
conn.delegate = host conn.delegate = host