From 22fbe723acd22ae3491c41beeacbc76853c6820e Mon Sep 17 00:00:00 2001 From: tphoney Date: Mon, 8 Aug 2016 17:35:13 +0100 Subject: (modules-3532) deprecate string type checks --- types/compat/absolute_path.pp | 7 +++++++ types/compat/array.pp | 2 ++ types/compat/bool.pp | 2 ++ types/compat/re.pp | 3 +++ types/compat/string.pp | 2 ++ 5 files changed, 16 insertions(+) create mode 100644 types/compat/absolute_path.pp create mode 100644 types/compat/array.pp create mode 100644 types/compat/bool.pp create mode 100644 types/compat/re.pp create mode 100644 types/compat/string.pp (limited to 'types') diff --git a/types/compat/absolute_path.pp b/types/compat/absolute_path.pp new file mode 100644 index 0000000..d11784e --- /dev/null +++ b/types/compat/absolute_path.pp @@ -0,0 +1,7 @@ +# Emulate the is_absolute_path and validate_absolute_path functions +# +# The first pattern is originally from is_absolute_path, which had it from 2.7.x's lib/puppet/util.rb Puppet::Util.absolute_path? +# slash = '[\\\\/]' +# name = '[^\\\\/]+' +# %r!^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))!i, +type Stdlib::Compat::Absolute_path = Variant[Pattern[/^(([a-zA-Z]:[\\\/])|([\\\/][\\\/][^\\\/]+[\\\/][^\\\/]+)|([\\\/][\\\/]\?[\\\/][^\\\/]+))/], Pattern[/^\//]] diff --git a/types/compat/array.pp b/types/compat/array.pp new file mode 100644 index 0000000..ba65dc4 --- /dev/null +++ b/types/compat/array.pp @@ -0,0 +1,2 @@ +# Emulate the is_array and validate_array functions +type Stdlib::Compat::Array = Array[Any] diff --git a/types/compat/bool.pp b/types/compat/bool.pp new file mode 100644 index 0000000..dda5f4b --- /dev/null +++ b/types/compat/bool.pp @@ -0,0 +1,2 @@ + # Emulate the is_bool and validate_bool functions + type Stdlib::Compat::Bool = Boolean diff --git a/types/compat/re.pp b/types/compat/re.pp new file mode 100644 index 0000000..e4b5f30 --- /dev/null +++ b/types/compat/re.pp @@ -0,0 +1,3 @@ +# Emulate the validate_re function +# validate_re(value, re) translates to Pattern[re], which is not directly mappable as a type alias, but can be specified as Pattern[re]. +# Therefore this needs to be translated directly. diff --git a/types/compat/string.pp b/types/compat/string.pp new file mode 100644 index 0000000..4c36e5f --- /dev/null +++ b/types/compat/string.pp @@ -0,0 +1,2 @@ +# Emulate the is_string and validate_string functions +type Stdlib::Compat::String = String -- cgit v1.2.3