Re: [Puppet Users] Count number of (collected) external resources

2014-09-25 Thread Frederik Wagner
Hi Yanis,

thanks for the hint. Sounds reasonable - I'll check it out!

Bye
Frederik

On Fri, Sep 26, 2014 at 5:33 AM, Yanis Guenane  wrote:
>
>
> On 09/25/2014 07:11 AM, Frederik Wagner wrote:
>> Hi group,
>>
>> is there a way to count the number of resources of a specific type
>> (with a specific tag) included in the catalog?
>>
>> In more detail:
>> In a manifest I collect external resources like:
>>External::Resource <<| tag == 'tagged_resource' |>>
>>
>> Now I would like to know how many resources are actually collected, so
>> I would like to have/write a function
>>$num_res =  count_resources( External::Resource, { 'tag' =>
>> 'tagged_resource' } )
>> to be used in the rest of the manifest.
>>
>> Is there a way to realize this in a custom function? I suppose there
>> is, but I'm missing the right API calls.
>>
>> Thanks a lot for any hints in the right direction.
>>
>> Bye
>> Frederik
>>
>
> Hi Frederik,
>
> I think that puppetdbquery[1] can do what you're looking for.
>
> Take a look a it,
>
> [1] https://forge.puppetlabs.com/dalen/puppetdbquery
>
> --
> Yanis Guenane
>
> --
> 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/5424DE88.80205%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CACBNCo%3Dypk%3DTXVUPsf8-NU5WEm9BNFm_u0dX%3DU%3DLrZttmCGQiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] puppetlabs-apache n00b question - docroot value for fully proxied virtual host?

2014-09-25 Thread Paul BH
Thanks for this guys; sorry I hadn't seen these responses till now...

I'd gladly do a PR, but what would be the situation when its not required? 
Is it if @proxy_dest or @proxy_pass are set?

Secondly; my setup (running a jenkins box behind apache) also needs these 
directives set:

AllowEncodedSlashes NoDecode

and ProxyPass with the option nocanon:

ProxyPass / http://localhost:8080/ nocanon

Should I just add these to the same PR?



On Wednesday, September 17, 2014 1:08:30 PM UTC-4, Neil - Puppet List wrote:
>
> Set it to /dev/null ?
> On 17 Sep 2014 17:53, "Hunter Haugen" > 
> wrote:
>
>> Yeah, basically `$docroot` is still a required parameter because 
>> historically it was required (apache::vhost didn't do proxy stuff) and was 
>> never updated. If you want to make a PR that makes it default to `undef` 
>> and then raises helpful errors in cases when it is needed, then that would 
>> be great :).
>>
>>
>>
>> -Hunter
>>
>> On Tue, Sep 16, 2014 at 4:49 AM, Antoine Cotten > > wrote:
>>
>>> Unfortunately you can't. This is a restriction of Apache, which requires 
>>> a docroot value for every vhost, and not of Puppet.
>>>
>>> --
>>> 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/8c6a00ee-3cb6-4193-936a-6acc771142ba%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  -- 
>> 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/CAJaQvGDqJ%2BLnPmcXcz5Uv5iFgK63RawwVo8sdTr%2BX%3DQcVguiBw%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/89cbbd86-cfb9-4b9d-8971-923d410d241f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Count number of (collected) external resources

2014-09-25 Thread Yanis Guenane


On 09/25/2014 07:11 AM, Frederik Wagner wrote:
> Hi group,
> 
> is there a way to count the number of resources of a specific type
> (with a specific tag) included in the catalog?
> 
> In more detail:
> In a manifest I collect external resources like:
>External::Resource <<| tag == 'tagged_resource' |>>
> 
> Now I would like to know how many resources are actually collected, so
> I would like to have/write a function
>$num_res =  count_resources( External::Resource, { 'tag' =>
> 'tagged_resource' } )
> to be used in the rest of the manifest.
> 
> Is there a way to realize this in a custom function? I suppose there
> is, but I'm missing the right API calls.
> 
> Thanks a lot for any hints in the right direction.
> 
> Bye
> Frederik
> 

Hi Frederik,

I think that puppetdbquery[1] can do what you're looking for.

Take a look a it,

[1] https://forge.puppetlabs.com/dalen/puppetdbquery

--
Yanis Guenane

-- 
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/5424DE88.80205%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Announce: Puppet Server 0.2.0

2014-09-25 Thread Deepak Giridharagopal
On Thu, Sep 25, 2014 at 1:32 PM, Andy Parker  wrote:

> "Puppet apply" will be sticking around. The exact way in which it will
> work isn't completely clear yet. There are several possibilities from
> requiring the jvm on all nodes that run puppet apply to changing apply to
> use a "compile server" to actually run manifests or possibly reimplementing
> the interpreter in a non-jvm language and using JNI to make it available on
> the puppet-server. My currently leaning is to implement the language in a
> jvm language and requiring that a masterless setup has the jvm on the node.
>

Heh...I'm leaning more towards the native code route, but this is
definitely something we should work out on the puppet-dev list before we
actually proceed down a path. Regardless, in the meantime "apply" will work
how it always has.

deepak

--
Deepak Giridharagopal / Puppet Labs

-- 
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/CAOjOXY0h6dK3DMYqPjPhYXbh8ta3%2B5cAbvaOU7%2BE0BsCV4FqPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Announce: Puppet Server 0.2.0

2014-09-25 Thread Andy Parker
On Tue, Sep 23, 2014 at 1:30 PM, Matt Zagrabelny  wrote:

> On Tue, Sep 23, 2014 at 2:03 PM, Gabriel Filion 
> wrote:
> > On 23/09/14 12:11 PM, Nate Wolfe wrote:
> >> We are thrilled to announce the preview release of Puppet Server, our
> >> newest open source project.
> >> Puppet Server is a next-generation alternative to our current Puppet
> >> master, which builds on the
> >> successful Clojure technology stack underlying projects like PuppetDB.
> >
> > so... is it the long term goal to phase out the ruby-based puppet master
> > when the clojure-based one is mature enough?
>
> Hopefully someone closer to the situation (and with more authority)
> will respond, but "yes" that is what I was told at a Puppet training
> in March.
>
>
The language will remain in ruby for a while yet (the puppet-server uses
JRuby to run the puppet ruby code), and even after the interpreter gets
reimplemented in a faster language, ruby will be available for extensions.
It would simply be too much of a change to drop ruby and drop all of the
custom code and extensions that everyone has worked so hard on.

What *might* be happening very soon is dropping rack and webrick support
and moving entirely to the puppet-server. It provides a much simpler setup,
better performance, and more controlled environment for us to target.

"Puppet apply" will be sticking around. The exact way in which it will work
isn't completely clear yet. There are several possibilities from requiring
the jvm on all nodes that run puppet apply to changing apply to use a
"compile server" to actually run manifests or possibly reimplementing the
interpreter in a non-jvm language and using JNI to make it available on the
puppet-server. My currently leaning is to implement the language in a jvm
language and requiring that a masterless setup has the jvm on the node.


-m
>
> --
> 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/CAOLfK3W6zzYtDFEVi_BE85WHbVZ-pf9qppANDOudG8SogdXSUA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andrew Parker
a...@puppetlabs.com
Freenode: zaphod42
Twitter: @aparker42
Software Developer

*Join us at **PuppetConf 2014, **September 20-24 in San Francisco - *
www.puppetconf.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/CANhgQXv9Q5wvu7ZSP%3DDL9dnJ9PV0nuWHdR0o6JtAnQe2EQ3JpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Announce: Puppet Server 0.2.0

2014-09-25 Thread Pete Brown
I got to test it in one of my dev environments while I was at
Puppetconf and it was pretty awesome.
Looking forward to having the time to add it as an option to my puppet
management module.
I am intending on running it in my dev environment to help out with testing.


On 23 September 2014 13:30, Trevor Vaughan  wrote:
> Hi Gabriel,
>
> From the recent PuppetConf talk on Puppet Server, the goal appears to be to
> move this way. However, many things need to be worked out. Not the least of
> which is how 'puppet apply' and msterless is going to work.
>
> The speed improvements and smaller resource usage appear quite impressive,
> but we'll see how things go as we move forward.
>
> (I'm sure I'll get corrected if I'm getting the details wrong anywhere, but
> the Puppet Labs folks are pretty busy today ;-)
>
> Thanks,
>
> Trevor
>
> On Tue, Sep 23, 2014 at 3:03 PM, Gabriel Filion  wrote:
>>
>> On 23/09/14 12:11 PM, Nate Wolfe wrote:
>> > We are thrilled to announce the preview release of Puppet Server, our
>> > newest open source project.
>> > Puppet Server is a next-generation alternative to our current Puppet
>> > master, which builds on the
>> > successful Clojure technology stack underlying projects like PuppetDB.
>>
>> so... is it the long term goal to phase out the ruby-based puppet master
>> when the clojure-based one is mature enough?
>>
>> --
>> Gabriel Filion
>>
>
>
>
> --
> Trevor Vaughan
> Vice President, Onyx Point, Inc
> (410) 541-6699
> tvaug...@onyxpoint.com
>
> -- This account not approved for unencrypted proprietary information --
>
> --
> 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/CANs%2BFoVXKd%2B9VE7H2L9RJLBZOuCeDTKBmpgD%3DYFhSASve4k-jA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Pete Brown
Director and Primary Systems Engineer
Abstract IT Pty Ltd.

-- 
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/CAM8R_x-q6kKbwS5dL_Vmyeu5c%3DZWo9fBMQJUWXb-trGe3V3Hvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Puppet 3.7.1 parse problems with resource overrides.

2014-09-25 Thread Andy Parker
On Mon, Sep 22, 2014 at 12:10 PM, Tristan Smith 
wrote:

> One more, mostly just a 'wouldn't it be nice if this were clearly
> handled?' Having a comma at the end of an assignment like the below appears
> to cause confusion; mostly at this point my gripe is that the error line is
> reported as the enclosing class/define/whatever instead of at the line with
> the errant comma.
>
> puppet parser validate --parser=future init.pp
> Error: Could not parse for environment production: This Array Expression
> is not productive. A Host Class Definition can not end with a non
> productive construct at init.pp:1:1
>
> class a {
>
>   $foo = "bar",
>   $banana = "apple"
>
> }
>
>
> On Monday, September 22, 2014 11:48:20 AM UTC-7, Tristan Smith wrote:
>>
>> So, new behavior that I'm not sure is intentional. File['blah'] works
>> fine, File ['blah'] is now illegal - the additional whitespace causes the
>> below stupendously readable error on puppet parser validate.
>>
>> Error: Could not parse for environment production: Expression is not
>> valid as a resource, resource-default, or resource-override at (slice ()
>> 'file'):(slice () 'line'):(slice ([] (cat '' (str $myvar) '')) 'pos')
>>
>> Is this a known bug I've failed to find on the ticket system, or intended
>> behavior I've just missed in the notes? If not, I'll go chase it as a bug.
>>
>
Tristan, both of those are correct errors. The space between the "File" and
the "['blah']" is an error because it makes it ambiguous about what was
intended. This happens because puppet doesn't require any statement
terminators (a semicolon in a lot of languages serves this purpose). So
this is ambiguous about whether you meant to have an expression of the File
type followed by creating an array or if you meant the File type
parameterized with the title 'blah', both could be valid.

In both of the cases that you have here, that error message is pretty
atrocious. The one with "slice" in it looks like it is dumping out some
sort of AST structures for some reason in the location slot of the message.
The error about the "non-productive construct" is a little trickier since
the error is about the class, but is caused by the comma. I think you are
right that it should show the location of the comma rather than the class.

Can you file both of these as bugs in the PUP project and include what
version of puppet you are using?

>  --
> 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/27b39605-a929-4271-8a4b-b693337b7207%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andrew Parker
a...@puppetlabs.com
Freenode: zaphod42
Twitter: @aparker42
Software Developer

*Join us at **PuppetConf 2014, **September 20-24 in San Francisco - *
www.puppetconf.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/CANhgQXsDUBNAVUso_d4yWO_diBMXEgwwhvP-1aLaEijzzYaPhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Can Exec notify File?

2014-09-25 Thread Christopher Wood
Not possible in the way you've phrased it. If you're trying to only manage a 
file if something is or is not true you might look into custom facts.

https://docs.puppetlabs.com/facter/2.2/custom_facts.html

Then you do something like:

if $::myfact == 'yes' {
  file { '/path/to/file':
content => "exists\n",
  }
}

On Thu, Sep 25, 2014 at 11:06:06AM -0700, Ellick Johnson wrote:
>I need to have an Exec command notify a File block only to run if the Exec
>is true. Is that possible?
>  exec { "check_version":
>    command => "/bin/echo 'versions differ'",
>    unless  => "/usr/bin/test `/bin/cat VERSION.txt` = \"1.0\"",
>    notify  => File["/app_dir"],
>  }
>  # create app_dir only if versions differ
>  file { /app_dir:
>    recurse   => true,
>    require   => [Exec["check_version"],
>    source    => "puppet:///modules/app/versions/1.0",
>    subscribe => Exec["check_version"],
>  }
>Is this possible?
> 
>--
>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 [1]puppet-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>
> [2]https://groups.google.com/d/msgid/puppet-users/f00e9418-663d-4359-ac60-f28edb0d77b1%40googlegroups.com.
>For more options, visit [3]https://groups.google.com/d/optout.
> 
> References
> 
>Visible links
>1. mailto:puppet-users+unsubscr...@googlegroups.com
>2. 
> https://groups.google.com/d/msgid/puppet-users/f00e9418-663d-4359-ac60-f28edb0d77b1%40googlegroups.com?utm_medium=email&utm_source=footer
>3. https://groups.google.com/d/optout

-- 
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/20140925180932.GB4533%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Manage a single file (directory) from multiple modules

2014-09-25 Thread aarb000
John,

I got it to work with the array.  I had to remove the base class in your 
code otherwise that folder gets declared multiple times.  After I did that, 
it pretty much worked as expected.

I like the idea of the loop and looked up future parser.  I couldn't find 
any examples that I was comfortable with so again, the array is great for 
now.  I will revisit this thread when I have a better grasp of puppet 
overall as I feel you gave great advice and examples that for right now I 
am just not getting.  Thanks for your patience with me on this as I learned 
a lot in the process. 

On Thursday, September 25, 2014 8:49:20 AM UTC-5, jcbollinger wrote:
>
>
>
> On Wednesday, September 24, 2014 2:38:40 PM UTC-5, aar...@gmail.com wrote:
>>
>> Neil and John,
>>
>> You guys both agree on using individual files and I was thinking of how I 
>> could do this.  If I have one file or three, it may not be a big deal to do 
>> individually, but some applications could need dozens or more.  
>>
>> I don't know if it is possible, some searching makes me believe it isn't, 
>> but I'll share my thought.
>>
>> Can you do something like a for loop in a bash script.  So it would be 
>> something like...
>>
>
>
> You can if you turn on the future parser, but there's an old-school way to 
> approach the problem that might actually be better in your case, because it 
> would be reusable across multiple application modules.  The old-school way 
> revolves around Puppet's behavior when an array is provided as a resource 
> title 
> ,
>  
> which is to declare a separate resource for each element of the array.  
> When the declared resource is of a defined type, it's body is evaluated 
> once for each title, which yields a pretty good analog of iteration.  
> Example:
>
> define my_module::mac_preference_file ($application) {
>   include my_module::mac_preferences_base
>
>   file { "/System/Library/User 
> Template/English.lproj/Library/Preferences/${title}":
> ensure => 'file',
> owner => 'root',
> group => 'wheel',
> mode => '0600'
> source => "puppet:///modules/${application}/Preferences/${title}"
>   }
> }
>
>
> # Manages the base preferences directory.
> # Must be a class so that it can be declared multiple times..
> class my_module::mac_preferences_base {
>   # Note: not recursive.  In this version, all managed contents
>   # are managed by separate File resources.
>   file { "/System/Library/User Template/English.lproj/Library/Preferences":
> ensure => 'directory',
> owner => 'root',
> group => 'wheel',
> mode => '0600'
>   }
> }
>
>
> That might be used like so:
>
> class some_application {
>   $my_preference_files = [ 'some.plist', 'another.plist', 'random.plist' ]
>
>   my_module::mac_preference_file { $my_preference_files:
> application => 'some_application'
>   }
>
>   # ...
> }
>
>  
>
>>
>>
>> for files in .../module_name/Preferences/  # get a list of files and 
>> folders in the Preferences subfolder on the Puppet Master
>>   file { '/System/Library/User 
>> Template/English.lproj/Library/Preferences/${files}':  #Directory on Puppet 
>> agent, the variable would make this a unique resource and it would work for 
>> a file and folder
>>   source => "puppet:///modules/${module_name}/Preferences/${files}", # 
>> Since it is looping every file on the Puppet Master would match perfectly 
>> to the same exact file/folder on the agent.  No duplicate declaration.
>> done
>>
>> John,
>>
>> I think I understand what your code is trying to do, but am not sure I 
>> understand how to implement.  I think that $preference_sources is making a 
>> list of paths (puppet paths) to the Preferences folder of each module,
>>
>
>
> Yes, the approach depends on creating an array of all the source 
> directories from which to sync files into the master Preferences folder.  
> You cannot manage the Preferences folder more than once, but you *can* 
> give it multiple sources.
>
>  
>
>> and I know that sourceselect all means that it will use all sources 
>> instead of stopping at the first match.  I also see that the 
>> preferences_sources is being created from a regex expression that I don't 
>> completely understand, though that shouldn't matter in getting this to 
>> work.  
>>
>> Is this still a defined type?
>>
>
>
> No, it is a class.  That's what "class" instead of "define" at the 
> beginning means.  There's no point to making it a defined type, because any 
> attempt to declare it (as a resource) more than once will fail with a 
> duplicate resource error.  Also, if you make it a class then you have the 
> option of using automated data binding to assign the parameter value (via 
> Hiera).
>
>  
>
>>  Should class mac_managed_preferences be defined
>>
>
>
> Well, yes.  Its definition is what I presented.  Do you mean to ask 
> whether it should be *declared*?  Also yes.  A class definition by itself 
> does not

[Puppet Users] Can Exec notify File?

2014-09-25 Thread Ellick Johnson
I need to have an Exec command notify a File block only to run if the Exec 
is true. Is that possible?

  exec { "check_version":
command => "/bin/echo 'versions differ'",
unless  => "/usr/bin/test `/bin/cat VERSION.txt` = \"1.0\"",
notify  => File["/app_dir"],
  }

  # create app_dir only if versions differ
  file { /app_dir:
recurse   => true,
require   => [Exec["check_version"],
source=> "puppet:///modules/app/versions/1.0",
subscribe => Exec["check_version"],
  }

Is this possible?

-- 
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/f00e9418-663d-4359-ac60-f28edb0d77b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] "Appending Assignment" (+=) in 3.7/4.0

2014-09-25 Thread Dan White
Follow the link:  (http://links.puppetlabs.com/remove-plus-equals)

there are other ways of achieving the same goals:

Translations for $a += $b when used with

Strings: use interpolation (e.g. {{$a = "$a$b" }}).

Arrays: in the future parser (4x language) simply use + (e.g. $a = $a + $b), in 
the current parser (3x language) use a custom function such as concat from 
stdlib (e.g. $a = concat($a, $b)) (WARNING: some versions of stdlib's concat 
will modify the arrays causing this to change the outer scope $a).

Hashes: in the future parser (4x language) simply use + (e.g. $a = $a + $b), in 
the current parser (3x language) use a custom function such as merge from 
stdlib (e.g. $a = merge($a, $b)).

On Sep 25, 2014, at 1:06 PM, Vladimir Brik  
wrote:

> Hello,
> 
> Now that support for += has been removed in 3.7/4.0 
> (http://links.puppetlabs.com/remove-plus-equals), is there another way to 
> implement "appending assignment" described in 
> https://docs.puppetlabs.com/puppet/latest/reference/lang_variables.html#appending-assignment
>  with the future parser?
> 
>$ssh_users = ['myself', 'someone']
> 
>class test {
>  $ssh_users += ['someone_else']
>}
> 
> 
> Thanks,
> 
> Vlad
> 
> -- 
> 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/54244BAA.5070209%40icecube.wisc.edu.
> For more options, visit https://groups.google.com/d/optout.

"Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us." 
Bill Waterson (Calvin & Hobbes)

-- 
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/F01FF1BD-2908-4E3B-886E-66D71A7993B6%40comcast.net.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Unable to do "puppet apply nodes.pp"

2014-09-25 Thread Justin Timberlake
Hey Felix,

Your are a puppet genius ... !!

Added the line "node.environment =
apply_environment" in /usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb
 and finally 'puppet apply' works :)




*puppet:/etc/puppet/manifests # puppet apply user-absent.ppNotice: Compiled
catalog for puppet in environment production in 0.34 secondsNotice:
/Stage[main]/Main/User[newton]/ensure: createdNotice: Finished catalog run
in 0.46 seconds*


Cool ...!! Excellent..

Thank you for everything ..

Justin


On Thu, Sep 25, 2014 at 3:46 PM, Felix Frank <
felix.fr...@alumni.tu-berlin.de> wrote:

> On 09/25/2014 04:34 AM, Justin Timberlake wrote:
> > Hi Felix,
> >
> > I'l try to patch it, if you can paste the steps/instructions somewhere.
> >
> > Thanks
> > Justin
>
> Hi,
>
> no need, it's really simple.
>
> 1. locate the file `apply.rb` in your installation of Puppet (under
> puppet/application/ in a Ruby library location).
> 2. Insert this line:
>
> https://github.com/ffrank/puppet/commit/587062e1f157c3b6eb08242c99c747c24082d736#diff-3acace79a768858f1f8964ecdb582af2R201
>
> This solution (or workaround?) has not yet been blessed by the dev team,
> but it should get you running.
>
> HTH,
> Felix
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/g1sFQ9-HqzE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/54242ABB.3070809%40Alumni.TU-Berlin.de
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAGVZ_iqAh2zoxQKacJzGaF1NYKOM7HRnH6hOoR1dvGpyhvyzAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] "Appending Assignment" (+=) in 3.7/4.0

2014-09-25 Thread Vladimir Brik

Hello,

Now that support for += has been removed in 3.7/4.0 
(http://links.puppetlabs.com/remove-plus-equals), is there another way 
to implement "appending assignment" described in 
https://docs.puppetlabs.com/puppet/latest/reference/lang_variables.html#appending-assignment 
with the future parser?


$ssh_users = ['myself', 'someone']

class test {
  $ssh_users += ['someone_else']
}


Thanks,

Vlad

--
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/54244BAA.5070209%40icecube.wisc.edu.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Cannot set variables via Hiera for a module I've written

2014-09-25 Thread jcbollinger


On Wednesday, September 24, 2014 9:26:30 AM UTC-5, Danny Roberts wrote:
>
>
>
> On Wednesday, 24 September 2014 14:08:30 UTC+1, jcbollinger wrote:
>>
>>
>>
>> On Wednesday, September 24, 2014 5:57:45 AM UTC-5, Danny Roberts wrote:
>>>
>>> Hi Folks,
>>>
>>> I've started writing a module for zabbix monitoring (current version 
>>> here: https://github.com/kemra102/puppet-zabbix).
>>>
>>> I have a basic set-up to install the zabbix client using the module.
>>>
>>> There are some values I need to change for our environment so that the 
>>> config works, in my case I'm trying to set the $zabbix::client_server 
>>> variable via Hiera so it can be populated via template for the zabbix 
>>> client.
>>>
>>> Currently I have this in *common.yaml*:
>>>
>>> zabbix::client_server: '10.0.0.1'
>>>
>>> As far as I know this should work fine and matches the Puppetlabs NTP 
>>> module way of doing it (in this module we define our own NTP servers in 
>>> Hiera to override the defaults just fine).
>>>
>>> However it doesn't seem to be getting set as one of the error checks I 
>>> have in place is being triggered due to this value being missing.
>>>
>>
>>
>> Are you talking about these checks:
>>
>> class zabbix::client::service inherits zabbix::params {  
>>   if ($client_startagents != '0' and $client_server == '') {  fail("Your 
>> StartAgents cannot be greater than 0 or null when Server is also null. Set 
>> StartAgents to 0 or set Server.")  }  if ($client_server == '' and 
>> $client_serveractive == '') {  fail("You must set either passvie or 
>> active (or both) checks via the Server or ServerActive options.")  }  
>> [...]
>> }
>>
>> Whether you are or not, I note that in that particular class the 
>> unqualified name $client_server refers to $::zabbix::params::client_server 
>> (via class inheritance).  If you were expecting the value from hiera then 
>> you should be testing $::zabbix::client_server (and therefore that class 
>> should 'include ::zabbix', or at minimum it should document that it relies 
>> on some other class to have already done so).  Alternatively, you could 
>> read the value from hiera by calling "hiera('zabbix::client_server', 
>> $::zabbix::params::client_server)" to get exactly the same value that 
>> $::zabbix::client_server gets.
>>
>
> I don't think I've articulated this too well. I know those checks work 
> becuase for example if I hardcode an IP in params.pp for client_server then 
> the check is passed and the config file updated and service started without 
> error.
>
>

Again: the checks I quoted are against $zabbix::params::client_server, 
whose value does not depend on your Hiera data.  If that's what you 
intended then well and good, but it seems a bit pointless.  If those are 
*not* the failing checks you meant, then please point out the ones you did 
mean.  My effectiveness at predicting the errors in code I cannot analyze 
is much less than my effectiveness at spotting errors in code that I can 
analyze.

In any event, I don't see anywhere in the code on GitHub that you actually 
refer to variable $::zabbix::client_server, so I am uncertain how you could 
know whether it is getting the right value.

 

> However for example in our production common.yaml we have:
>
> ntp::servers: [ '0.uk.pool.ntp.org', '1.uk.pool.ntp.org', '
> 2.uk.pool.ntp.org', '3.uk.pool.ntp.org' ]
>
> This correctly modifies the ntp::params::servers variable.
>
> I am trying to achieve the same thing with my zabbix module by having this 
> in common.yaml:
>
> zabbix::client_server: '10.0.0.1'
>
> In order to modify the default value of zabbix::params::client_server
>
>

It sounds like you have a misconception.  By recording the specified data 
in Hiera, you provide a value to bind to class ::zabbix's parameter 
$::zabbix::client_server.  If you declare class ::zabbix without specifying 
a value for that parameter (e.g.

include '::zabbix'

or

class { '::zabbix': }

) then $::zabbix::client_server will take the Hiera value.  If there were 
no such value available from Hiera then $::zabbix::client_server would take 
its default value instead ($::zabbix::params::client_server).  *In no event 
is the value of class variable $::zabbix::params::client_server ever 
different from the one with which it is initialized in the body of class 
::zabbix::params.*



I've had a look through the Puppetlabs NTP code and it doesn't look like 
> you have to do anything special in order to be able to overwrite variables 
> in Hiera beyond what I have already done.
>


"Overwrite" sounds like you think something already set is being changed.  
That is not the case.  (Did you perhaps mean "override" instead?)  Anyway, 
your Hiera data look fine, and your class ::zabbix looks fine.  I think 
you're struggling with a scope issue, not an Hiera issue.


John

-- 
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 

Re: [Puppet Users] Re: Unable to do "puppet apply nodes.pp"

2014-09-25 Thread Felix Frank
On 09/25/2014 04:34 AM, Justin Timberlake wrote:
> Hi Felix,
>
> I'l try to patch it, if you can paste the steps/instructions somewhere.
>
> Thanks
> Justin

Hi,

no need, it's really simple.

1. locate the file `apply.rb` in your installation of Puppet (under
puppet/application/ in a Ruby library location).
2. Insert this line:
https://github.com/ffrank/puppet/commit/587062e1f157c3b6eb08242c99c747c24082d736#diff-3acace79a768858f1f8964ecdb582af2R201

This solution (or workaround?) has not yet been blessed by the dev team,
but it should get you running.

HTH,
Felix

-- 
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/54242ABB.3070809%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Issue with rspec-puppet testing of roles/profiles module and class evaluation...

2014-09-25 Thread Gavin Williams
Note to self, need to do better at reading the manual :( 

The issue was a typo - It should be 'pre_condition', not 'precondition' - 
https://github.com/fatmcgav/rspec-deptest/commit/6a4f5a5294d7bb239b8f98cabe6c32e3522569de

Tests now working... 

Cheers
Gav

On Thursday, 25 September 2014 14:42:26 UTC+1, Gavin Williams wrote:
>
> Afternoon all
>
> I'm currently trying to add some rspec testing to some of our internal 
> modules which are used in a roles/profiles style setup. 
>
> Each of our products has got it's own module, which all pull in chunks of 
> functionality from a base module. 
>
> The issue I'm hitting is that when I try and spec test the product module, 
> which attempts to use Glassfish module resources[1], with the base 
> Glassfish class being included as part of a 'base::software::glassfish' 
> class. 
> I've tried adding a 'require base::software::glassfish' as a precondition 
> to rspec, but still get failures... 
>
> In order to make sure I wasn't doing anything daft, I've created a pair of 
> very simple modules that are available on Github that model the product and 
> base classes I'm trying to test. 
> The modules are: rspec-deptest[2], which is effectively our product 
> module, and rspec-deptest_base[3] which is our base module. 
>
> The error I'm getting when trying to run *bundle exec rake spec *on the 
> rspec-deptest module is here[4]. I'm also getting this error on travis[5].
>
> Any pointers on what I could be doing wrong, or how I can make it work? 
>
> Cheers in advance for any responses. 
>
> Regards
> Gavin 
>
> [1] https://github.com/fatmcgav/fatmcgav-glassfish/tree/develop
> [2] https://github.com/fatmcgav/rspec-deptest/tree/use-deptest_profiles
> [3] https://github.com/fatmcgav/rspec-deptest_base
> [4] https://gist.github.com/fatmcgav/b849b073f04ab592ed45
> [5] https://travis-ci.org/fatmcgav/rspec-deptest/jobs/36255663
>

-- 
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/e7998f86-d206-42fc-9e22-1d078028a870%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Custom facts and environments

2014-09-25 Thread jcbollinger


On Wednesday, September 24, 2014 8:44:19 AM UTC-5, JonY wrote:
>
> "For a given node, the pluginsync process will sync plugins, including 
>> custom facts, from the modules in the modulepath of the environment to 
>> which that node belongs."
>>
>
> So if my modulepath is /etc/puppet/modules - pluginsync will grab 
> everything from 'lib' folders under that (IE /etc/puppet/modules/.../lib ) 
> regardless of whether it is referenced for a given client? Seems a tad 
> confusing as other elements from this path (other modules) aren't sent to a 
> given client without appearing in the node classifier for that client.
>


Pluginsync will sync all the //lib/facter/* (custom 
fact implementations).  These all WILL be used by the client, though the 
resulting facts might or might not be afterward referenced by the server.  
It will also sync custom types and providers from 
//lib/puppet/type/* and 
//lib/puppet/provider/*.  Whether or not the types 
and providers are used by the client depends on the contents of its 
catalog, but that isn't known yet (even by the master) when plugins are 
synced, as it may depend on the custom facts.  Manifests are not synced, 
but they are not useful to clients (in master / agent mode), and anyway 
they are not plugins.  All of this applies to EVERY module in the 
applicable module path.

If you have not already done so, you should consult the documentation for 
distributing plugins 
.


John

-- 
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/a0742cdd-0687-475f-b75a-ac31c204bae1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Manage a single file (directory) from multiple modules

2014-09-25 Thread jcbollinger


On Wednesday, September 24, 2014 2:38:40 PM UTC-5, aar...@gmail.com wrote:
>
> Neil and John,
>
> You guys both agree on using individual files and I was thinking of how I 
> could do this.  If I have one file or three, it may not be a big deal to do 
> individually, but some applications could need dozens or more.  
>
> I don't know if it is possible, some searching makes me believe it isn't, 
> but I'll share my thought.
>
> Can you do something like a for loop in a bash script.  So it would be 
> something like...
>


You can if you turn on the future parser, but there's an old-school way to 
approach the problem that might actually be better in your case, because it 
would be reusable across multiple application modules.  The old-school way 
revolves around Puppet's behavior when an array is provided as a resource 
title 
,
 
which is to declare a separate resource for each element of the array.  
When the declared resource is of a defined type, it's body is evaluated 
once for each title, which yields a pretty good analog of iteration.  
Example:

define my_module::mac_preference_file ($application) {
  include my_module::mac_preferences_base

  file { "/System/Library/User 
Template/English.lproj/Library/Preferences/${title}":
ensure => 'file',
owner => 'root',
group => 'wheel',
mode => '0600'
source => "puppet:///modules/${application}/Preferences/${title}"
  }
}


# Manages the base preferences directory.
# Must be a class so that it can be declared multiple times..
class my_module::mac_preferences_base {
  # Note: not recursive.  In this version, all managed contents
  # are managed by separate File resources.
  file { "/System/Library/User Template/English.lproj/Library/Preferences":
ensure => 'directory',
owner => 'root',
group => 'wheel',
mode => '0600'
  }
}


That might be used like so:

class some_application {
  $my_preference_files = [ 'some.plist', 'another.plist', 'random.plist' ]

  my_module::mac_preference_file { $my_preference_files:
application => 'some_application'
  }

  # ...
}

 

>
>
> for files in .../module_name/Preferences/  # get a list of files and 
> folders in the Preferences subfolder on the Puppet Master
>   file { '/System/Library/User 
> Template/English.lproj/Library/Preferences/${files}':  #Directory on Puppet 
> agent, the variable would make this a unique resource and it would work for 
> a file and folder
>   source => "puppet:///modules/${module_name}/Preferences/${files}", # 
> Since it is looping every file on the Puppet Master would match perfectly 
> to the same exact file/folder on the agent.  No duplicate declaration.
> done
>
> John,
>
> I think I understand what your code is trying to do, but am not sure I 
> understand how to implement.  I think that $preference_sources is making a 
> list of paths (puppet paths) to the Preferences folder of each module,
>


Yes, the approach depends on creating an array of all the source 
directories from which to sync files into the master Preferences folder.  
You cannot manage the Preferences folder more than once, but you *can* give 
it multiple sources.

 

> and I know that sourceselect all means that it will use all sources 
> instead of stopping at the first match.  I also see that the 
> preferences_sources is being created from a regex expression that I don't 
> completely understand, though that shouldn't matter in getting this to 
> work.  
>
> Is this still a defined type?
>


No, it is a class.  That's what "class" instead of "define" at the 
beginning means.  There's no point to making it a defined type, because any 
attempt to declare it (as a resource) more than once will fail with a 
duplicate resource error.  Also, if you make it a class then you have the 
option of using automated data binding to assign the parameter value (via 
Hiera).

 

>  Should class mac_managed_preferences be defined
>


Well, yes.  Its definition is what I presented.  Do you mean to ask whether 
it should be *declared*?  Also yes.  A class definition by itself does 
nothing for you.  In this case, you make an array of the names of all the 
application modules whose preferences you want to manage, and assign that 
array as the class's parameter.  If you do that via Hiera and automated 
data binding, then you can declare the mac_managed_preferences class as 
many times as you like, using the 'include' function.  If you use a 
resource-like class declaration, however, then it must not be evaluated 
more than once.

 

> or are we making a new class for each applications preferences (assuming 
> that's the $applications variable in the class name)?
>


There is no variable in the class name.  The class has a parameter named 
$applications, but it is not part of the class name.  You are already 
supposing that there is a separate (and different) class for each managed 
application, however.  In fact, you 

[Puppet Users] Issue with rspec-puppet testing of roles/profiles module and class evaluation...

2014-09-25 Thread Gavin Williams
Afternoon all

I'm currently trying to add some rspec testing to some of our internal 
modules which are used in a roles/profiles style setup. 

Each of our products has got it's own module, which all pull in chunks of 
functionality from a base module. 

The issue I'm hitting is that when I try and spec test the product module, 
which attempts to use Glassfish module resources[1], with the base 
Glassfish class being included as part of a 'base::software::glassfish' 
class. 
I've tried adding a 'require base::software::glassfish' as a precondition 
to rspec, but still get failures... 

In order to make sure I wasn't doing anything daft, I've created a pair of 
very simple modules that are available on Github that model the product and 
base classes I'm trying to test. 
The modules are: rspec-deptest[2], which is effectively our product module, 
and rspec-deptest_base[3] which is our base module. 

The error I'm getting when trying to run *bundle exec rake spec *on the 
rspec-deptest module is here[4]. I'm also getting this error on travis[5].

Any pointers on what I could be doing wrong, or how I can make it work? 

Cheers in advance for any responses. 

Regards
Gavin 

[1] https://github.com/fatmcgav/fatmcgav-glassfish/tree/develop
[2] https://github.com/fatmcgav/rspec-deptest/tree/use-deptest_profiles
[3] https://github.com/fatmcgav/rspec-deptest_base
[4] https://gist.github.com/fatmcgav/b849b073f04ab592ed45
[5] https://travis-ci.org/fatmcgav/rspec-deptest/jobs/36255663

-- 
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/662eba67-b574-4364-8444-cdaa3dc26be6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppet as configurator for test farm

2014-09-25 Thread Michael Cherkasov
Hi all,

I need to configure a farm of test machines(linux, windows, macosx, 
solaris) for testing.
To prevent false test failure I need to turnoff screensavers, autoupdates,
install fake printers and so on.( it will testing of UI application)

But I didn't find modules that can do this, so the question is: does puppet 
suitable for this?

May be someone already resolved the same task and can point me to necessary 
docs, modules, scripts and so on.

Thanks,
Mikhail.

-- 
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/62d634f9-d515-4d8c-b884-2fe37861be8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Automatically cleaning up if a class/define is no longer used (related to purging unmanaged resources)

2014-09-25 Thread Vladimir Brik
Thanks for the replies, everybody. They've been really helpful to clear-up 
my thinking!

Vlad

-- 
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/b80b24cd-1c22-4a24-93ac-f048032f9b58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Puppet certification PPT-202

2014-09-25 Thread mohit modi
Hi All,

I'm going to puppet certification PPT-202 in Oct'14.Can someone guide for 
how to  prepare for it?
 
Enter code here...

Currently, i have VM for practice and have gone through online 
documentation present at puppetlabs.com.Would that be sufficient?

Also,it would be great if some resources or link can be provided.

Thanks,

On Tuesday, April 1, 2014 7:22:08 PM UTC+5:30, Julien Deloubes wrote:
>
> Hello there,
> i'll pass the ppt-202 exam (Puppet for sysadmins) next week.
> I love the product but unfortunatly i have no profesionnal experience at 
> Puppet, so passing the certification is a good way for staying up to date 
> and practising the product.
> I was wondering if having a real experience on concrete use cases is a 
> prerequisite for the certification.
> I work on the puppet learn VM but i don't know if it is sufficient to 
> answer the certification questions?
>
> Thanks for your feedback.
>

-- 
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/8d77f4c6-4f33-42b3-bea2-be4f6fc8a05c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] rspec test for augeas resource that also verifies the resulting content of the file?

2014-09-25 Thread Johan De Wit

Hi,

Augeas changes the file during the execution of the catalog on the node, 
so it cannot have any content in the catalo, and that is what 
puppet-rspec is testing.


the with_content test will always fail, because a content attribute is 
not available for the augeas resource


puppet describe -s  augeas

Parameters
--
changes, context, force, incl, lens, load_path, name, onlyif, returns,
root, show_diff, type_check

For rspec unit testing, one must keep in mind that you are testing the 
content of the catalog.


hth

Grts

Johan


On 25/09/14 12:09, Bill Sirinek wrote:
I have a simple class that sets the timezone on a Solaris system. I'm 
trying to write tests for it, and failing. It's telling me the file is 
nil, but there should be content as the file does exist. The file is 
not generated via a template or as a static puppet file in the 
module... the module just has an augeas resource to set a shell-style 
variable inside the file:  TZ=
I have puppetlabs_spec_helper 0.8.1 and rspec-puppet 1.0.1 installed 
as gems into Puppet Enterprise's ruby (PE 3.2.3)

Here is the error and the offending rspec code:
bsirinek@myhost $ rake spec
/opt/puppet/bin/ruby 
-I/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-support-3.1.0/lib:/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/lib 
/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/exe/rspec 
--pattern 
spec/\{classes,defines,unit,functions,hosts,integration\}/\*\*/\*_spec.rb 
--color

...F
Failures:
  1) timezone when called with parameters on solaris should contain 
Augeas[set_timezone] with incl => "/etc/default/init", lens => 
"Shellvars.lns", changes => "set TZ US/Eastern" and content =~ 
/^TZ=US\/Eastern$/

 Failure/Error: }).with_content(/^TZ=US\/Eastern$/)
   expected that the catalogue would contain Augeas[set_timezone] 
with content set to /^TZ=US\/Eastern$/ but it is set to nil
 # ./spec/classes/timezone_spec.rb:47:in `block (3 levels) in (required)>'

(...annoying deprecation warnings removed...)
Finished in 0.60314 seconds (files took 1.4 seconds to load)
4 examples, 1 failure
Failed examples:
rspec ./spec/classes/timezone_spec.rb:43 # timezone when called with 
parameters on solaris should contain Augeas[set_timezone] with incl => 
"/etc/default/init", lens => "Shellvars.lns", changes => "set TZ 
US/Eastern" and content =~ /^TZ=US\/Eastern$/
/opt/puppet/bin/ruby 
-I/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-support-3.1.0/lib:/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/lib 
/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/exe/rspec 
--pattern 
spec/\{classes,defines,unit,functions,hosts,integration\}/\*\*/\*_spec.rb 
--color failed

rspec test:
  describe 'when called with parameter on solaris' do
let(:facts) { { :osfamily => 'Solaris' } }
let(:params) { { :time_zone => 'US/Eastern' } }
it {
  should contain_augeas('set_timezone').with({
:incl=> '/etc/default/init',
:lens=> 'Shellvars.lns',
:changes => "set TZ US/Eastern"
  }).with_content(/^TZ=US\/Eastern$/)
}
  end
The test works fine if I leave off the with_content.
Any ideas?
Thanks
Bill

--
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/7007a8e5-df7b-492a-accb-eed09cb12871%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--
Johan De Wit

Open Source Consultant

Red Hat Certified Engineer  (805008667232363)
Puppet Certified Professional 2013/2014 (PCP006)
_
 
Open-Future Phone +32 (0)2/255 70 70

Zavelstraat 72  Fax   +32 (0)2/255 70 71
3071 KORTENBERG Mobile+32 (0)474/42 40 73
BELGIUM http://www.open-future.be
_
 



Next Events:
Puppet Introduction Course | 
http://www.open-future.be/puppet-introduction-course-13th-october
Puppet Practitioner Training | 
http://www.open-future.be/puppet-practitioner-former-puppet-advanced-training-14-till-16th-october
Linux Training | http://www.open-future.be/linux-training-20-till-24th-october
Puppet Introduction Course | 
http://www.open-future.be/puppet-introduction-course-10th-november
Puppet Fundamentals Training | 
http://www.open-future.be/puppet-fundamentals-training-12-till-14th-november
Subscribe to our newsletter | http://eepurl.com/BUG8H

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this gro

[Puppet Users] Re: Generate Puppet manifiest from server

2014-09-25 Thread Paul Tötterman

>
> Anyone knows if there is any possibility to generate a puppet manifiest 
> from a server to use it as a template to other servers?.
>

Take a look at BluePrint  

Cheers,
Paul

-- 
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/75324e1c-9688-40c8-81ce-087531d9928d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Cannot set variables via Hiera for a module I've written

2014-09-25 Thread Antoine Cotten
Hi Danny,

You should 'include' your main class (zabbix) before, or even inside your 
sub-classes, else nothing tells you in which order they will be declared, 
and apparently classes like zabbix::client::service DO require the 
parameters set in your main class.

Something like that should work:
   
class zabbix::client::service inherits zabbix::params {   # ensure the main 
class is declared
  include ::zabix

  if ($client_startagents != '0' and $client_server == '') {fail("Your 
StartAgents cannot be greater than 0 or null when Server is also null. Set 
StartAgents to 0 or set Server.")  }
...


Toni

-- 
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/5cae315d-d735-4a64-af43-8e8f56915a2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Count number of (collected) external resources

2014-09-25 Thread Frederik Wagner
Hi group,

is there a way to count the number of resources of a specific type
(with a specific tag) included in the catalog?

In more detail:
In a manifest I collect external resources like:
   External::Resource <<| tag == 'tagged_resource' |>>

Now I would like to know how many resources are actually collected, so
I would like to have/write a function
   $num_res =  count_resources( External::Resource, { 'tag' =>
'tagged_resource' } )
to be used in the rest of the manifest.

Is there a way to realize this in a custom function? I suppose there
is, but I'm missing the right API calls.

Thanks a lot for any hints in the right direction.

Bye
Frederik

-- 
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/CACBNCokgkG87ef1m%3D%3DYMgVNZ%2BVLXEcopohG%3DuetVKckd6Ge6cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Generate Puppet manifiest from server

2014-09-25 Thread Juan Sierra Pons
Hi,

On the puppet27 Cookbook they talked about the cft tool (but I think
it has been deprecated)

More info can be found on this webpage:
http://fmtyewtk.blogspot.com.es/2011/01/porting-cft-to-debian.html

And on this gitorious.org repo:
https://gitorious.org/cft-debian/cft-debian/source/dd19c6e9f02ebdb58397fee1af96e4cfc4b0a5a8:README

"
This tool (cft, pronounced 'sift') follows a sysadmin as she makes changes
to the system. Its basic workings are inspired by Gnome's sabayon, a tool
that watches a user make configuration changes to their desktop and
collects them into a reusable bundle. Instead of the desktop though, cft is
focused on traditional system admins and how they maintain machines, mostly
with command line tools. Cft uses puppet[2] as its backbone for expressing
the configuration of a system, and for understanding in greater detail what
changes the admin has made to the system.
"

Hope it helps

Best regards
--
Juan Sierra Pons j...@elsotanillo.net
Linux User Registered: #257202
Web: http://www.elsotanillo.net Git: http://www.github.com/juasiepo
GPG key = 0xA110F4FE
Key Fingerprint = DF53 7415 0936 244E 9B00  6E66 E934 3406 A110 F4FE
--


2014-09-25 11:43 GMT+02:00 Salvador González González
:
>
>   Hello,
>
>  Anyone knows if there is any possibility to generate a puppet manifiest
> from a server to use it as a template to other servers?.
>
> 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/164dab93-3316-4bd1-b19f-16a56688c1b6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CABS%3Dy9vpwP1Ce%3DibvE8YMrv0e9QF8PtYEmsfBbBXw10coBPSvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] rspec test for augeas resource that also verifies the resulting content of the file?

2014-09-25 Thread Bill Sirinek
I have a simple class that sets the timezone on a Solaris system. I'm 
trying to write tests for it, and failing. It's telling me the file is nil, 
but there should be content as the file does exist. The file is not 
generated via a template or as a static puppet file in the module... the 
module just has an augeas resource to set a shell-style variable inside the 
file:  TZ=
 
I have puppetlabs_spec_helper 0.8.1 and rspec-puppet 1.0.1 installed as 
gems into Puppet Enterprise's ruby (PE 3.2.3)
 
Here is the error and the offending rspec code:
 
bsirinek@myhost $ rake spec
/opt/puppet/bin/ruby 
-I/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-support-3.1.0/lib:/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/lib
 
/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/exe/rspec --pattern 
spec/\{classes,defines,unit,functions,hosts,integration\}/\*\*/\*_spec.rb 
--color
...F
Failures:
  1) timezone when called with parameters on solaris should contain 
Augeas[set_timezone] with incl => "/etc/default/init", lens => 
"Shellvars.lns", changes => "set TZ US/Eastern" and content =~ 
/^TZ=US\/Eastern$/
 Failure/Error: }).with_content(/^TZ=US\/Eastern$/)
   expected that the catalogue would contain Augeas[set_timezone] with 
content set to /^TZ=US\/Eastern$/ but it is set to nil
 # ./spec/classes/timezone_spec.rb:47:in `block (3 levels) in '
(...annoying deprecation warnings removed...)
Finished in 0.60314 seconds (files took 1.4 seconds to load)
4 examples, 1 failure
Failed examples:
rspec ./spec/classes/timezone_spec.rb:43 # timezone when called with 
parameters on solaris should contain Augeas[set_timezone] with incl => 
"/etc/default/init", lens => "Shellvars.lns", changes => "set TZ 
US/Eastern" and content =~ /^TZ=US\/Eastern$/
/opt/puppet/bin/ruby 
-I/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-support-3.1.0/lib:/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/lib
 
/opt/puppet/lib/ruby/gems/1.9.1/gems/rspec-core-3.1.4/exe/rspec --pattern 
spec/\{classes,defines,unit,functions,hosts,integration\}/\*\*/\*_spec.rb 
--color failed
 
 
rspec test:
 
  describe 'when called with parameter on solaris' do
let(:facts) { { :osfamily => 'Solaris' } }
let(:params) { { :time_zone => 'US/Eastern' } }
it {
  should contain_augeas('set_timezone').with({
:incl=> '/etc/default/init',
:lens=> 'Shellvars.lns',
:changes => "set TZ US/Eastern"
  }).with_content(/^TZ=US\/Eastern$/)
}
  end
 
The test works fine if I leave off the with_content.
 
Any ideas?
 
Thanks
 
Bill

 

-- 
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/7007a8e5-df7b-492a-accb-eed09cb12871%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Generate Puppet manifiest from server

2014-09-25 Thread Salvador González González

  Hello,
 
 Anyone knows if there is any possibility to generate a puppet 
manifiest from a server to use it as a template to other servers?.

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/164dab93-3316-4bd1-b19f-16a56688c1b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.