clean_facts only show variable name (#76974)

pull/76667/merge
Brian Coca 3 years ago committed by GitHub
parent eb093ae7c3
commit 47faa6e206
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