clean_facts only show variable name (#76974) (#76985)

(cherry picked from commit 47faa6e206)
pull/77061/head
Brian Coca 4 years ago committed by GitHub
parent 906642edc4
commit 6916e152ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- cleaning facts will now only warn about the variable name and not post the content, which can be undesireable to disclose

@ -152,13 +152,7 @@ def clean_facts(facts):
# then we remove them (except for ssh host keys)
for r_key in remove_keys:
if not r_key.startswith('ansible_ssh_host_key_'):
try:
r_val = to_text(data[r_key])
if len(r_val) > 24:
r_val = '%s ... %s' % (r_val[:13], r_val[-6:])
except Exception:
r_val = ' <failed to convert value to a string> '
display.warning("Removed restricted key from module data: %s = %s" % (r_key, r_val))
display.warning("Removed restricted key from module data: %s" % (r_key))
del data[r_key]
return strip_internal_keys(data)

Loading…
Cancel
Save