-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -413,6 +413,58 @@ Unacceptable input example: | |
/usr2/username/bin:/usr/local/bin:/usr/bin:. | ||
``` | ||
|
||
#### `Stdlib::Fqdn` | ||
|
||
Matches paths on fully quallified domain name | ||
|
||
Acceptable input example: | ||
|
||
```shell | ||
localhost | ||
example.com | ||
www.example.com | ||
``` | ||
|
||
Unacceptable input example: | ||
|
||
```shell | ||
'www www.example.com' | ||
2001:DB8::1 | ||
``` | ||
|
||
#### `Stdlib::Host` | ||
|
||
Matches a valid host which could be a valid ipv4, ipv6 or fqdn | ||
|
||
Acceptable input example: | ||
|
||
```shell | ||
localhost | ||
example.com | ||
www.example.com | ||
2001:0db8::1 | ||
192.0.2.1 | ||
``` | ||
|
||
Unacceptable input example: | ||
|
||
```shell | ||
'www www.example.com' | ||
2001:0d8 | ||
%.example.com | ||
[email protected] | ||
``` | ||
|
||
### Facts | ||
|
||
#### `package_provider` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'spec_helper' | ||
|
||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 | ||
describe 'Stdlib::Fqdn' do | ||
describe 'valid handling' do | ||
%w[ | ||
example | ||
example.com | ||
www.example.com | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.to allow_value(value) } | ||
end | ||
end | ||
end | ||
|
||
describe 'invalid path handling' do | ||
context 'garbage inputs' do | ||
[ | ||
[nil], | ||
[nil, nil], | ||
{ 'foo' => 'bar' }, | ||
{}, | ||
'', | ||
'2001:DB8::1', | ||
'www www.example.com', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.not_to allow_value(value) } | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'spec_helper' | ||
|
||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 | ||
describe 'Stdlib::Host' do | ||
describe 'valid handling' do | ||
%w[ | ||
example | ||
example.com | ||
www.example.com | ||
2001:0db8:85a3:0000:0000:8a2e:0370:7334 | ||
fa76:8765:34ac:0823:ab76:eee9:0987:1111 | ||
2001:0db8::1 | ||
224.0.0.0 | ||
255.255.255.255 | ||
0.0.0.0 | ||
192.88.99.0 | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.to allow_value(value) } | ||
end | ||
end | ||
end | ||
|
||
describe 'invalid handling' do | ||
context 'garbage inputs' do | ||
[ | ||
[nil], | ||
[nil, nil], | ||
{ 'foo' => 'bar' }, | ||
{}, | ||
'', | ||
'www www.example.com', | ||
'[email protected]', | ||
'%.example.com', | ||
'2001:0d8', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.not_to allow_value(value) } | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Stdlib::Fqdn = Pattern[/^(([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])$/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Stdlib::Host = Variant[Stdlib::Fqdn, Stdlib::Compat::Ip_address] |