Running 2.7.14 both on the client and server.

I've created a defined type for managing network interface IPs and static
routes. The routes are passed in as an array of hashes. I used the empty()
function to see if the array is empty before attempting to call another
defined type to write out the files for managing static routes. Whenever I
try to apply this on the client, I receive the following error:

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]
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

The same error appears on the server.

Relevant code is below:

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
        }
    }
}

--dlloyd

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to