Re: [Puppet Users] Question on searching for and using data inside a structured fact

2017-11-08 Thread R.I.Pienaar
nothing wrong with keys() but...

function uuid_for_partition($needle) {
  $uuid = $facts["partitions"].reduce() |$memo, $partition| {
$partition[1]["mount"] ? {
  $needle => $partition[0],
  default => $memo
}
  }
}

notice(uuid_for_partition("/boot"))


On Thu, Nov 9, 2017, at 00:54, Sean wrote:
> Hi,
> 
> I have been attempting (and failing miserably) at trying to obtain the
> UUID 
> of a partition mounted in a specific directory from the partitions fact.  
> I'm using puppet 4.10.8.
> 
> As an example, let's say I'm looking for the UUID of /boot on my
> systems...
> 
> $ facter partitions
> {"sda1"=>{"size"=>"1048576", "mount"=>"/boot/efi"}, 
> "sda2"=>{"uuid"=>"14528e73-61cc-4503-b24f-47c3b6e2aee2",
> "size"=>"1048576", 
> "mount"=>"/boot"},
> "sda3"=>{"uuid"=>"c0f0fa3e-b389-4814-ae8b-dec3b14816fb", 
> "size"=>"974673920"}}
> 
> I can successfully use the filter function to find the sda2 hash in
> puppet:
> 
> $x = $facts['partitions'].filter |$p,$d| { $d['mount' == '/boot' }
> $k = keys($x)
> $u = $x[k[0]]['uuid']
> notify { "$u": }
> 
> 
> This produces the desired resulting data, a string with the UUID, but it 
> requires using puppetlabs-stdlib's keys function.  So, is there a way to 
> accomplish this with native puppet alone?
> 
> Thanks you kindly.
> 
> -- 
> 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/fa9679ba-72a4-4ba2-8cbf-a1695cdefa8a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
R.I.Pienaar / www.devco.net / @ripienaar

-- 
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/1510213415.3457730.118944.2FE14A60%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Question on searching for and using data inside a structured fact

2017-11-08 Thread Sean
Hi,

I have been attempting (and failing miserably) at trying to obtain the UUID 
of a partition mounted in a specific directory from the partitions fact.  
I'm using puppet 4.10.8.

As an example, let's say I'm looking for the UUID of /boot on my systems...

$ facter partitions
{"sda1"=>{"size"=>"1048576", "mount"=>"/boot/efi"}, 
"sda2"=>{"uuid"=>"14528e73-61cc-4503-b24f-47c3b6e2aee2", "size"=>"1048576", 
"mount"=>"/boot"}, "sda3"=>{"uuid"=>"c0f0fa3e-b389-4814-ae8b-dec3b14816fb", 
"size"=>"974673920"}}

I can successfully use the filter function to find the sda2 hash in puppet:

$x = $facts['partitions'].filter |$p,$d| { $d['mount' == '/boot' }
$k = keys($x)
$u = $x[k[0]]['uuid']
notify { "$u": }


This produces the desired resulting data, a string with the UUID, but it 
requires using puppetlabs-stdlib's keys function.  So, is there a way to 
accomplish this with native puppet alone?

Thanks you kindly.

-- 
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/fa9679ba-72a4-4ba2-8cbf-a1695cdefa8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet 5 ENC parameters and facts missing from PuppetDB 5 facts

2017-11-08 Thread treydock
I just upgraded my Puppet masters and PuppetDB to latest Puppet 5 
releases.  All other systems remain Puppet 3.8.6.  I've discovered that the 
masters and puppetdb running puppet-agent 5.3.3 are no longer sending ENC 
(Foreman) parameters as facts to PuppetDB [1].  What's really odd is one of 
the parameters, hostgroup, is also put in /etc/facter/facts.d/facts.txt as 
a static external fact.  The value is returned by "facter hostgroup".  This 
value is no longer being sent to PuppetDB and this is only occurring for 
agents running 5.3.3, my 3.8.6 agents are still sending their hostgroup 
value as a fact to PuppetDB.  I also have custom ruby facts like 
hostgroup_parent that are based on the value of hostgroup and these are 
returned by facter but no longer exist in PuppetDB for puppet 5.x clients.  
This hostgroup_parent is also returned by my ENC as a parameter.  It's as 
if any facts that facter resolves and also exist in ENC as parameters are 
omitted from uploads to PuppetDB.

I ran puppet with debug on a 5.3.3 client and puppet is picking up the 
external facts and resolving the values, so something else must be removing 
the values before being sent to PuppetDB.

Is this behavior intentional?  I don't want to rewrite all my hostgroup 
based puppet code that queries from puppetdb if this is some kind of bug.

Thanks,
- Trey

[1]:

puppet-agent 5.3.3:

# curl  --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem  --cert 
/etc/puppetlabs/puppet/ssl/certs/$(hostname -f).pem  --key 
/etc/puppetlabs/puppet/ssl/private_keys/$(hostname -f).pem  --tlsv1  -X GET 
https://puppetdb.DOMAIN:8081/pdb/query/v4/facts  --data-urlencode 
'query=["and",["=", "certname", 
"puppet0. DOMAIN"],["=","name","hostgroup"]]'

[]

puppet 3.8.6:

# curl  --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem  --cert 
/etc/puppetlabs/puppet/ssl/certs/$(hostname -f).pem  --key 
/etc/puppetlabs/puppet/ssl/private_keys/$(hostname -f).pem  --tlsv1  -X GET 
https://puppetdb. DOMAIN:8081/pdb/query/v4/facts  --data-urlencode 
'query=["and",["=", "certname", "logs. DOMAIN"],["=","name","hostgroup"]]'

[{"certname":"logs.DOMAIN","name":"hostgroup","value":"base/infrastructure","environment":"production"}]

-- 
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/243ad315-1d91-452d-ae1d-7c47f6670e9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Unable to bootstrap modern Puppet-agent versions via cloud-config. How to set "certname=%i.%f"?

2017-11-08 Thread Martijn Heemels
Hmm, why didn’t I think of that. :D That should work fine for now. I’ll file a 
bug report at Launchpad.

Thanks, Martijn


-- 
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/E124DE8E-C628-45CC-9A86-0B94587EE310%40heemels.com.
For more options, visit https://groups.google.com/d/optout.


smime.p7s
Description: S/MIME cryptographic signature