From b5a9a09ca2cd0b65c7a0c9b972788405bd4ba45b Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Wed, 16 May 2018 13:49:30 +0200 Subject: [PATCH 1/3] (MODULES-7181) Remove Stdlib::(Ipv4|IPv6|Ip_address) There was 3 different data types for ip validation before this commit. This removes the Stdlib::(Ipv4|IPv6|Ip_address) data type in favour of Stdlib::IP::* as those are way more complete. --- README.md | 48 ------------------------------- spec/type_aliases/ip_address.rb | 44 ----------------------------- spec/type_aliases/ipv4_spec.rb | 20 ------------- spec/type_aliases/ipv6_spec.rb | 50 --------------------------------- types/ip_address.pp | 1 - types/ipv4.pp | 1 - types/ipv6.pp | 1 - 7 files changed, 165 deletions(-) delete mode 100644 spec/type_aliases/ip_address.rb delete mode 100644 spec/type_aliases/ipv4_spec.rb delete mode 100644 spec/type_aliases/ipv6_spec.rb delete mode 100644 types/ip_address.pp delete mode 100644 types/ipv4.pp delete mode 100644 types/ipv6.pp diff --git a/README.md b/README.md index ee7769805..866b4fb11 100644 --- a/README.md +++ b/README.md @@ -537,54 +537,6 @@ asdasdASDSADA3423868327/46+== Valid values: A base64 string. -#### `Stdlib::Ipv4` - -Matches on valid IPv4 addresses. - -Acceptable input example: - -```shell -0.0.0.0 - -192.0.2.1 - -127.0.0.1 -``` - -Valid values: An IPv4 address. - -#### `Stdlib::Ipv6` - -Matches on valid IPv6 addresses. - -Acceptable input example: - -```shell -2001:0db8:85a3:0000:0000:8a2e:0370:7334 - -2001:db8:: - -2001:db8::80 -``` - -Valid values: An IPv6 address. - -#### `Stdlib::Ip_address` - -Matches on valid IPv4 or IPv6 addresses. - -Acceptable input example: - -```shell -0.0.0.0 - -127.0.0.1 - -fe80:0000:0000:0000:0204:61ff:fe9d:f156 -``` - -Valid values: An IP address. - #### `Stdlib::IP::Address` Matches any IP address, including both IPv4 and IPv6 addresses. It will match them either with or without an address prefix as used in CIDR format IPv4 addresses. diff --git a/spec/type_aliases/ip_address.rb b/spec/type_aliases/ip_address.rb deleted file mode 100644 index e107f4204..000000000 --- a/spec/type_aliases/ip_address.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'spec_helper' - -if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 - describe 'Stdlib::Ip_address' do - describe 'accepts ipv4 and ipv6 addresses' do - [ - '224.0.0.0', - '255.255.255.255', - '0.0.0.0', - '192.88.99.0', - '2001:0db8:85a3:0000:0000:8a2e:0370:7334', - 'fa76:8765:34ac:0823:ab76:eee9:0987:1111', - ].each do |value| - describe value.inspect do - it { is_expected.to allow_value(value) } - end - end - end - describe 'rejects other values' do - [ - nil, - [nil], - [nil, nil], - { 'foo' => 'bar' }, - {}, - '', - 'nope', - '77', - '4.4.4', - '2001:0db8:85a3:000000:0000:8a2e:0370:7334', - '2001::0db8::1', - ' 2001:0db8::1', - '2001:0db8::1 ', - ' 2001:0db8::1 ', - 'foobar2001:0db8::1', - '2001:0db8::1foobar', - ].each do |value| - describe value.inspect do - it { is_expected.not_to allow_value(value) } - end - end - end - end -end diff --git a/spec/type_aliases/ipv4_spec.rb b/spec/type_aliases/ipv4_spec.rb deleted file mode 100644 index c6c4b2822..000000000 --- a/spec/type_aliases/ipv4_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 - describe 'Stdlib::Ipv4' do - describe 'accepts ipv4 addresses' do - SharedData::IPV4_PATTERNS.each do |value| - describe value.inspect do - it { is_expected.to allow_value(value) } - end - end - end - describe 'rejects other values' do - SharedData::IPV4_NEGATIVE_PATTERNS.each do |value| - describe value.inspect do - it { is_expected.not_to allow_value(value) } - end - end - end - end -end diff --git a/spec/type_aliases/ipv6_spec.rb b/spec/type_aliases/ipv6_spec.rb deleted file mode 100644 index 820c46979..000000000 --- a/spec/type_aliases/ipv6_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'spec_helper' - -if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 - describe 'Stdlib::Ipv6' do - describe 'accepts ipv6 addresses' do - [ - '2001:0db8:85a3:0000:0000:8a2e:0370:7334', - 'fa76:8765:34ac:0823:ab76:eee9:0987:1111', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', - 'fe80:0:0:0:204:61ff:fe9d:f156', - 'fe80::204:61ff:fe9d:f156', - 'fe80:0:0:0:0204:61ff:254.157.241.86', - '::1', - 'fe80::', - '2001::', - ].each do |value| - describe value.inspect do - it { is_expected.to allow_value(value) } - end - end - end - describe 'rejects other values' do - [ - nil, - [nil], - [nil, nil], - { 'foo' => 'bar' }, - {}, - '', - 'nope', - '77', - '4.4.4', - '2000:7334', - '::ffff:2.3.4', - '::ffff:257.1.2.3', - '::ffff:12345678901234567890.1.26', - '2001::0db8::1', - ' 2001:0db8::1', - '2001:0db8::1 ', - ' 2001:0db8::1 ', - 'foobar2001:0db8::1', - '2001:0db8::1foobar', - ].each do |value| - describe value.inspect do - it { is_expected.not_to allow_value(value) } - end - end - end - end -end diff --git a/types/ip_address.pp b/types/ip_address.pp deleted file mode 100644 index cb1eb0a59..000000000 --- a/types/ip_address.pp +++ /dev/null @@ -1 +0,0 @@ -type Stdlib::Ip_address = Variant[Stdlib::Ipv4, Stdlib::Ipv6] diff --git a/types/ipv4.pp b/types/ipv4.pp deleted file mode 100644 index 06edef29f..000000000 --- a/types/ipv4.pp +++ /dev/null @@ -1 +0,0 @@ -type Stdlib::Ipv4 = Stdlib::Compat::Ipv4 diff --git a/types/ipv6.pp b/types/ipv6.pp deleted file mode 100644 index 4fce91d1d..000000000 --- a/types/ipv6.pp +++ /dev/null @@ -1 +0,0 @@ -type Stdlib::Ipv6 = Pattern[/^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?$/] From 29073b0d602f8dbb40d31d5088d71c4a6aea0d64 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Wed, 15 Aug 2018 13:33:11 +0100 Subject: [PATCH 2/3] (maint) README removal of Ipv6, Ipv4 and Ip_address entry This commit includes changes to the README to redirect users to use a new function as this one has now been removed. -`Stdlib::Ipv4` -> `Stdlib::IP::Address::V4` -`Stdlib::Ipv6` -> `Stdlib::IP::Address::V6` -`Stdlib::Ip_address` -> `Stdlib::IP::Address' --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 866b4fb11..f987bd535 100644 --- a/README.md +++ b/README.md @@ -537,6 +537,18 @@ asdasdASDSADA3423868327/46+== Valid values: A base64 string. +#### `Stdlib::Ipv4` + +This type is no longer available. In order to make use of this functionality please use [Stdlib::IP::Address::V4](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv4). + +#### `Stdlib::Ipv6` + +This type is no longer available. In order to make use of this functionality please use [Stdlib::IP::Address::V6](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv6). + +#### `Stdlib::Ip_address` + +This type is no longer available. In order to make use of this functionality please use [Stdlib::IP::Address](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddress) + #### `Stdlib::IP::Address` Matches any IP address, including both IPv4 and IPv6 addresses. It will match them either with or without an address prefix as used in CIDR format IPv4 addresses. From c60b0fa111ebd893bbf0e29dd1af4a3a5523a469 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Wed, 15 Aug 2018 16:34:46 +0100 Subject: [PATCH 3/3] Update sentance. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f987bd535..d220d1749 100644 --- a/README.md +++ b/README.md @@ -539,15 +539,15 @@ Valid values: A base64 string. #### `Stdlib::Ipv4` -This type is no longer available. In order to make use of this functionality please use [Stdlib::IP::Address::V4](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv4). +This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address::V4](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv4). #### `Stdlib::Ipv6` -This type is no longer available. In order to make use of this functionality please use [Stdlib::IP::Address::V6](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv6). +This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address::V6](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv6). #### `Stdlib::Ip_address` -This type is no longer available. In order to make use of this functionality please use [Stdlib::IP::Address](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddress) +This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddress) #### `Stdlib::IP::Address`