Skip to content

(MODULES-6366) Add data types for IP validation #872

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
Mar 2, 2018

Conversation

ghoneycutt
Copy link
Contributor

The types are from https://github.com/thrnio/puppet-ip which was released
under the Apache-2.0 license.

@ghoneycutt ghoneycutt force-pushed the 6366_ip_types branch 2 times, most recently from 149bd66 to 53bf879 Compare January 4, 2018 22:19
@ghoneycutt
Copy link
Contributor Author

I purposely left Stdlib::Compat::Ip* alone as it is meant to deal with the old validate_* functions. Because of this, the new code here does not mention it and has new tests separate from it so when it is time for the Stdlib::Compat bits to be taken out of the code, it can be done easily. I did however copy the test cases used in the associated types added here.

Test cases were also taken from the README in https://github.com/thrnio/puppet-ip. For the types that did not have tests, I used the examples from the RFC. https://www.ietf.org/rfc/rfc2373.txt

@binford2k
Copy link
Contributor

Hey @ghoneycutt! Could you add @thrnio as a co-author? (I'm sure you know how, but here's docs, if not.)

@ghoneycutt
Copy link
Contributor Author

I did not, thanks for teaching me!

Added Ryan to the commit.

@b4ldr
Copy link
Collaborator

b4ldr commented Feb 22, 2018

just mentioning #843 as its similar. I prefer this PR as its much more complete however i think we can strip out the Address word from all types to make readability easier e.g.

Stdlib::IP::Address -> Stdlib::IP
Stdlib::IP::Address::v4 -> Stdlib::IP::v4
Stdlib::IP::Address::v6 -> Stdlib::IP::v6

@ghoneycutt
Copy link
Contributor Author

@binford2k Thanks for your +1. Could you approve or merge this PR? I would like to get a release going as it is a dependency for me to release other modules that need this functionality.

@ghoneycutt
Copy link
Contributor Author

I prefer with the Address portion as it is more exact. I'm happy to defer to whatever Puppet would like in order to get this merged.

@b4ldr
Copy link
Collaborator

b4ldr commented Feb 22, 2018

@ghoneycutt Im not sure what you mean by it being more exact. if we want to be exact then we should really use something like

Stdlib::IP::4::Address   # ipv4
Stdlib::IP::6::Address   # ipv6
Stdlib::IP::50::Address  # ESP

i.e. the IP protocol should come before the address. This becomes useful is you want to have something more then Address for instance

Stdlib::IP::4::Header   # ipv4
Stdlib::IP::6::Header   # ipv6
Stdlib::IP::50::Header  # ESP

One you have this in mind then i think its reasnable to assume that Stdlib::IP::4 would relate to the most common IP protocol 4 parameter i.e. the address so we could have

Stdlib::IP::4::Address   # ipv4
Stdlib::IP::6::Address   # ipv6
Stdlib::IP::50::Address  # ESP

Stdlib::IP::4 = Stdlib::IP::4::Address
Stdlib::IP::6 = Stdlib::IP::6::Address
Stdlib::IP::50 = Stdlib::IP::50::Address

@purplexa
Copy link

Just a note, Stdlib::IP::4::Address isn't valid because each component has to start with a letter, which is why the existing names all use V4 or V6. Stdlib::IP::V4::Address would work though.

@ghoneycutt
Copy link
Contributor Author

I'm not attached to Stdlib::IP::Address::x, so it could be Stdlib::IP::x as you mentioned. Whatever Puppet wants to merge is fine with me.

Would not want to have an alias from one to the other as this adds unneeded complexity.

Puppet, what color should this shed be?

@bodgit
Copy link

bodgit commented Feb 28, 2018

Any reason these have to be imported into Stdlib? If it's for the purposes of deprecating the original source module then I'd vote for importing in a way that needs the minimum of work for module authors to adapt to it, i.e. if it's just a case of prefixing everything with Stdlib:: rather than having to shuffle things about.

@eputnam
Copy link
Contributor

eputnam commented Feb 28, 2018

@ghoneycutt just needs a rebase and we'll get this moving.

The types are from https://github.com/thrnio/puppet-ip which was released
under the Apache-2.0 license by Ryan Whitehurst. Spec tests added and
code modified to work with puppetlabs/stdlib by Garrett Honeycutt.

Co-authored-by: Ryan Whitehurst <ryan@ryanwhitehurst.com>
Co-authored-by: Garrett Honeycutt <code@garretthoneycutt.com>
@ghoneycutt
Copy link
Contributor Author

Thanks @eputnam, got this rebased.

@eputnam eputnam merged commit 19e280d into puppetlabs:master Mar 2, 2018
@ghoneycutt ghoneycutt deleted the 6366_ip_types branch March 2, 2018 00:33
@ghoneycutt
Copy link
Contributor Author

Appreciate the merge @eputnam !

Can you please let us know here when a release is made that contains this PR? Will it be soon? Seems there hasn't been a release in quite some time relative to merged PR's.

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.

7 participants