Use value of delegated transport for var lookup (#35658)
This commit is contained in:
parent
c3199dca6c
commit
24c6de7c49
1 changed files with 3 additions and 3 deletions
|
@ -331,7 +331,7 @@ class PlayContext(Base):
|
||||||
# address, otherwise we default to connecting to it by name. This
|
# address, otherwise we default to connecting to it by name. This
|
||||||
# may happen when users put an IP entry into their inventory, or if
|
# may happen when users put an IP entry into their inventory, or if
|
||||||
# they rely on DNS for a non-inventory hostname
|
# they rely on DNS for a non-inventory hostname
|
||||||
for address_var in ('ansible_%s_host' % transport_var,) + C.MAGIC_VARIABLE_MAPPING.get('remote_addr'):
|
for address_var in ('ansible_%s_host' % delegated_transport,) + C.MAGIC_VARIABLE_MAPPING.get('remote_addr'):
|
||||||
if address_var in delegated_vars:
|
if address_var in delegated_vars:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -340,7 +340,7 @@ class PlayContext(Base):
|
||||||
|
|
||||||
# reset the port back to the default if none was specified, to prevent
|
# reset the port back to the default if none was specified, to prevent
|
||||||
# the delegated host from inheriting the original host's setting
|
# the delegated host from inheriting the original host's setting
|
||||||
for port_var in ('ansible_%s_port' % transport_var,) + C.MAGIC_VARIABLE_MAPPING.get('port'):
|
for port_var in ('ansible_%s_port' % delegated_transport,) + C.MAGIC_VARIABLE_MAPPING.get('port'):
|
||||||
if port_var in delegated_vars:
|
if port_var in delegated_vars:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -350,7 +350,7 @@ class PlayContext(Base):
|
||||||
delegated_vars['ansible_port'] = C.DEFAULT_REMOTE_PORT
|
delegated_vars['ansible_port'] = C.DEFAULT_REMOTE_PORT
|
||||||
|
|
||||||
# and likewise for the remote user
|
# and likewise for the remote user
|
||||||
for user_var in ('ansible_%s_user' % transport_var,) + C.MAGIC_VARIABLE_MAPPING.get('remote_user'):
|
for user_var in ('ansible_%s_user' % delegated_transport,) + C.MAGIC_VARIABLE_MAPPING.get('remote_user'):
|
||||||
if user_var in delegated_vars and delegated_vars[user_var]:
|
if user_var in delegated_vars and delegated_vars[user_var]:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue