Skip to content

Add is_ipv4_address and is_ipv6_address functions #570

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

Merged
merged 1 commit into from
Feb 18, 2016
Merged

Add is_ipv4_address and is_ipv6_address functions #570

merged 1 commit into from
Feb 18, 2016

Conversation

gfidente
Copy link
Contributor

These are useful when making decisions based on the type of IP
address received.

These are useful when making decisions based on the type of IP
address received.
@EmilienM
Copy link
Contributor

Why not re-using validate_ipv6_address and add an option to not fail the catalog but just return False?
That would reduce the code impact and could be backward compatible if you set the failure to True by default.

@HelenCampbell
Copy link
Contributor

Hey @gfidente , thank you for your work! This would be a welcome addition to stdlib. Would you be willing to make the changes suggested by @EmilienM ? I can merge in as-is, however the changes suggested would make for a good improvement.

@hunner
Copy link
Contributor

hunner commented Feb 18, 2016

The validate_* messages traditionally fail the compile if they are unmatched so creators don't have to hand-write the logic and failure messages over and over, and is_* return true/false for actionable items.

This would be improved by updating the validate ipv4/6 functions to call the is_* methods and raise a failure on false return, but not required.

@hunner
Copy link
Contributor

hunner commented Feb 18, 2016

Perhaps a is_ip_address would be useful too...

hunner added a commit that referenced this pull request Feb 18, 2016
Add is_ipv4_address and is_ipv6_address functions
@hunner hunner merged commit 69ca8d0 into puppetlabs:master Feb 18, 2016
@gfidente
Copy link
Contributor Author

hi all, thanks for checking this!

maybe we can add a parameter for IPv6 to is_ip_address and call the same code from all is_ipv4 is_ipv6 and validate_* ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants