Just like the error says, you're trying to do a recursive lookup and you can't do that. You're trying to do a lookup in a key named "my" which contains a lookup for a key named "my".
On Friday, March 18, 2022 at 9:05:13 AM UTC-7 michele...@gmail.com wrote: > Hi, I've got a problem with Hiera interpolation (lookups). I'm fairly new > to Hiera, so I think I am misunderstanding something important, but doc > searches revealed nothing so far. > > I'm using Puppet 7.x with the following hiera.yaml: > > # hiera.yaml > --- > version: 5 > hierarchy: > - name: "Per-node data" > path: "nodes/%{::trusted.certname}.yaml" > - name: "Per-subsystem data" > path: "subsystems/%{::subsystem}.yaml" > - name: "Common and fallback data" > path: "common.yaml" > > Basically, data should be searched first in the node-specific file, then > in a subsystem specific file, then in the common file (that is empty, so > far). > > (bare bones) Agent-specific file looks like this: > > # environments/test/data/nodes/agent1.yaml > --- > my: > net: > host: > ip_address: "%{lookup('my.net.hosts.agent1')}" > needs_proxy: false > > (you see that I use lookup interpolation, that's in order to avoid data > duplication). > The my.net.hosts.agent1 key is not part of this file, but is found in the > subsystem-specific > > yaml: > > # environments/test/data/subsystems/main.yaml > --- > my: > net: > hosts: > agent01: "192.168.56.6" > needs_proxy: true > > Per the hiera.yaml above it this comes later in the hierarchy. > > Unfortunately, the agent fails with the following error: > > Error: Could not retrieve catalog from remote server: Error 500 on SERVER: > Server Error: Lookup of key 'my.net.hosts.agent01' failed: Recursive lookup > detected in [my.net.needs_proxy, my.net.hosts.agent01] on node agent1 > > and I got no clue why that happens, as I can't see any obvious loops. > > Any help would be greatly appreciated. > > Thanks > Michele > -- 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/3b41512c-93d2-47a7-8cb4-6fc649b7dfb7n%40googlegroups.com.