Re: [Puppet Users] SSLv3 alert certificate unkown

2022-01-12 Thread Benjamin Ridley
I've had this happen to me before, and usually it was because there was
something more fundamental going wrong with the Puppet Server that was
causing connection issues, and the SSLv3 thing is just a red herring.

In our case, we ended up having CPU contention issues which was causing
really bad Puppet Server performance. One thing to try is to stop the
puppet service on all your managed nodes, and restart the puppet server.
Check if you can compile a catalog on a single node, or if you still get
the issue. If you no longer have the problem, it might be a performance
issue with your Puppet Server.

-- 
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/CABaapw%2BK3%3DDxBmLWMD%2Byc2hNoyqyvqwNQgPn_1-jFSEqm2G3%3Dw%40mail.gmail.com.


Re: [Puppet Users] Hiera lookup in hiera lookup

2021-05-18 Thread Benjamin Ridley
Hi Erwin and Martin,

I think there's a difference here - Erwin it seems you're trying to do
nested interpolation, while Martin it appears your example is for lookups
nested in hiera data.

Erwin as far as I'm aware, nested interpolation in the manner you suggest
is not possible. At least I've not been able to get it to work, and I found
this engineering ticket a while back:
https://tickets.puppetlabs.com/plugins/servlet/mobile#issue/HI-532

You can sometimes usually work around this by restructuring your hiera
data. In your example, perhaps you could have a prod.yaml and a test.yaml
file that each define their own env_hash, and then edit your hiera.yaml so
the node includes the correct file based on its environment (if you have
environment available as a fact)



On Tue, 18 May 2021, 6:38 pm Martin Alfke,  wrote:

> Hi Erwin,
>
> Nested lookups are possible.
>
> We did a blog post on this topic:
> https://blog.example42.com/2020/01/21/hiera-nested-lookups/
>
> Just be sure:
>
> A nested lookup (like in your example) always returns a string.
> If you need arrays or hashes within a nested lookup you must use the alias
> function.
>
> hth,
> Martin
>
> On 18. May 2021, at 10:23, Erwin Bogaard  wrote:
>
> Hi,
>
> I've been looking for this for a ling time, but can't find a definitive
> answer to my question: is it possible to use a lookup in a lookup?
>
> For example:
> aaa::bbb:
> "mvn:com.xxx.bus/xxx-features/%{lookup('xxx::apps::env_hash.%{lookup('xxx::apps::env')}.yyy.version')}/xml/features"
>
> Should lead to the following string:
> "mvn:com.xxx.bus/xxx-features/2.0.4/xml/features"
>
> If "xxx::apps::env" has the value 'test'.
> And "xxx::apps::env_hash.test.yyy.version" has the value '2.0.4'.
>
> The idea is that I would like one variable, "xxx::apps::env", make it
> possible to switch in a hash from the 'test'-branch to the 'prod'-branch,
> for example. Where each branch in that hash contains certain specified
> different versions and/or other variables.
>
> Thanks!
>
> --
> 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/5068271c-bac1-4beb-b097-91803dbf3e2en%40googlegroups.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/BFCDA3D6-80FA-4BFA-8E94-475F62A3A362%40gmail.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/CABaapwLzVjv40a6%3D6LtTwS1ABk45dWPfCJdy6hTn8oSQAaJNMA%40mail.gmail.com.


Re: [Puppet Users] init config once

2021-01-28 Thread Benjamin Ridley
You might be better off using something like Puppet Bolt to deploy the file
as a one off task at provisioning, rather than trying to manage it
declaratively through Puppet.

On Fri, 29 Jan 2021, 3:50 pm Steve McKuhr,  wrote:

> In an effort to avoid errors triggered by validate_cmd, I ended up using
> a conditional based on a File.exists custom fact. I'm still open to
> suggestions, this is all new territory to me.
>
>
> On Thu, 2021-01-28 at 17:13 -0800, Steve McKuhr wrote:
> > I've just realized that my problem statement was slightly misleading. A
> > 'users' file gets installed as part of the software package, and the
> > goal is replacing its contents during the first Puppet run. The next
> > Puppet runs should ignore any changes.
> >
> >
> > On Thu, 2021-01-28 at 20:07 +0100, Martin Alfke wrote:
> > > and please use ensure => file !
> > > this is more clear.
> > > you can set the file ensure attribute to one of the following: file,
> directory, link, absent
> > >
> > >
> > > > On 28. Jan 2021, at 18:58, Ben Ford  wrote:
> > > >
> > > > Yep, just use the replace attribute on the file resource.
> https://puppet.com/docs/puppet/latest/types/file.html#file-attribute-replace
> > > >
> > > > On Thu, Jan 28, 2021 at 9:57 AM Steve McKuhr 
> wrote:
> > > > I'd like to initialize a user config file once, at software install
> time, then allow application admins to manage the file contents via web
> interface (add/remove users, etc.) - I have come up with the following:
> > > >
> > > > file { 'users':
> > > >   ensure => present,
> > > >   content => template('my-template'),
> > > >   validate_cmd => '/bin/test ! -f users.control',
> > > > }
> > > > file { 'users.control':
> > > >   ensure => present,
> > > >   content => "puppet managed",
> > > >   require => File['users'],
> > > > }
> > > >
> > > > The above code works ok, however I was wondering if there is a more
> elegant solution.
> > > >
> > > > Thanks,
> > > > Steve
> > > >
> > > >
> > > > --
> > > > 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/fb1ae2b4-f220-4d18-864b-aafbadb44b14n%40googlegroups.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/CACkW_L5oTmsHiwvmVEisKap7gkUt1P4Gmvh1-%3DBQqNtHHiWAcA%40mail.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/7a518ea8c6214ea01e1ce3d6e76273ddfd576493.camel%40gmail.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/CABaapw%2B3od6HtGXb8bGMncUXZWuiZW46frSfL62S%3DgjyqcJimg%40mail.gmail.com.


Re: [Puppet Users] Is it possible to create an array of hashes

2020-08-26 Thread Benjamin Ridley
Hi Raghu,

Yes this is possible. Your example looks workable, but don't forget to add
commas after the values of the hash.

Check out Puppet's 'reduce' function, it iterates over data and allows you
to return a new structure after all the iteration which could be your new
hash. Alternatively it might be worth writing something in Ruby if Puppet's
immutable variables get in the way which may happen if you're heavily
modifying your hash.

On Thu, 27 Aug 2020, 3:45 am Raghu Ram Baisani, 
wrote:

> Hi Guys
>
> Some one help me solving this issue.
> *Example:*
> [
> {
> name => raghuram,
> age  => 22
> },
> {
> name => vinay
> age  => 25
> }
> ]
> the idea is to iterate through an existing hash and create new hash with
> some modifications and add it to array.
> Thanks in advance
>
> --
> 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/32ee1353-0cd3-47fa-af66-c3ef976dcdean%40googlegroups.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/CABaapwJ2geR_--STyK-CUc1OpUzK8zw3uPrBgHN2D%2BfswGPH%2BA%40mail.gmail.com.


Re: [Puppet Users] How to get value

2020-06-23 Thread Benjamin Ridley
Defined types values exist in a 'local scope' which is only accessible to
its child scopes, so there's no way to access these values using the method
you're using for class variables (which are inside a named scope).

On Tue, 23 Jun 2020, 8:15 pm Albert Shih,  wrote:

> Hi everyone,
>
> I use a lot of accessing a variables with
>
> class  'my_clas' (
>   String $var1,
>   String $var2,
>   )
>   {
>
> $path = "$var1/$var2"
>
> }
>
> After loading my_class
>
>   class { 'my_clas':
> var1 => 'something',
> var2 => 'otherthing',
> }
>
> than I access to those variables
>
>   $::my_class:var1
>   $::my_class:path
>
> Is it possible to do the same with define ? For example to do something
> like
>
> define my_script (
>   String $name,
>   )
>   {
>
>   $script_path = "/opt/local/bin/${name}",
>   }
>
>
> then
>
>   my_script { 'first':
> name => 'my_script'
> }
>
>   cron { 'first':
> command => $my_script::first::script_path
>   }
>
>   my_script { 'second':
> name => 'my_script_second'
> }
>
>   cron { 'second':
> command => $my_script::first_second::script_path
>   }
>
>
> Regards
>
>
> --
> Albert SHIH
> Observatoire de Paris
> xmpp: j...@obspm.fr
> Heure local/Local time:
> Tue 23 Jun 2020 12:08:05 PM CEST
>
> --
> 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/20200623101514.GA58073%40io.chezmoi.fr
> .
>

-- 
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/CABaapwLFQ%2BibV1xMNdhKvNoCD%2BiO0%3DsDwJDPGZmVdag%2BK9fdxg%40mail.gmail.com.


Re: [Puppet Users] Optional / mutually exclusive resource parameters with the Puppet Resource API

2019-12-05 Thread Benjamin Ridley
Thanks David, I ended up reimplementing with the low level API and just had
custom values for the ensure property. Thanks for the help though the
Variant method seems like an elegant solution to keep in mind.

Cheers,
Ben

On Thu, 5 Dec. 2019, 6:50 pm David Schmitt, 
wrote:

> Hi Ben,
>
> to avoid having server-side code, the Resource API doesn't have a way to
> validate complex restrictions like this at compile time. You can either
> collapse this into a single attribute of type `Variant[Boolean, String]` or
> adding the validation in the provider at the time
> `set`/`create`/`update`/`delete` get called. throwing an exception from
> those methods will tell puppet that the resource application failed and
> present the exception message to the user.
>
>
> Regards, David
>
> On Wed, 4 Dec 2019 at 16:34, Benjamin Ridley 
> wrote:
>
>> Hi all,
>>
>> I'm developing a resource that allows the declaration of keys in the Etcd
>> key value store.
>>
>> My type looks like this:
>>
>> Puppet::ResourceApi.register_type(
>>   name: 'etcd_key',
>>   docs: 'This type allows the management of etcd keys as Puppet
>> resources.',
>>   attributes: {
>> ensure: {
>>   type: 'Enum[present, absent]',
>>   desc: 'Whether the key should be present in the etcd structure.',
>>   default: 'present',
>> },
>> path: {
>>   type: 'String',
>>   desc: 'The path of the key you want to manage in the etcd
>> structure.',
>>   behaviour: :namevar,
>> },
>> directory: {
>>   type: 'Boolean',
>>   desc: 'Whether this key is a directory or not.',
>>   default: false,
>> },
>> value: {
>>   type: 'String',
>>   desc: 'The value of the key. Mutually exclusive if with
>> is_directory => true.',
>> },
>>   },
>> )
>>
>>
>> What I want to be able to do is make the value/directory parameters
>> mutually exclusive as a directory does not have a 'value' in etcd, and
>> similarly a key with a value cannot be a directory. Currently though,
>> Puppet complains that I'm excluding required parameters when I declare them.
>>
>> Is this possible with the resource API or do I need to use the low level
>> provider implementation?
>>
>> Thanks! Ben
>>
>> --
>> 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/5bb1535f-0c14-4aee-98f6-91fd7d68c4f7%40googlegroups.com
>> <https://groups.google.com/d/msgid/puppet-users/5bb1535f-0c14-4aee-98f6-91fd7d68c4f7%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CALF7fHabirW2qbHF%3DdVWytoyrcvyhNjJXt2jim3d17ndqjqrWw%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CALF7fHabirW2qbHF%3DdVWytoyrcvyhNjJXt2jim3d17ndqjqrWw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CABaapwJ12F%3D%2Bx4RxRCWXt6mXWJSMF4ErEz6ySGwuwU5poDsoEw%40mail.gmail.com.


[Puppet Users] Optional / mutually exclusive resource parameters with the Puppet Resource API

2019-12-04 Thread Benjamin Ridley
Hi all, 

I'm developing a resource that allows the declaration of keys in the Etcd 
key value store. 

My type looks like this:

Puppet::ResourceApi.register_type(
  name: 'etcd_key',
  docs: 'This type allows the management of etcd keys as Puppet resources.',
  attributes: {
ensure: {
  type: 'Enum[present, absent]',
  desc: 'Whether the key should be present in the etcd structure.',
  default: 'present',
},
path: {
  type: 'String',
  desc: 'The path of the key you want to manage in the etcd structure.',
  behaviour: :namevar,
},
directory: {
  type: 'Boolean',
  desc: 'Whether this key is a directory or not.',
  default: false,
},
value: {
  type: 'String',
  desc: 'The value of the key. Mutually exclusive if with is_directory 
=> true.',
},
  },
)


What I want to be able to do is make the value/directory parameters 
mutually exclusive as a directory does not have a 'value' in etcd, and 
similarly a key with a value cannot be a directory. Currently though, 
Puppet complains that I'm excluding required parameters when I declare them.

Is this possible with the resource API or do I need to use the low level 
provider implementation?

Thanks! Ben

-- 
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/5bb1535f-0c14-4aee-98f6-91fd7d68c4f7%40googlegroups.com.