Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aws_ec2] improve hostname sanitization #55950

Open
wants to merge 3 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@s-hertel
Copy link
Contributor

commented Apr 30, 2019

SUMMARY

Allow improved hostname sanitization and deprecate the current default behavior (with a toggle to maintain current behavior).

Also fix documentation for "hostnames" option to accurately reflect the plugin behavior

ISSUE TYPE
  • Bugfix Pull Request
  • Docs Pull Request
COMPONENT NAME

lib/ansible/plugins/inventory/aws_ec2.py

Allow users to sanitize hostnames in aws_ec2
Deprecate the current default (which is to keep unsafe hostnames as-is unless they contain a ':') but provide a toggle to maintain current behavior

Also fix documentation for "hostnames" option to accurately reflect the plugin
@@ -72,6 +74,11 @@
type: bool
default: False
version_added: '2.8'
allow_unsafe_hostnames:

This comment has been minimized.

Copy link
@bcoca

bcoca Apr 30, 2019

Member

doesn't this overlap with use_contrib_script_compatible_sanitization ?

This comment has been minimized.

Copy link
@s-hertel

s-hertel Apr 30, 2019

Author Contributor

Yes, it does overlap with the regex to use. The hostname sanitization is rather sparse in the contrib script, so sanitizing everything depending on the setting of use_contrib_script_compatible_sanitization doesn't replicate the script behavior. I could instead add a whitelist of the hostnames that were sanitized and use that in conjunction with use_contrib_script_compatible_sanitization. Is deprecating the current behavior the right way to go? My last commit reverted that because I'm not sure how important it is, but I can drop that commit.

This comment has been minimized.

Copy link
@s-hertel

s-hertel Apr 30, 2019

Author Contributor

@bcoca Or rather than just fixing aws_ec2, maybe I could add it to lib/ansible/inventory/host.py similarly to what you did for groups and share common code in inventory/helpers?

@s-hertel s-hertel force-pushed the s-hertel:aws_ec2_hostname_sanitization branch from ce1f4d3 to 78b48dd Apr 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.