puppet lookup in an apply settings

62 views
Skip to first unread message

R.I.Pienaar

unread,
Nov 19, 2015, 12:38:19 PM11/19/15
to puppet-users
hello,

Does anyone know if puppet lookup is supposed to work in a non master
based setup?

Running puppet lookup --node some.node some::key results in messages about

Warning: Host is missing hostname and/or domain: some.node

This is as seen in https://tickets.puppetlabs.com/browse/PUP-5519 and it
appears to me that it just does not work well in an apply based environment

Is this supposed to work or a known issue at the moment?

---
R.I.Pienaar

Fraser Goffin

unread,
Nov 20, 2015, 3:56:40 PM11/20/15
to Puppet Users
Gave it a shot tonight with a masterless Puppet set up and it appears to work ok (just like your own module-data module)

metadata.json (note:data_provider)

{
 
"name": "goffinf-lookuptest",
 
"version": "0.1.0",
 
"author": "goffinf",
 
"summary": "Test of Puppet 4 lookup experimental feature",
 
"license": "Apache-2.0",
 
"source": "",
 
"project_page": null,
 
"issues_url": null,
 
"dependencies": [
   
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}
 
],
 
"data_provider": "hiera"
}

hiera.yaml (in the 'data' folder)

---
version
: 4
datadir
: data
hierarchy
:
- name: "common"
  backend
: yaml

common.yaml (in the 'data' folder)

lookuptest::foo: 'foo_from_COMMON'
lookuptest
::bar: 'bar_from_COMMON'

init.pp

class lookuptest {

 
# Test of Puppet 4 MODULE LEVEL Hiera lookup
 
  $foo
= lookup('lookuptest::foo')
 
  notice
('==================')
  notice
($foo)
  notice
('==================')

}

Output :

Notice: Scope(Class[Lookuptest]): ==================
Notice: Scope(Class[Lookuptest]): foo_from_COMMON
Notice: Scope(Class[Lookuptest]): ==================
Notice: Compiled catalog for lt6440.home in environment production in 0.34 seconds

HTHs

Fraser.

R.I.Pienaar

unread,
Nov 20, 2015, 4:00:16 PM11/20/15
to puppet-users
It works in the basic sense, but does not appear in my case to have
access to the node facts (ie. the node its being run on), particularly
fqdn etc, so the node specific tier isnt loaded.
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/5c6136a6-7378-45f8-841e-1a83b5d88374%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Henrik Lindberg

unread,
Nov 21, 2015, 11:08:41 AM11/21/15
to puppet...@googlegroups.com
On 2015-20-11 13:00, R.I.Pienaar wrote:
> It works in the basic sense, but does not appear in my case to have
> access to the node facts (ie. the node its being run on), particularly
> fqdn etc, so the node specific tier isnt loaded.
>
>

There are a couple of bugs reported regarding --node and --facts and the
lookup application. Our testing has primarily been master side, but
command should also work for masterless configuration - please report
issues in Jira if you find something not already reported.

- henrik
--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

R.I.Pienaar

unread,
Nov 21, 2015, 11:23:04 AM11/21/15
to puppet-users


----- Original Message -----
> From: "Henrik Lindberg" <henrik....@cloudsmith.com>
> To: "puppet-users" <puppet...@googlegroups.com>
> Sent: Saturday, November 21, 2015 4:08:00 PM
> Subject: Re: [Puppet Users] Re: puppet lookup in an apply settings

> On 2015-20-11 13:00, R.I.Pienaar wrote:
>> It works in the basic sense, but does not appear in my case to have
>> access to the node facts (ie. the node its being run on), particularly
>> fqdn etc, so the node specific tier isnt loaded.
>>
>>
>
> There are a couple of bugs reported regarding --node and --facts and the
> lookup application. Our testing has primarily been master side, but
> command should also work for masterless configuration - please report
> issues in Jira if you find something not already reported.

OK, will do was just checking if it was intended to work.

I am working on a few bugs that I found, one is proving to be very hard to
even reproduce in a simple case.

2 modules, if I include module 2 directly it works and does merges as per
the lookup_options but if module 1 includes module 2 it does not. So far
only happens with one complex code base, not been able to come up with a
test case to make a proper bug report :(

But the module data and lookup options are really good additions thanks
for that

Henrik Lindberg

unread,
Nov 21, 2015, 3:27:02 PM11/21/15
to puppet...@googlegroups.com
What do you mean by "module includes another module" ?

> But the module data and lookup options are really good additions thanks
> for that
>


R.I.Pienaar

unread,
Nov 21, 2015, 5:45:54 PM11/21/15
to puppet-users
s/module/class :)

So I have:

class users(Hash $local) {...}

class common { include users }

lookup_options configure $local for hash merging.

puppet apply -e 'include users' works fine - data merges fine
puppet apply -e 'include common' doesnt merge, does default first match strategy

but there's more to it than that, I cant find a simple example yet to reproduce
this only this giant code base I have which I cant share :(

will get to the bottom of it
Reply all
Reply to author
Forward
0 new messages