Set the ansible_ssh_port variable instead of saving it internally for Host

Fixes #11330
pull/11350/head
Benno Joy 10 years ago committed by James Cammarata
parent 5a02ea5f2b
commit f17bdc4d61

@ -49,7 +49,6 @@ class Host:
vars=self.vars.copy(), vars=self.vars.copy(),
ipv4_address=self.ipv4_address, ipv4_address=self.ipv4_address,
ipv6_address=self.ipv6_address, ipv6_address=self.ipv6_address,
port=self.port,
gathered_facts=self._gathered_facts, gathered_facts=self._gathered_facts,
groups=groups, groups=groups,
) )
@ -61,7 +60,6 @@ class Host:
self.vars = data.get('vars', dict()) self.vars = data.get('vars', dict())
self.ipv4_address = data.get('ipv4_address', '') self.ipv4_address = data.get('ipv4_address', '')
self.ipv6_address = data.get('ipv6_address', '') self.ipv6_address = data.get('ipv6_address', '')
self.port = data.get('port')
groups = data.get('groups', []) groups = data.get('groups', [])
for group_data in groups: for group_data in groups:
@ -79,9 +77,9 @@ class Host:
self.ipv6_address = name self.ipv6_address = name
if port and port != C.DEFAULT_REMOTE_PORT: if port and port != C.DEFAULT_REMOTE_PORT:
self.port = int(port) self.set_variable('ansible_ssh_port', int(port))
else: else:
self.port = C.DEFAULT_REMOTE_PORT self.set_variable('ansible_ssh_port', C.DEFAULT_REMOTE_PORT)
self._gathered_facts = False self._gathered_facts = False

Loading…
Cancel
Save