Handle connection dissonance (#77005)

* play_context, compensate for existing plugins

 some connection plugins are not fully using the correct configuration,
 but this was previously hidden from them as play_context was providing
 the info instead, now play_context provides the 'correct' info, but hitting
 these bad configurations.
pull/58288/head
Brian Coca 4 years ago committed by GitHub
parent 32f7490a2c
commit 56edbd2bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- play_context now compensates for when a conneciton sets the default to inventory_hostname but skips adding it to the vars.

@ -297,6 +297,13 @@ class PlayContext(Base):
if not new_info.connection_user:
new_info.connection_user = new_info.remote_user
# for case in which connection plugin still uses pc.remote_addr and in it's own options
# specifies 'default: inventory_hostname', but never added to vars:
if new_info.remote_addr == 'inventory_hostname':
new_info.remote_addr = variables.get('inventory_hostname')
display.warning('The "%s" connection plugin has an improperly configured remote target value, '
'forcing "inventory_hostname" templated value instead of the string' % new_info.connection)
# set no_log to default if it was not previously set
if new_info.no_log is None:
new_info.no_log = C.DEFAULT_NO_LOG

Loading…
Cancel
Save