Re: [Puppet Users] Hiera behaviour in PE 2016.5

2017-01-10 Thread Rob Nelson
On Tue, Jan 10, 2017 at 5:17 AM, Jonathan Gazeley <
jonathan.gaze...@bristol.ac.uk> wrote:

> $staticifs = lookup({"name" => "::network::if::static", "value_type" =>
> "hash", "default_value" => "default"})


The failure implies that it cannot find a value for `network::if::static`
but your request is for `::network::if::static`. It may be trying to
normalize it and failing in an unexpectedly fatal manner; I'd try without
the `::` prepend (even if that's not the actual fix, it's the right format
for the request). It could also be confused between "hash" and 'Hash' which
is the actual type name. Finally, your default value is a String rather
than a Hash, not sure if it would explicitly complain about that when
falling back to the default or just decide it failed and give you that 'did
not find a value' result.

You could also try rewriting your query as `lookup('network::if::static',
Hash, unique, {default => true})` (or whatever you want your default hash
to look like) to clarify that the hash format isn't causing any issues or
confusion.

Since you are without a functioning puppetserver, you may want to get on
irc or slack for some realtime assistance.

Rob Nelson
rnels...@gmail.com

-- 
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/CAC76iT9%2BNHZeOVNdWMQHm7RS7MZtLiX1Z3%2BZJx4D9c%2BF-EGxzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Hiera behaviour in PE 2016.5

2017-01-10 Thread Jonathan Gazeley

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.