[Puppet Users] Problems testing branching using rspec-puppet with hiera

2016-01-27 Thread jwilkicki
Hi all! I've been banging my head against this for the past couple of days and I'm pretty stuck. I've started implementing rspec tests for a class that uses a hiera lookup and then uses the looked up value to control part of its logic. A simplified version: class mytest { $myconditio

[Puppet Users] Custom type file access race conditions

2015-10-13 Thread jwilkicki
Hi! I'm working on a custom type for Java Util Preferences files. The files are XML and, unfortunately, aren't handled correctly by Augeas' XML lens. I'm using the nokogiri library to modify them, since that parser is more forgiving to some of the formatting errors that I have to deal with.

Re: [Puppet Users] validating array property in custom_type

2015-08-11 Thread jwilkicki
So, found another wrinkle in this: If the resource doesn't exist on the system yet, and I leave the servers attribute out, my validate doesn't catch it: mytype{'test type': # servers => ['server1','server2'] } That should fail the catalog compile since servers is required and it isn't set. My

Re: [Puppet Users] validating array property in custom_type

2015-08-11 Thread jwilkicki
Okay, so if I understand you right, validate gets called twice: once without the self hash initialized and once with it initialized. Seems weird, but I can follow that.So, I might want to do something like: if(self[:servers]) fail("Servers must be an array with at least one member") un

[Puppet Users] validating array property in custom_type

2015-08-07 Thread jwilkicki
Hi all! I'm having trouble with a custom type's type-wide validate call. I've done a lot of digging into the Puppet documentation and a lot of Googling and haven't found a lot of guidance. My Puppet version is 3.7.5. Basically, I have a property defined like this in my type: newproperty(:se

[Puppet Users] Strange problem with Puppet and package installation

2015-02-25 Thread jwilkicki
I've been scratching my head on this for days and I can't figure out my problem. I'm trying to do the basic design pattern of: package->config but with the config abstracted into a class since it has a few different components. I've gone through a few different attempts at this; the current

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-13 Thread jwilkicki
There's a lot of great design advice in here. Thank you for taking the time to write it up; I'll definitely do a deeper dive on this when I've solved my immediate problem and check this advice against some of the other rules I've written. I often find Puppet to be as much of a mind-bender as w

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-12 Thread jwilkicki
Well, I was thinking of doing a type similar to what xmlstarlet does, including being able to add and remove nodes. I don't really need the added behavior of adding and removing nodes from the file right now, so I left command as a future expansion parameter, but it basically only accepts 'rep

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-12 Thread jwilkicki
I did try to do that for another type I wrote and it was a mess. I ended up having a single namevar that required a particular format that my type then processed to get the parameters I needed. I'll take a look at your example; I'm sure I'll learn something from it. Maybe it's worth another

[Puppet Users] Allowing duplicate namevars in custom types

2015-02-11 Thread jwilkicki
Hi all! I'm working on a custom type that applies xpaths to files. I expect the interface to look something like: xpath { "some update": xpath => "/some/xpath", command => "replace", value => "newvalue", file => "/path/to/file.xml" } I'm having a little trouble picking

[Puppet Users] Re: Vagrant, puppet, augeas path expression problem

2014-05-16 Thread jwilkicki
That's good info! I wasn't entirely sure how Augeas handled each statement in the changes block, so I did initially try chaining multiple statements with Puppet ordering to make sure. I'll give this a shot and see what happens. On Thursday, May 15, 2014 1:02:02 PM UTC-4, David Lutterkort wrot

[Puppet Users] Vagrant, puppet, augeas path expression problem

2014-05-14 Thread jwilkicki
Hi! I'm trying to update /etc/ssh/sshd_config on a Vagrant vm using the puppet provider. When I do: ins PermitRootLogin after /files/etc/ssh/sshd_config/#comment[. = 'PermitRootLogin yes'] in augtool, it works fine. But nothing I try in my puppet rules works. I've tried a few variants, inc