Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
James T. Lee
Dotfiles
Compare Revisions
eb9138dfd74e652249ae80b48bdbdd311a1299a1...3e9545eeb2952fd3e859f993ad44185c3d4a8f52
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
81 additions
and
0 deletions
+81
-0
lib/puppet/stdlib/types/compat/hash.pp
lib/puppet/stdlib/types/compat/hash.pp
+2
-0
lib/puppet/stdlib/types/compat/integer.pp
lib/puppet/stdlib/types/compat/integer.pp
+23
-0
lib/puppet/stdlib/types/compat/ip_address.pp
lib/puppet/stdlib/types/compat/ip_address.pp
+1
-0
lib/puppet/stdlib/types/compat/ipv4.pp
lib/puppet/stdlib/types/compat/ipv4.pp
+2
-0
lib/puppet/stdlib/types/compat/ipv6.pp
lib/puppet/stdlib/types/compat/ipv6.pp
+1
-0
lib/puppet/stdlib/types/compat/numeric.pp
lib/puppet/stdlib/types/compat/numeric.pp
+23
-0
lib/puppet/stdlib/types/compat/re.pp
lib/puppet/stdlib/types/compat/re.pp
+3
-0
lib/puppet/stdlib/types/compat/string.pp
lib/puppet/stdlib/types/compat/string.pp
+2
-0
lib/puppet/stdlib/types/datasize.pp
lib/puppet/stdlib/types/datasize.pp
+1
-0
lib/puppet/stdlib/types/email.pp
lib/puppet/stdlib/types/email.pp
+2
-0
lib/puppet/stdlib/types/ensure/file.pp
lib/puppet/stdlib/types/ensure/file.pp
+1
-0
lib/puppet/stdlib/types/ensure/file/directory.pp
lib/puppet/stdlib/types/ensure/file/directory.pp
+1
-0
lib/puppet/stdlib/types/ensure/file/file.pp
lib/puppet/stdlib/types/ensure/file/file.pp
+1
-0
lib/puppet/stdlib/types/ensure/file/link.pp
lib/puppet/stdlib/types/ensure/file/link.pp
+1
-0
lib/puppet/stdlib/types/ensure/service.pp
lib/puppet/stdlib/types/ensure/service.pp
+1
-0
lib/puppet/stdlib/types/filemode.pp
lib/puppet/stdlib/types/filemode.pp
+4
-0
lib/puppet/stdlib/types/filesource.pp
lib/puppet/stdlib/types/filesource.pp
+9
-0
lib/puppet/stdlib/types/fqdn.pp
lib/puppet/stdlib/types/fqdn.pp
+1
-0
lib/puppet/stdlib/types/host.pp
lib/puppet/stdlib/types/host.pp
+1
-0
lib/puppet/stdlib/types/httpstatus.pp
lib/puppet/stdlib/types/httpstatus.pp
+1
-0
No files found.
lib/puppet/stdlib/types/compat/hash.pp
0 → 100644
View file @
3e9545ee
# Emulate the is_hash and validate_hash functions
type
Stdlib
::
Compat
::
Hash
=
Hash
[
Any
,
Any
]
lib/puppet/stdlib/types/compat/integer.pp
0 → 100644
View file @
3e9545ee
# Emulate the is_integer and validate_integer functions
# The regex is what's currently used in is_integer
# validate_numeric also allows range checking, which cannot be mapped to the string parsing inside the function.
# For full backwards compatibility, you will need to keep the validate_numeric call around to catch everything.
# To keep your development moving forward, you can also add a deprecation warning using the Integer type:
#
# ```class example($value) { validate_integer($value, 10, 0) }```
#
# would turn into
#
# ```
# class example(Stdlib::Compat::Integer $value) {
# validate_numeric($value, 10, 0)
# assert_type(Integer[0, 10], $value) |$expected, $actual| {
# warning("The 'value' parameter for the 'ntp' class has type ${actual}, but should be ${expected}.")
# }
# }
# ```
#
# > Note that you need to use Variant[Integer[0, 10], Float[0, 10]] if you want to match both integers and floating point numbers.
#
# This allows you to find all places where a consumers of your code call it with unexpected values.
type
Stdlib
::
Compat
::
Integer
=
Variant
[
Integer
,
Pattern
[
/
^
-
?
(
?
:(
?
:[
1
-
9
]
\
d
*
)|
0
)
$
/
],
Array
[
Variant
[
Integer
,
Pattern
[
/
^
-
?
(
?
:(
?
:[
1
-
9
]
\
d
*
)|
0
)
$
/
]]]]
# lint:ignore:140chars
lib/puppet/stdlib/types/compat/ip_address.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Compat
::
Ip_address
=
Variant
[
Stdlib
::
Compat
::
Ipv4
,
Stdlib
::
Compat
::
Ipv6
]
lib/puppet/stdlib/types/compat/ipv4.pp
0 → 100644
View file @
3e9545ee
# Emulate the validate_ipv4_address and is_ipv4_address functions
type
Stdlib
::
Compat
::
Ipv4
=
Pattern
[
/
^
((([
0
-
9
](
?
!
\
d
)|[
1
-
9
][
0
-
9
](
?
!
\
d
)|
1
[
0
-
9
]{
2
}(
?
!
\
d
)|
2
[
0
-
4
][
0
-
9
](
?
!
\
d
)|
25
[
0
-
5
](
?
!
\
d
))[
.
]){
3
}([
0
-
9
](
?
!
\
d
)|[
1
-
9
][
0
-
9
](
?
!
\
d
)|
1
[
0
-
9
]{
2
}(
?
!
\
d
)|
2
[
0
-
4
][
0
-
9
](
?
!
\
d
)|
25
[
0
-
5
](
?
!
\
d
)))(
\
/
((([
0
-
9
](
?
!
\
d
)|[
1
-
9
][
0
-
9
](
?
!
\
d
)|
1
[
0
-
9
]{
2
}(
?
!
\
d
)|
2
[
0
-
4
][
0
-
9
](
?
!
\
d
)|
25
[
0
-
5
](
?
!
\
d
))[
.
]){
3
}([
0
-
9
](
?
!
\
d
)|[
1
-
9
][
0
-
9
](
?
!
\
d
)|
1
[
0
-
9
]{
2
}(
?
!
\
d
)|
2
[
0
-
4
][
0
-
9
](
?
!
\
d
)|
25
[
0
-
5
](
?
!
\
d
))|[
0
-
9
]
+
))
?$
/
]
# lint:ignore:140chars
lib/puppet/stdlib/types/compat/ipv6.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Compat
::
Ipv6
=
Pattern
[
/
\
s
*
((([
0
-
9
A
-
Fa
-
f
]{
1
,
4
}:){
7
}([
0
-
9
A
-
Fa
-
f
]{
1
,
4
}|:))|(([
0
-
9
A
-
Fa
-
f
]{
1
,
4
}:){
6
}(:[
0
-
9
A
-
Fa
-
f
]{
1
,
4
}|((
25
[
0
-
5
]|
2
[
0
-
4
]
\
d
|
1
\
d
\
d
|[
1
-
9
]
?\
d
)(
\
.
(
25
[
0
-
5
]|
2
[
0
-
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}))|:))|(([
0
-
9
A
-
Fa
-
f
]{
1
,
4
}:){
1
}(((:[
0
-
9
A
-
Fa
-
f
]{
1
,
4
}){
1
,
6
})|((:[
0
-
9
A
-
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
-
9
A
-
Fa
-
f
]{
1
,
4
}){
1
,
7
})|((:[
0
-
9
A
-
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
*
$
/
]
# lint:ignore:140chars
lib/puppet/stdlib/types/compat/numeric.pp
0 → 100644
View file @
3e9545ee
# Emulate the is_numeric and validate_numeric functions
# The regex is what's currently used in is_numeric
# validate_numeric also allows range checking, which cannot be mapped to the string parsing inside the function.
# For full backwards compatibility, you will need to keep the validate_numeric call around to catch everything.
# To keep your development moving forward, you can also add a deprecation warning using the Integer type:
#
# ```class example($value) { validate_numeric($value, 10, 0) }```
#
# would turn into
#
# ```
# class example(Stdlib::Compat::Numeric $value) {
# validate_numeric($value, 10, 0)
# assert_type(Integer[0, 10], $value) |$expected, $actual| {
# warning("The 'value' parameter for the 'ntp' class has type ${actual}, but should be ${expected}.")
# }
# }
# ```
#
# > Note that you need to use Variant[Integer[0, 10], Float[0, 10]] if you want to match both integers and floating point numbers.
#
# This allows you to find all places where a consumers of your code call it with unexpected values.
type
Stdlib
::
Compat
::
Numeric
=
Variant
[
Numeric
,
Pattern
[
/
^
-
?
(
?
:(
?
:[
1
-
9
]
\
d
*
)|
0
)(
?
:
\
.
\
d
+
)
?
(
?
:[
eE
]
-
?\
d
+
)
?$
/
],
Array
[
Variant
[
Numeric
,
Pattern
[
/
^
-
?
(
?
:(
?
:[
1
-
9
]
\
d
*
)|
0
)(
?
:
\
.
\
d
+
)
?
(
?
:[
eE
]
-
?\
d
+
)
?$
/
]]]]
# lint:ignore:140chars
lib/puppet/stdlib/types/compat/re.pp
0 → 100644
View file @
3e9545ee
# 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.
lib/puppet/stdlib/types/compat/string.pp
0 → 100644
View file @
3e9545ee
# Emulate the is_string and validate_string functions
type
Stdlib
::
Compat
::
String
=
Optional
[
String
]
lib/puppet/stdlib/types/datasize.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Datasize
=
Pattern
[
/
^\
d
+
(
?
i
:[
kmgt
]
b
?
|
b
)
$
/
]
lib/puppet/stdlib/types/email.pp
0 → 100644
View file @
3e9545ee
# https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
type
Stdlib
::
Email
=
Pattern
[
/
\
A
[
a
-
zA
-
Z0
-
9
.!
#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/]
lib/puppet/stdlib/types/ensure/file.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Ensure
::
File
=
Enum
[
'present'
,
'file'
,
'directory'
,
'link'
,
'absent'
]
lib/puppet/stdlib/types/ensure/file/directory.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Ensure
::
File
::
Directory
=
Enum
[
'directory'
,
'absent'
]
lib/puppet/stdlib/types/ensure/file/file.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Ensure
::
File
::
File
=
Enum
[
'file'
,
'absent'
]
lib/puppet/stdlib/types/ensure/file/link.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Ensure
::
File
::
Link
=
Enum
[
'link'
,
'absent'
]
lib/puppet/stdlib/types/ensure/service.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Ensure
::
Service
=
Enum
[
'stopped'
,
'running'
]
lib/puppet/stdlib/types/filemode.pp
0 → 100644
View file @
3e9545ee
# See `man chmod.1` for the regular expression for symbolic mode
# lint:ignore:140chars
type
Stdlib
::
Filemode
=
Pattern
[
/
\
A
(([
0
-
7
]{
1
,
4
})|(([
ugoa
]
*
([
-+=
]([
rwxXst
]
*
|[
ugo
]))
+
|[
-+=
][
0
-
7
]
+
)(,([
ugoa
]
*
([
-+=
]([
rwxXst
]
*
|[
ugo
]))
+
|[
-+=
][
0
-
7
]
+
))
*
))
\
z
/
]
# lint:endignore
lib/puppet/stdlib/types/filesource.pp
0 → 100644
View file @
3e9545ee
# Validate the source parameter on file types
type
Stdlib
::
Filesource
=
Variant
[
Stdlib
::
Absolutepath
,
Stdlib
::
HTTPUrl
,
Pattern
[
/
\
Afile
:
\
/
\
/
\
/
([
^\
n
\
/
\
0
]
+
(
\
/
)
?
)
+
\
z
/
,
/
\A
puppet:
\/\/
(([
\w
-
]
+
\.
?
)
+
)
?
\/
([
^
\n\/\0
]
+
(
\/
)
?
)
+
\z
/
,
],
]
lib/puppet/stdlib/types/fqdn.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Fqdn
=
Pattern
[
/
\
A
(([
a
-
zA
-
Z0
-
9
]|[
a
-
zA
-
Z0
-
9
][
a
-
zA
-
Z0
-
9
\
-
]
*
[
a
-
zA
-
Z0
-
9
])
\
.
)
*
([
A
-
Za
-
z0
-
9
]|[
A
-
Za
-
z0
-
9
][
A
-
Za
-
z0
-
9
\
-
]
*
[
A
-
Za
-
z0
-
9
])
\
z
/
]
lib/puppet/stdlib/types/host.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
Host
=
Variant
[
Stdlib
::
Fqdn
,
Stdlib
::
Compat
::
Ip_address
]
lib/puppet/stdlib/types/httpstatus.pp
0 → 100644
View file @
3e9545ee
type
Stdlib
::
HttpStatus
=
Integer
[
100
,
599
]
Prev
1
…
9
10
11
12
13
14
15
Next