From 128d6fe56855ba37698f67314b991a2bfdb7af37 Mon Sep 17 00:00:00 2001 From: Helen Campbell Date: Thu, 12 Jan 2017 15:35:35 +0000 Subject: Addition of compat hash type for deprecation --- types/compat/hash.pp | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 types/compat/hash.pp (limited to 'types') diff --git a/types/compat/hash.pp b/types/compat/hash.pp new file mode 100644 index 0000000..e84a10b --- /dev/null +++ b/types/compat/hash.pp @@ -0,0 +1,2 @@ +# Emulate the is_hash and validate_hash functions +type Stdlib::Compat::Hash = Hash[Any, Any] -- cgit v1.2.3 From 496d19640cc239f59e456c381bd9912cde60a07e Mon Sep 17 00:00:00 2001 From: Peter Souter Date: Fri, 3 Mar 2017 11:43:12 +0000 Subject: (MODULES-4485) Improve ipv6 support for type * Improves regex to catch some valid (but less known) ipv6 strings, mostly those which are a mix of ipv6 strings and embedded ipv4 numbers * Regex inspired by the following: * https://github.com/sindresorhus/ip-regex * https://gist.github.com/cpetschnig/294476 * The original Dartware forum thread where someone originally created this beast of a regex, now lost except to archive.org * Whilst we're here, we can add the more tricky ipv6 strings to the existing functions to validate * Luckily, the `ipaddr` native ruby library used in the original functions already supports these --- types/compat/ipv6.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'types') diff --git a/types/compat/ipv6.pp b/types/compat/ipv6.pp index 18b148d..8b82f1a 100644 --- a/types/compat/ipv6.pp +++ b/types/compat/ipv6.pp @@ -1 +1 @@ -type Stdlib::Compat::Ipv6 = Pattern[/^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|((?:[\da-f]{1,4}:){6})(\d+)\.(\d+)\.(\d+)\.(\d+))$/] +type Stdlib::Compat::Ipv6 = Pattern[/\s*((([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}))|:)))(%.+)?\s*$/] -- cgit v1.2.3 From 0bca13947be9f55b7456cc78e2ba979bd7aa1c8c Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Wed, 15 Mar 2017 10:24:00 +0000 Subject: Permit double slash in absolute/Unix path types --- types/unixpath.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'types') diff --git a/types/unixpath.pp b/types/unixpath.pp index 76f2c17..ec3bf7d 100644 --- a/types/unixpath.pp +++ b/types/unixpath.pp @@ -1,2 +1,2 @@ # this regex rejects any path component that is a / or a NUL -type Stdlib::Unixpath = Pattern[/^\/([^\/\0]+(\/)?)+$/] +type Stdlib::Unixpath = Pattern[/^\/([^\/\0]+\/*)+$/] -- cgit v1.2.3 From c9370f4e3ae97b1e752713102a98af2979b1e9be Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 15 Jul 2017 11:21:08 +0200 Subject: add type for MAC address --- types/mac.pp | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 types/mac.pp (limited to 'types') diff --git a/types/mac.pp b/types/mac.pp new file mode 100644 index 0000000..4103574 --- /dev/null +++ b/types/mac.pp @@ -0,0 +1,2 @@ +# A type for a MAC address +type Stdlib::MAC = Pattern[/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/] -- cgit v1.2.3 From 51c9dc52cf68fcb128c5324d3642620100a44d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kr=C3=B6ger?= Date: Thu, 31 Aug 2017 14:18:04 +0200 Subject: Allow root as valid UNIX path Since the purpose of this validation type is to check if the given parameter is a valid UNIX path it should also cover the root path "slash" since it might be possible that it is specified as a target directory. --- types/unixpath.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'types') diff --git a/types/unixpath.pp b/types/unixpath.pp index ec3bf7d..4cd6f01 100644 --- a/types/unixpath.pp +++ b/types/unixpath.pp @@ -1,2 +1,2 @@ # this regex rejects any path component that is a / or a NUL -type Stdlib::Unixpath = Pattern[/^\/([^\/\0]+\/*)+$/] +type Stdlib::Unixpath = Pattern[/^\/([^\/\0]+\/*)*$/] -- cgit v1.2.3