Dave Lloyd
2012-Jul-13 14:47 UTC
[Puppet Users] empty() function in stdlib not functional?
I''m using the empty function to test whether an array passed to my defined type is empty (it''s a function to set up network interfaces and their routes if passed an array of routes). Unfortunately, I get this error when trying to use the empty() function: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Function ''empty'' does not return a value at /etc/puppet/ modules/netif/manifests/init.pp:78 on node [REDACTED]t warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run Relevant code snippet is here: define netif::interface ( $ifaddr = "", $slaves = [] , $onboot "yes", $onparent = "yes" , $mtu = "" , $routes = undef) { # switch on interface name case $name { # catch alias first since it might match other stuff /^.*:.*$/ : { netif::alias { $name : ifaddr => $ifaddr , } } # regular ethernet interface. /^eth\d+$/ : { netif::eth { $name : ifaddr => $ifaddr , } } # vlan ethernet interface. /^eth\d+\.\d+$/ : { netif::eth_vlan { $name : ifaddr => $ifaddr , } } # regular ib interface. /^ib\d+$/ : { netif::ib { $name : ifaddr => $ifaddr , } } # partitioned ib interface. /^ib\d+\.\d+$/ : { netif::ib_pkey { $name : ifaddr => $ifaddr , } } # bridge interface /^br\d+$/ : { netif::br { $name : ifaddr => $ifaddr , slaves => $slaves , } } # tap interface /^tap\d+$/ : { netif::tap { $name : ifaddr => $ifaddr , } } # default case do nothing default : { notify {"netif: interface type ${name} not found.":} } } # make route file if !empty($routes) { netif::route { $name : routes => $routes } } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.