Puppet Function: validate_tunnel_id_ranges
- Defined in:
-
lib/puppet/parser/functions/validate_tunnel_id_ranges.rb
- Function type:
- Ruby 3.x API
Overview
validate_tunnel_id_ranges() ⇒ Any
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/puppet/parser/functions/validate_tunnel_id_ranges.rb', line 23
newfunction(:validate_tunnel_id_ranges) do |args|
value = args[0]
if not value.kind_of?(Array)
value = [value]
end
value.each do |range|
if m = /^(\d+):(\d+)$/.match(range)
first_id = Integer(m[1])
second_id = Integer(m[2])
if ((second_id - first_id) > 1000000)
raise Puppet::Error, "tunnel id ranges are to large."
end
if ((second_id - first_id) < 0 )
raise Puppet::Error, "tunnel id ranges are invalid."
end
elsif range
raise Puppet::Error, "tunnel id ranges are invalid."
end
end
end
|