Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)

Paste

Pasted as Ruby by Brian Gallew ( 16 years ago )
# puppet/parser/functions/cprt_ssh_aliases.rb
module Puppet::Parser::Functions
  newfunction(:cprt_ssh_aliases, :type => :rvalue) do 
    bar = []
    fqdn = lookupvar('cprt_ipaddresses').downcase()
    lookupvar('cprt_ipaddresses').split(',').each { |ipaddr|
      addr = Socket.gethostbyname(ipaddr) # convert IP address to real thing
      tmp = Socket.gethostbyaddr(addr[3], addr[2])
      host = Socket.gethostbyaddr(tmp[3], tmp[2])
      #name = host[0].downcase()
      bar << ipaddr
      host[1].each { |h| bar << h unless h == fqdn }
    }
    return bar
  end
end

 

Revise this Paste

Your Name: Code Language: