diff --git a/lib/ansible/runner/connection_plugins/accelerate.py b/lib/ansible/runner/connection_plugins/accelerate.py index e1f76ce656a..1243e5987be 100644 --- a/lib/ansible/runner/connection_plugins/accelerate.py +++ b/lib/ansible/runner/connection_plugins/accelerate.py @@ -49,6 +49,16 @@ class Connection(object): self.accport = port[1] self.is_connected = False + if not self.port: + self.port = constants.DEFAULT_REMOTE_PORT + elif not isinstance(self.port, int): + self.port = int(self.port) + + if not self.accport: + self.accport = constants.ACCELERATE_PORT + elif not isinstance(self.accport, int): + self.accport = int(self.accport) + self.ssh = SSHConnection( runner=self.runner, host=self.host, @@ -58,9 +68,6 @@ class Connection(object): private_key_file=private_key_file ) - if not self.accport: - self.accport = constants.ACCELERATE_PORT - # attempt to work around shared-memory funness if getattr(self.runner, 'aes_keys', None): utils.AES_KEYS = self.runner.aes_keys