Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'ipaddr'
- module Puppet::Parser::Functions
- # args -> ['ip address', [['name', 'CIDR network', vlanid],...]]
- newfunction(:find_vlan_id, :type => :rvalue) do |args|
- subnet = args[1].select do |name, net, vlan|
- raise Puppet::ParseError, "2: " + name.to_s + "-" + net.to_s + "-" + vlan.to_s
- IPAddr.new(net) === args[0]
- end
- return subnet ? subnet[2] : nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement