Hi folks,

Yesterday we migrated wholesale from Puppet 3.8 to Puppet Enterprise 2016.5 and we're having horrendous problems with Hiera. The fault is partly ours because our Hiera data is old and not properly organised (it doesn't use automatic parameter lookup everywhere).

In Puppet 3, we were using the hiera() function everywhere in the manifests. I've rewritten them using lookup() but I can't get the behaviour I want.

One of our modules looks in Hiera for various types of networking config and then passes them to razorsedge/network using create_resources.

It seems to work when the objects exist in Hiera but fails when the object does not exist (e.g. because not all our servers have network::bond::static interfaces). The following code fails at line 3, even though I've set a default value.

    $bondslaves = lookup('network::bond::slave')
    $bondmasters = lookup('network::bond::static')
$staticifs = lookup({"name" => "::network::if::static", "value_type" => "hash", "default_value" => "default"})
    $routes = lookup('network::route')

    # Now create the resources
    if is_hash($bondslaves) {
      create_resources('network::bond::slave', $bondslaves)
    }
    if is_hash($bondmasters) {
      create_resources('network::bond::static', $bondmasters)
    }
    if is_hash($staticifs) {
      create_resources('network::if::static', $staticifs)
    }
    if is_hash($routes) {
      create_resources('network::route', $routes)
    }

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Function lookup() did not find a value for the name 'network::if::static' on node xxx.bris.ac.uk

I appreciate that we're doing it an odd way, and rewriting our module data is on the roadmap for modernising. However, can someone please help me get this up and running as-is with as few changes as possible? We are currently without a functioning puppetserver.

Thanks,
Jonathan

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3de003ac-0b8f-04a2-7978-f9ae154be6c0%40bristol.ac.uk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to