File tree 5 files changed +133
-0
lines changed
5 files changed +133
-0
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,58 @@ Unacceptable input example:
413
413
/usr2/username/bin:/usr/local/bin:/usr/bin:.
414
414
` ` `
415
415
416
+ # ### `Stdlib::Fqdn`
417
+
418
+ Matches paths on fully quallified domain name
419
+
420
+ Acceptable input example:
421
+
422
+ ` ` ` shell
423
+ localhost
424
+
425
+ example.com
426
+
427
+ www.example.com
428
+ ` ` `
429
+
430
+ Unacceptable input example:
431
+
432
+ ` ` ` shell
433
+ ' www www.example.com'
434
+
435
+ 2001:DB8::1
436
+ ` ` `
437
+
438
+ # ### `Stdlib::Host`
439
+
440
+ Matches a valid host which could be a valid ipv4, ipv6 or fqdn
441
+
442
+ Acceptable input example:
443
+
444
+ ` ` ` shell
445
+ localhost
446
+
447
+ example.com
448
+
449
+ www.example.com
450
+
451
+ 2001:0db8::1
452
+
453
+ 192.0.2.1
454
+ ` ` `
455
+
456
+ Unacceptable input example:
457
+
458
+ ` ` ` shell
459
+ ' www www.example.com'
460
+
461
+ 2001:0d8
462
+
463
+ %.example.com
464
+
465
+
466
+ ` ` `
467
+
416
468
# ## Facts
417
469
418
470
# ### `package_provider`
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4
+ describe 'Stdlib::Fqdn' do
5
+ describe 'valid handling' do
6
+ %w[
7
+ example
8
+ example.com
9
+ www.example.com
10
+ ] . each do |value |
11
+ describe value . inspect do
12
+ it { is_expected . to allow_value ( value ) }
13
+ end
14
+ end
15
+ end
16
+
17
+ describe 'invalid path handling' do
18
+ context 'garbage inputs' do
19
+ [
20
+ [ nil ] ,
21
+ [ nil , nil ] ,
22
+ { 'foo' => 'bar' } ,
23
+ { } ,
24
+ '' ,
25
+ '2001:DB8::1' ,
26
+ 'www www.example.com' ,
27
+ ] . each do |value |
28
+ describe value . inspect do
29
+ it { is_expected . not_to allow_value ( value ) }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4
+ describe 'Stdlib::Host' do
5
+ describe 'valid handling' do
6
+ %w[
7
+ example
8
+ example.com
9
+ www.example.com
10
+ 2001:0db8:85a3:0000:0000:8a2e:0370:7334
11
+ fa76:8765:34ac:0823:ab76:eee9:0987:1111
12
+ 2001:0db8::1
13
+ 224.0.0.0
14
+ 255.255.255.255
15
+ 0.0.0.0
16
+ 192.88.99.0
17
+ ] . each do |value |
18
+ describe value . inspect do
19
+ it { is_expected . to allow_value ( value ) }
20
+ end
21
+ end
22
+ end
23
+
24
+ describe 'invalid handling' do
25
+ context 'garbage inputs' do
26
+ [
27
+ [ nil ] ,
28
+ [ nil , nil ] ,
29
+ { 'foo' => 'bar' } ,
30
+ { } ,
31
+ '' ,
32
+ 'www www.example.com' ,
33
+
34
+ '%.example.com' ,
35
+ '2001:0d8' ,
36
+ ] . each do |value |
37
+ describe value . inspect do
38
+ it { is_expected . not_to allow_value ( value ) }
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
Original file line number Diff line number Diff line change
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])$/]
Original file line number Diff line number Diff line change
1
+ type Stdlib::Host = Variant[Stdlib::Fqdn, Stdlib::Compat::Ip_address]
You can’t perform that action at this time.
0 commit comments