[Puppet Users] Resource Scope

2012-10-08 Thread Douglas Garstang
I can't work this out and I'm getting frustrated. :(

Puppet is complaining:

err: Failed to apply catalog: Could not find dependency
Lvm::Volume_group[bcvg] for Lvm::Application_volume[cache] at
/truth/sauce/env/prod/modules/object_store/manifests/server.pp:47

Yet, if I comment out that line so that puppet runs ok, and then look
at the state.yml file on the client, I see:

  "Lvm::Volume_group[bcvg]":
!ruby/sym checked: 2012-10-08 17:05:45.117364 +00:00

Now, according to the puppet docs at
http://docs.puppetlabs.com/puppet/2.7/reference/lang_scope.html,
resource titles are all global.

So what gives? By definition, this should not be occurring.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: PuppetConf speakers contact info

2012-10-01 Thread Douglas Garstang
I don't think _any_ of the speakers contact information has been
published. Given that, it's hard to tell if that's by design or an
oversight.

Where did you have in mind for me sending that template?

Doug

On Mon, Oct 1, 2012 at 10:59 AM, windowsrefund  wrote:
> If the speaker's contact information has not been published, there's
> probably a good reason why. I'd suggest something along the lines of:
>
> "Hi,
>
> I am trying to reach ___ about their Presentation at PuppetConf. If you
> are __, can you please contact me off-line? I have a few questions
> and can be reached at the following email address: _
>
> "
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/CwJ84wL1zWEJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] PuppetConf speakers contact info

2012-10-01 Thread Douglas Garstang
I'm trying to find email addresses of some of the speakers from Puppet
Conf last week. They aren't on the web site... maybe due to spamming
concerns. Short of Googling, how can I get these?

Also... are there slides available yet? What about video?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Puppetconf Feedback

2012-09-28 Thread Douglas Garstang
Anyone know if there's a feedback mechanism for Puppetconf?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Systems Provisioning

2012-09-18 Thread Douglas Garstang
I probably should have been clearer with my question. I was more
interested in how people are managing certificates? Even if you use
autosign, you still need to clean certificates manually.

Doug.

On Mon, Sep 17, 2012 at 6:25 AM, Keiran Sweet  wrote:
> Hi There,
> I manage a relatively large RHEL environment, we handle provisioning as
> follows:
>
> - PXE + Kickstart to bootstrap and install the base OS + Puppet client onto
> the platform, be it VMWare or bare metal
> - Kickstart post scripts put a basic puppet configuration file in place on
> the host, and a number of the values for things such as environment and
> puppetmaster come from Foreman's Macro's, this allows values in the ENC to
> flow into the kickstart files before your first puppet run.
>
> We then run in the %post section of the kickstart file the following:
> - A Puppet run that bootstraps the puppet client using tags ie,  --tags
> puppet::client
> - A full puppet run via puppet agent -tov which applys the SOE to the
> platform
>
> That provides on first boot a fully configured RHEL server that includes all
> our additional software and customisations in about 3-5 minutes (not
> including POST)
>
> In regards to certs, we have a relatively open autosign.conf on our build
> networks, so we can provision servers , physical or virtual quite quickly by
> just hitting F12 for a network boot. I am sure there are some cleaner/more
> secure things we can do provisioning wise, however these have been slightly
> hindered by the RHN Satellite server i've been slowly pulling out of the
> environment at the same time, as it had the potential to break things if i
> wasnt careful.
>
> ENC wise, I can't recommend Foreman enough, version 1.x is just brilliant,
> you can see the macros it can provide here:
> http://theforeman.org/projects/foreman/wiki/TemplateWriting
>
> Hope this helps,
>
> K
>
>
>
>
>
>
>
>
>
> On Sunday, September 16, 2012 7:22:03 AM UTC+1, Douglas wrote:
>>
>> I'm wondering what people are doing systems provisioning with, ie the
>> process that gets puppet installed onto a system, running for the
>> first time, and also the handling of certificate signing and so forth.
>> I don't see this topic discussed much.
>>
>> The mc-provision tools at
>> https://github.com/ripienaar/mcollective-server-provisioner don't seem
>> to be actively developed anymore, or at least I wasn't able to find
>> enough documentation to be able to effectively make use of it.
>>
>> Doug
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/NrKmbHHiaq8J.
>
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Systems Provisioning

2012-09-15 Thread Douglas Garstang
I'm wondering what people are doing systems provisioning with, ie the
process that gets puppet installed onto a system, running for the
first time, and also the handling of certificate signing and so forth.
I don't see this topic discussed much.

The mc-provision tools at
https://github.com/ripienaar/mcollective-server-provisioner don't seem
to be actively developed anymore, or at least I wasn't able to find
enough documentation to be able to effectively make use of it.

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Skipped Resources 'running on a host' ?

2012-09-12 Thread Douglas Garstang
My puppet client is producing this:

debug: /Schedule[daily]: Skipping device resources because running on a host
debug: /Schedule[monthly]: Skipping device resources because running on a host
debug: /Schedule[hourly]: Skipping device resources because running on a host
debug: /Schedule[never]: Skipping device resources because running on a host
debug: /Schedule[weekly]: Skipping device resources because running on a host
debug: /Schedule[puppet]: Skipping device resources because running on a host

When used with the --summarize option, it causes 6 skipped resources.
Puppet in turn, exits with exit code 2. How can I remove these and
presumably get puppet to then return 0?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Virtual Resources and create_resources

2012-09-11 Thread Douglas Garstang
So, it seems that create_resources doesn't support virtual resources.

Suggestions? Workarounds?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Resource Chaining Classes

2012-09-10 Thread Douglas Garstang
On Mon, Sep 10, 2012 at 1:41 PM, Calvin Walton  wrote:
> On Mon, 2012-09-10 at 12:34 -0700, Douglas Garstang wrote:
>> Why does this:
>>
>> Class['network::base'] -> Class['apt::base'] -> Class['lvm::setup'] ->
>> Class <| |>
>>
>> generate this error?
>>
>> err: Could not retrieve catalog from remote server: Error 400 on
>> SERVER: Resource type class doesn't exist at
>> /truth/sauce/env/prod/modules/role/manifests/common.pp:18 on node
>> mon01.ap1.xxx.com
>> warning: Not using cache on failed catalog
>> err: Could not retrieve catalog; skipping run
>
> Classes are not resources. As a result, you cannot use the resource
> collection syntax <| |> on classes.
>
> Even if it worked, this wouldn't do what you wanted! Class <| |> would
> include Class['network::base'] and all the others, giving dependency
> cycles, like this:
>
> Class['network::base'] -> Class['apt::base'] -> Class['lvm::setup'] -> 
> Class['network::base']
>
>> I've been repeatedly told to stop using run stages, and use resource
>> chaining instead. However, without putting the Class <| |> at the end,
>> to indicate that every other class should come afterwards, the
>> functionality is not the same. With run stages, I could specify that
>> classes A, B and C should applied first, before everything else.
>
> If you're sure that you will always need these classes run before
> everything else, a run stage might still make sense. You would want to
> have one run stage in addition to main, perhaps like this:
>
> stage { 'early_setup':
>   before => Stage['main'],
> }
>
> class { 'network::base':
>   stage => 'early_setup',
> }
> class { 'apt::base':
>   stage => 'early_setup',
> }
> class { 'lvm::setup':
>   stage => 'early_setup',
> }
>
> Class['network::base'] -> Class['apt::base'] -> Class['lvm::setup']
>
> (In your case, you'd want to put the exec for apt-get update into the
> same 'early_setup' stage as well, for example by putting it into the
> apt::base class). If you later add additional apt repositories, you'd
> have to put them into the same early stage as well, so they can be
> configured before doing the apt-get update.
>
> Everything else can then go in the main stage, and should be ordered
> only relative to each-other.
>
> The general advice that I've seen is that you should use a limited
> number of stages only for cases like this where you need some system
> setup that is independent of the other things that you'll be installing
> on the system, and must be ordered before (or after) *everything* else.
>
> Do keep in mind the things listed in
> http://docs.puppetlabs.com/puppet/2.7/reference/lang_run_stages.html#limitations-and-known-issues
> in particular, make sure that the classes in the non-main stage don't
> include other classes without setting the stage on them as well!

Calvin,

Thanks. Your describing exactly what I had, before I was told to stop
using run stages and use resource chaining instead. Apparently
resource chaining provides the same functionality as run stages. Seems
that it indeed does not.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Resource Chaining Classes

2012-09-10 Thread Douglas Garstang
Why does this:

Class['network::base'] -> Class['apt::base'] -> Class['lvm::setup'] ->
Class <| |>

generate this error?

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Resource type class doesn't exist at
/truth/sauce/env/prod/modules/role/manifests/common.pp:18 on node
mon01.ap1.xxx.com
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

I've been repeatedly told to stop using run stages, and use resource
chaining instead. However, without putting the Class <| |> at the end,
to indicate that every other class should come afterwards, the
functionality is not the same. With run stages, I could specify that
classes A, B and C should applied first, before everything else.

Omitting the Class <| |> from the end gets rid of the error. However,
this means that there is no guarantee that these three classes will be
applied before the rest.

Hoping Mr Pienaar doesn't thing that such a scandalous and negative
question is not considered anti social behaviour.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Dependency Cycles.

2012-09-10 Thread Douglas Garstang
I know it's highly unconstructive, but I just wanted to say that I am
sick and tired of getting these, and they completely piss me off.
Debugging this is a friggin nightmare.

*sigh*

err: Could not apply complete catalog: Found 1 dependency cycle:
(Exec[apt-update] => Package[lvm2] => Class[Lvm::Setup] =>
Stage[stage3] => Stage[main] => Class[Main] => Exec[apt-update])
Try the '--graph' option and opening the resulting '.dot' file in
OmniGraffle or GraphViz
notice: Finished catalog run in 0.45 seconds

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Puppet smoking crack?

2012-09-05 Thread Douglas Garstang
On Wed, Sep 5, 2012 at 2:23 PM, Christopher Wood
 wrote:
> (inline)
>
> On Wed, Sep 05, 2012 at 02:04:59PM -0700, Douglas Garstang wrote:
>> Couple of questions. Firstly, what's the plugin error about?
>>
>> puppet agent --onetime --test --verbose
>
> Could you also try with --debug?

I could. What are we looking for?

>
>> info: Retrieving plugin
>> err: /File[/var/lib/puppet/lib]: Could not evaluate: Could not
>> retrieve information from source(s) puppet://puppet/plugins
>
> Worth looking into your pluginsync config here.

I have on the client 'pluginsync = true' in the [main] section.

>
>> info: Caching catalog for mon01.ap1.xxx.com
>> info: Applying configuration version '1346878830'
>> err: /Stage[main]/Xxx::Nagios::Server/File[/var/lib/nagios3]: Failed
>
> Do you have a declaration /var/lib/nagios3? What does that say?

Nope. The manifest only has:

file {
'/var/lib/nagios3/rw':
owner => 'nagios',
group => 'www-data',
mode  => '0750';
}

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Puppet smoking crack?

2012-09-05 Thread Douglas Garstang
Couple of questions. Firstly, what's the plugin error about?

puppet agent --onetime --test --verbose
info: Retrieving plugin
err: /File[/var/lib/puppet/lib]: Could not evaluate: Could not
retrieve information from source(s) puppet://puppet/plugins
info: Caching catalog for mon01.ap1.xxx.com
info: Applying configuration version '1346878830'
err: /Stage[main]/Xxx::Nagios::Server/File[/var/lib/nagios3]: Failed
to generate additional resources using 'eval_generate': Cannot manage
files of type fifo
notice: Finished catalog run in 3.63 seconds

Secondly, I think puppet is smoking crack. Why is it telling me that
it can't manage files of type fifo when that is not what the manifest
has? The manifest has:

file {
'/var/lib/nagios3/rw':
owner => 'nagios',
group => 'www-data',
mode  => '0750';
}

The fifo file is IN the rw directory

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Nagios and www-data users.

2012-09-05 Thread Douglas Garstang
I'm sure people have hit this problem before. In my nagios module, the
nagios command pipe file at /var/lib/nagios3/rw/nagios.cmd is owned by
the nagios user, but needs to be written to by the www-data user.
Adding the www-user to the nagios group is one solution, but that
requires that the nagios module potentially modify the www-data user,
which seems bad.

What's the best way to do this? I tried to explicitly define the
www-data user in it's own class, and then create another nagios class
that inherits from that so that I could do plusignment, but I
obviously have the syntax wrong. Puppet doesn't like this.

class nagios::users inherits users::www-data {
 User['www-data'] { group +> ['nagios'] }
}

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: puppetlabs-stdlib

2012-08-30 Thread Douglas Garstang
Cool. thanks for fixing.

On Thu, Aug 30, 2012 at 3:00 PM, Jeff McCune  wrote:
> On Wed, Aug 29, 2012 at 12:20 PM, Douglas Garstang 
> wrote:
>>
>> Really? From the function reference at:
>> http://docs.puppetlabs.com/references/latest/function.html
>>
>> Common ones seem to be create_resources, crit, defined, err,
>> extlookup, fail, file  and so on.
>
>
> I've fixed up the README, the function list in the doc is accurate for the
> 3.0.0 release of stdlib.
>
> https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/README.markdown
>
> Hope this helps,
> -Jeff
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Uber Frustration with Puppet.

2012-08-29 Thread Douglas Garstang
Boy, am I frustrated. I'm about ready to throw puppet out the window
here. I'm trying to configure glusterfs, and you know, it kinda made
sense to separate the data from the manifests, so I went ahead and put
this into a YAML file, which hiera loads...

glusterfs_volumes:
  gfsvol01:
volume_name: gfsvol01
master_node: gfs01.us1.xxx.com # Make sure only one node
runs the gluster commands.
nodes:
  - name: gfs01.us1.xxx.com
bricks:
  - device: /dev/bcvg/disk1
brick_name: /var/bricks/gfsvol01-0
  - device: /dev/bcvg/disk2
brick_name: /var/bricks/gfsvol01-1
  - name: gfs02.us1.xxx.com
bricks:
  - device: /dev/bcvg/disk3
brick_name: /var/bricks/gfsvol01-0
  - device: /dev/bcvg/disk4
brick_name: /var/bricks/gfsvol01-1

For the last couple of days I have been dealing with the inadequacies
of puppet in dealing with working with this kind of data structure.
You can't easily iterate through it, and every time you do, you have
to write a new definition that takes an array. The whole thing ends up
turning into a giant complicated mess.

I tried writing some custom functions in ruby that do things like,
return a list of nodes for a volume, or return a list of bricks for a
node, but it really irks me that I have to keep writing ruby scripts
for this (since ruby makes my eyes bleed).

So... what are my options here? Aren't we supposed to strive for
separating the manifest from the data? I could probably get away with
a few definitions that take a set of parameters. However, when the
time comes to say, add a new node to the cluster, we have to modify
the manifest. At one point, I had this working so that all you had to
do was add a node to the yaml file, make ZERO changes to the manifest
file, and after running puppet, it would add the node to the cluster.

It may make my life easier if I flatten the yaml file, but then I'm
changing the data to suit the limitations of the DSL.

At this point, I'm very close to simply sticking with the yaml file,
have puppet push that out to the clients, write some python scripts to
do all the magic (reading the yaml file), and have puppet run those
scripts with Exec {}.

Is proper array/hash iteration ever going to be added to puppet?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Debugging Custom Stuff

2012-08-29 Thread Douglas Garstang
So... how can I debug ruby code for custom functions? Putting a 'puts'
in the ruby script doesn't actually cause anything to go anywhere.

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: puppetlabs-stdlib

2012-08-29 Thread Douglas Garstang
Really? From the function reference at:
http://docs.puppetlabs.com/references/latest/function.html

Common ones seem to be create_resources, crit, defined, err,
extlookup, fail, file  and so on.

Doug.

On Wed, Aug 29, 2012 at 11:57 AM, jcbollinger  wrote:
>
>
> On Wednesday, August 29, 2012 11:58:13 AM UTC-5, Douglas wrote:
>>
>> I'm confused about this...
>>
>> https://github.com/puppetlabs/puppetlabs-stdlib/
>>
>> I see a lot of functions there that are the same as the ones that come
>> standard with puppet. If I create a module and dump this stuff in
>> there, what happens to the existing stuff? How does puppet know which
>> one to use?
>
>
> That's odd.  I don't see anything in there that comes standard with Puppet.
> Would you care to give some examples?  Maybe I'm just missing the obvious.
>
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/dTHHvPBQFwMJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] puppetlabs-stdlib

2012-08-29 Thread Douglas Garstang
I'm confused about this...

https://github.com/puppetlabs/puppetlabs-stdlib/

I see a lot of functions there that are the same as the ones that come
standard with puppet. If I create a module and dump this stuff in
there, what happens to the existing stuff? How does puppet know which
one to use?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Hash Access... Frustrating!

2012-08-28 Thread Douglas Garstang
Oops. There's a working link right there...

On Tue, Aug 28, 2012 at 7:38 PM, Douglas Garstang
 wrote:
> Thanks. I'll check it out. Does anyone know where the docs for this
> are? All the links on the puppet web site are broken for
> create_resources.
>
> Doug.
>
> On Tue, Aug 28, 2012 at 6:03 PM, Jenner La Fave  wrote:
>> You still can't use anything other than a string as a resource title. Since
>> you're passing an array of hashes, it's being converted to a string,
>> specifically by Puppet::Resource::Type#set_name_and_namespace, which does
>> @name = name.to_s.downcase.
>>
>> In your case, you'll probably want to use the create_resources function
>> (http://docs.puppetlabs.com/references/stable/function.html#createresources).
>> Something like
>> $config = hiera('glusterfs_volumes')
>> create_resources(glusterfs::add_brick, $config['gfsvol01']['nodes'])
>>
>> might work.
>>
>> -- Jenner
>>
>> On Tuesday, August 28, 2012 4:39:57 PM UTC-7, Douglas wrote:
>>>
>>> It looks like it's flattening the darned thing out... :(
>>>
>>> err: Could not retrieve catalog from remote server: Could not intern
>>> from pson: Could not convert from pson: Could not find relationship
>>> source "Glusterfs::Add_peers[bricks/var/bricks/b3namegfs03.us1.xxx.com]"
>>>
>>> :(
>>>
>>> On Tue, Aug 28, 2012 at 4:31 PM, Douglas Garstang
>>>  wrote:
>>> > Having fixed the yaml...
>>> >
>>> > glusterfs_volumes:
>>> >   gfsvol01:
>>> > master_node: gfs01.us1.xxx.com
>>> > transport: tcp
>>> > replicas: 0
>>> > nodes:
>>> >   - name: gfs01.us1.xxx.com
>>> > bricks:
>>> >   - /var/bricks/b1
>>> >   - name: gfs02.us1.xxx.com
>>> > bricks:
>>> >   - /var/bricks/b2
>>> >   - name: gfs03.us1.xxx.com
>>> > bricks:
>>> >   - /var/bricks/b3
>>> >
>>> > The issue is now how do I iterate over the nodes? They are no
>>> > longer an array. They are an array of hashes, which puppet doesn't
>>> > want to iterate over.
>>> >
>>> > Doug.
>>> >
>>> > On Tue, Aug 28, 2012 at 2:44 PM, jcbollinger 
>>> > wrote:
>>> >>
>>> >>
>>> >> On Tuesday, August 28, 2012 2:55:20 PM UTC-5, Douglas wrote:
>>> >>>
>>> >>> Boy... accessing hashes in puppet is downright painful.
>>> >>>
>>> >>> I have this in a yaml file...
>>> >>>
>>> >>> glusterfs_volumes:
>>> >>>   gfsvol01:
>>> >>> master_node: gfs01.us1.xxx.com
>>> >>> transport: tcp
>>> >>> replicas: 0
>>> >>> nodes:
>>> >>>   - gfs01.us1.xxx.com
>>> >>> hostname: gfs01
>>> >>> state: mounted
>>> >>>   - gfs02.us1.xxx.com
>>> >>> hostname: gfs02
>>> >>> state: unmounted
>>> >>>   - gfs03.us1.xxx.com
>>> >>> hostname: gfs03
>>> >>> state: mounted
>>> >>>
>>> >>> I'm loading it with:
>>> >>>
>>> >>> $config  = hiera('glusterfs_volumes')
>>> >>> $nodes   = $config['gfsvol01']['nodes']
>>> >>> ... etc
>>> >>>
>>> >>> Works fine. I'm also calling a definition like this:
>>> >>>
>>> >>> glusterfs::add_bricks {
>>> >>> [$nodes]:
>>> >>> master_node => "$master_node",
>>> >>> brick_store => "$brick_store",
>>> >>> volume_name => "$name",
>>> >>> require => Glusterfs::Add_peers[$nodes];
>>> >>> }
>>> >>>
>>> >>> The question is, how do I access the hostname and state keys inside
>>> >>> each
>>> >>> node?
>>> >>>
>>> >>> The following (inside add_bricks):
>>> >>>
>>> >>> $node = $

Re: [Puppet Users] Re: Hash Access... Frustrating!

2012-08-28 Thread Douglas Garstang
Thanks. I'll check it out. Does anyone know where the docs for this
are? All the links on the puppet web site are broken for
create_resources.

Doug.

On Tue, Aug 28, 2012 at 6:03 PM, Jenner La Fave  wrote:
> You still can't use anything other than a string as a resource title. Since
> you're passing an array of hashes, it's being converted to a string,
> specifically by Puppet::Resource::Type#set_name_and_namespace, which does
> @name = name.to_s.downcase.
>
> In your case, you'll probably want to use the create_resources function
> (http://docs.puppetlabs.com/references/stable/function.html#createresources).
> Something like
> $config = hiera('glusterfs_volumes')
> create_resources(glusterfs::add_brick, $config['gfsvol01']['nodes'])
>
> might work.
>
> -- Jenner
>
> On Tuesday, August 28, 2012 4:39:57 PM UTC-7, Douglas wrote:
>>
>> It looks like it's flattening the darned thing out... :(
>>
>> err: Could not retrieve catalog from remote server: Could not intern
>> from pson: Could not convert from pson: Could not find relationship
>> source "Glusterfs::Add_peers[bricks/var/bricks/b3namegfs03.us1.xxx.com]"
>>
>> :(
>>
>> On Tue, Aug 28, 2012 at 4:31 PM, Douglas Garstang
>>  wrote:
>> > Having fixed the yaml...
>> >
>> > glusterfs_volumes:
>> >   gfsvol01:
>> > master_node: gfs01.us1.xxx.com
>> > transport: tcp
>> > replicas: 0
>> > nodes:
>> >   - name: gfs01.us1.xxx.com
>> > bricks:
>> >   - /var/bricks/b1
>> >   - name: gfs02.us1.xxx.com
>> > bricks:
>> >   - /var/bricks/b2
>> >   - name: gfs03.us1.xxx.com
>> > bricks:
>> >   - /var/bricks/b3
>> >
>> > The issue is now how do I iterate over the nodes? They are no
>> > longer an array. They are an array of hashes, which puppet doesn't
>> > want to iterate over.
>> >
>> > Doug.
>> >
>> > On Tue, Aug 28, 2012 at 2:44 PM, jcbollinger 
>> > wrote:
>> >>
>> >>
>> >> On Tuesday, August 28, 2012 2:55:20 PM UTC-5, Douglas wrote:
>> >>>
>> >>> Boy... accessing hashes in puppet is downright painful.
>> >>>
>> >>> I have this in a yaml file...
>> >>>
>> >>> glusterfs_volumes:
>> >>>   gfsvol01:
>> >>> master_node: gfs01.us1.xxx.com
>> >>> transport: tcp
>> >>> replicas: 0
>> >>> nodes:
>> >>>   - gfs01.us1.xxx.com
>> >>> hostname: gfs01
>> >>> state: mounted
>> >>>   - gfs02.us1.xxx.com
>> >>> hostname: gfs02
>> >>> state: unmounted
>> >>>   - gfs03.us1.xxx.com
>> >>> hostname: gfs03
>> >>> state: mounted
>> >>>
>> >>> I'm loading it with:
>> >>>
>> >>> $config  = hiera('glusterfs_volumes')
>> >>> $nodes   = $config['gfsvol01']['nodes']
>> >>> ... etc
>> >>>
>> >>> Works fine. I'm also calling a definition like this:
>> >>>
>> >>> glusterfs::add_bricks {
>> >>> [$nodes]:
>> >>> master_node => "$master_node",
>> >>> brick_store => "$brick_store",
>> >>> volume_name => "$name",
>> >>> require => Glusterfs::Add_peers[$nodes];
>> >>> }
>> >>>
>> >>> The question is, how do I access the hostname and state keys inside
>> >>> each
>> >>> node?
>> >>>
>> >>> The following (inside add_bricks):
>> >>>
>> >>> $node = $name['hostname']
>> >>> notice ("DEBUG nodes=$name")
>> >>> notice ("DEBUG NODE=$node")
>> >>>
>> >>> yields, for each call to add_bricks:
>> >>>
>> >>> DEBUG nodes=statemountedgfs01.us1.xxx.com hostnamegfs01
>> >>> DEBUG NODE=
>> >>>
>> >>> I can see the hash in $name... I just can't access the 'state' or
>> >>> 'hostname'

Re: [Puppet Users] Re: Hash Access... Frustrating!

2012-08-28 Thread Douglas Garstang
It looks like it's flattening the darned thing out... :(

err: Could not retrieve catalog from remote server: Could not intern
from pson: Could not convert from pson: Could not find relationship
source "Glusterfs::Add_peers[bricks/var/bricks/b3namegfs03.us1.xxx.com]"

:(

On Tue, Aug 28, 2012 at 4:31 PM, Douglas Garstang
 wrote:
> Having fixed the yaml...
>
> glusterfs_volumes:
>   gfsvol01:
> master_node: gfs01.us1.xxx.com
> transport: tcp
> replicas: 0
> nodes:
>   - name: gfs01.us1.xxx.com
> bricks:
>   - /var/bricks/b1
>   - name: gfs02.us1.xxx.com
> bricks:
>   - /var/bricks/b2
>   - name: gfs03.us1.xxx.com
> bricks:
>   - /var/bricks/b3
>
> The issue is now how do I iterate over the nodes? They are no
> longer an array. They are an array of hashes, which puppet doesn't
> want to iterate over.
>
> Doug.
>
> On Tue, Aug 28, 2012 at 2:44 PM, jcbollinger  
> wrote:
>>
>>
>> On Tuesday, August 28, 2012 2:55:20 PM UTC-5, Douglas wrote:
>>>
>>> Boy... accessing hashes in puppet is downright painful.
>>>
>>> I have this in a yaml file...
>>>
>>> glusterfs_volumes:
>>>   gfsvol01:
>>> master_node: gfs01.us1.xxx.com
>>> transport: tcp
>>> replicas: 0
>>> nodes:
>>>   - gfs01.us1.xxx.com
>>> hostname: gfs01
>>> state: mounted
>>>   - gfs02.us1.xxx.com
>>> hostname: gfs02
>>> state: unmounted
>>>   - gfs03.us1.xxx.com
>>> hostname: gfs03
>>> state: mounted
>>>
>>> I'm loading it with:
>>>
>>> $config  = hiera('glusterfs_volumes')
>>> $nodes   = $config['gfsvol01']['nodes']
>>> ... etc
>>>
>>> Works fine. I'm also calling a definition like this:
>>>
>>> glusterfs::add_bricks {
>>> [$nodes]:
>>> master_node => "$master_node",
>>> brick_store => "$brick_store",
>>> volume_name => "$name",
>>> require => Glusterfs::Add_peers[$nodes];
>>> }
>>>
>>> The question is, how do I access the hostname and state keys inside each
>>> node?
>>>
>>> The following (inside add_bricks):
>>>
>>> $node = $name['hostname']
>>> notice ("DEBUG nodes=$name")
>>> notice ("DEBUG NODE=$node")
>>>
>>> yields, for each call to add_bricks:
>>>
>>> DEBUG nodes=statemountedgfs01.us1.xxx.com hostnamegfs01
>>> DEBUG NODE=
>>>
>>> I can see the hash in $name... I just can't access the 'state' or
>>> 'hostname' keys, which are obviously there.
>>>
>>> How...?
>>
>>
>> Resource names are strings.  If you try to use a hash as a resource name
>> then it will be flattened.
>>
>> Generally speaking, you have several options: you could load the hash into a
>> class variable, and have your definitions access it from there.  You could
>> also pass it as a parameter to your definition.  You could even have the
>> definition load it (again) via hiera.  Sometimes the create_resources()
>> function is convenient for unpacking a hash of hashes.
>>
>> I'm afraid I cannot recommend any specifics to you, however, because your
>> YAML is not valid (according to http://yaml-online-parser.appspot.com/ and
>> my own eyes), so I don't know what the data structure is supposed to be.  It
>> looks like something based on create_resources() might work out nicely for
>> you, but I can't be sure.
>>
>>
>> John
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/puppet-users/-/cS8_5qGpd8wJ.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>
>
>
> --
> Regards,
>
> Douglas Garstang
> http://www.linkedin.com/in/garstang
> Email: doug.garst...@gmail.com
> Cell: +1-805-340-5627



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Hash Access... Frustrating!

2012-08-28 Thread Douglas Garstang
Having fixed the yaml...

glusterfs_volumes:
  gfsvol01:
master_node: gfs01.us1.xxx.com
transport: tcp
replicas: 0
nodes:
  - name: gfs01.us1.xxx.com
bricks:
  - /var/bricks/b1
  - name: gfs02.us1.xxx.com
bricks:
  - /var/bricks/b2
  - name: gfs03.us1.xxx.com
bricks:
  - /var/bricks/b3

The issue is now how do I iterate over the nodes? They are no
longer an array. They are an array of hashes, which puppet doesn't
want to iterate over.

Doug.

On Tue, Aug 28, 2012 at 2:44 PM, jcbollinger  wrote:
>
>
> On Tuesday, August 28, 2012 2:55:20 PM UTC-5, Douglas wrote:
>>
>> Boy... accessing hashes in puppet is downright painful.
>>
>> I have this in a yaml file...
>>
>> glusterfs_volumes:
>>   gfsvol01:
>> master_node: gfs01.us1.xxx.com
>> transport: tcp
>> replicas: 0
>> nodes:
>>   - gfs01.us1.xxx.com
>> hostname: gfs01
>> state: mounted
>>   - gfs02.us1.xxx.com
>> hostname: gfs02
>> state: unmounted
>>   - gfs03.us1.xxx.com
>> hostname: gfs03
>> state: mounted
>>
>> I'm loading it with:
>>
>> $config  = hiera('glusterfs_volumes')
>> $nodes   = $config['gfsvol01']['nodes']
>> ... etc
>>
>> Works fine. I'm also calling a definition like this:
>>
>> glusterfs::add_bricks {
>> [$nodes]:
>> master_node => "$master_node",
>> brick_store => "$brick_store",
>> volume_name => "$name",
>> require => Glusterfs::Add_peers[$nodes];
>> }
>>
>> The question is, how do I access the hostname and state keys inside each
>> node?
>>
>> The following (inside add_bricks):
>>
>> $node = $name['hostname']
>> notice ("DEBUG nodes=$name")
>> notice ("DEBUG NODE=$node")
>>
>> yields, for each call to add_bricks:
>>
>> DEBUG nodes=statemountedgfs01.us1.xxx.com hostnamegfs01
>> DEBUG NODE=
>>
>> I can see the hash in $name... I just can't access the 'state' or
>> 'hostname' keys, which are obviously there.
>>
>> How...?
>
>
> Resource names are strings.  If you try to use a hash as a resource name
> then it will be flattened.
>
> Generally speaking, you have several options: you could load the hash into a
> class variable, and have your definitions access it from there.  You could
> also pass it as a parameter to your definition.  You could even have the
> definition load it (again) via hiera.  Sometimes the create_resources()
> function is convenient for unpacking a hash of hashes.
>
> I'm afraid I cannot recommend any specifics to you, however, because your
> YAML is not valid (according to http://yaml-online-parser.appspot.com/ and
> my own eyes), so I don't know what the data structure is supposed to be.  It
> looks like something based on create_resources() might work out nicely for
> you, but I can't be sure.
>
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/cS8_5qGpd8wJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Hash Access... Frustrating!

2012-08-28 Thread Douglas Garstang
Boy... accessing hashes in puppet is downright painful.

I have this in a yaml file...

glusterfs_volumes:
  gfsvol01:
master_node: gfs01.us1.xxx.com
transport: tcp
replicas: 0
nodes:
  - gfs01.us1.xxx.com
hostname: gfs01
state: mounted
  - gfs02.us1.xxx.com
hostname: gfs02
state: unmounted
  - gfs03.us1.xxx.com
hostname: gfs03
state: mounted

I'm loading it with:

$config  = hiera('glusterfs_volumes')
$nodes   = $config['gfsvol01']['nodes']
... etc

Works fine. I'm also calling a definition like this:

glusterfs::add_bricks {
[$nodes]:
master_node => "$master_node",
brick_store => "$brick_store",
volume_name => "$name",
require => Glusterfs::Add_peers[$nodes];
}

The question is, how do I access the hostname and state keys inside each node?

The following (inside add_bricks):

$node = $name['hostname']
notice ("DEBUG nodes=$name")
notice ("DEBUG NODE=$node")

yields, for each call to add_bricks:

DEBUG nodes=statemountedgfs01.us1.xxx.com hostnamegfs01
DEBUG NODE=

I can see the hash in $name... I just can't access the 'state' or
'hostname' keys, which are obviously there.

How...?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Exec{} keeps running

2012-08-28 Thread Douglas Garstang
Thanks. This one turned out to be user error. :)

On Tue, Aug 28, 2012 at 7:08 AM, jcbollinger  wrote:
>
>
> On Monday, August 27, 2012 5:39:36 PM UTC-5, Douglas wrote:
>>
>> Argh. I have the definition below. The gluster peer probe command has
>> already been executed successfully, and I'm testing it with 'peer
>> status'. Running the unless=> command yields:
>>
>> root@gfs01:~# /usr/sbin/gluster peer status | /bin/grep gfs02.us1.xxx.com
>> Hostname: gfs02.us1.xxx.com
>> root@gfs01:~# echo $?
>> 0
>>
>> Therefore, the command should never run again, but it is, as evidenced
>> by the fact that /tmp/foo keeps getting X appended to it.
>>
>> define glusterfs::probe_peer ( $ensure, $master_node ) {
>>
>> if $master_node == $::fqdn {
>> case $ensure {
>> 'probed': {
>> exec {
>> "add-peer-$name":
>> #command => "/usr/sbin/gluster peer probe $name",
>> command => "/bin/echo X >> /tmp/foo",
>> logoutput => true,
>> unless => "/usr/sbin/gluster peer status |
>> /bin/grep $name";
>> }
>> }
>> }
>> }
>> }
>>
>
> Usually this kind of problem arises when the command being run (the 'unless'
> command in this case) relies on an environment variable whose presence or
> value differs in an interactive shell from what the (very sparse)
> environment in which an Exec runs things.
>
> In this case, I also don't have enough information to rule out the
> possibility that $name's value differs from the expected value of
> "gfs02.us1.xxx.com".
>
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/aOuMVbKCDKIJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Hiera lookup by function.

2012-08-28 Thread Douglas Garstang
In addition to hiera looking at files based on environment and node
role etc, I'd like to be able to specify a file name based on
function. Ie break keys into files by function. Is there a way to do
this?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Array References?

2012-08-27 Thread Douglas Garstang
The first notice command shows the array as having two elements. The
second notice command shows the same array as having only one element.
Some sort of variable reference thing? How can I make a copy of the
$nodes array rather than make a reference to it?

notice ("NODES1=$nodes")
$n2 = $nodes
$useless = inline_template("<%= n2.shift -%>")
notice ("NODES2=$nodes")

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Exec{} keeps running

2012-08-27 Thread Douglas Garstang
Argh. I have the definition below. The gluster peer probe command has
already been executed successfully, and I'm testing it with 'peer
status'. Running the unless=> command yields:

root@gfs01:~# /usr/sbin/gluster peer status | /bin/grep gfs02.us1.xxx.com
Hostname: gfs02.us1.xxx.com
root@gfs01:~# echo $?
0

Therefore, the command should never run again, but it is, as evidenced
by the fact that /tmp/foo keeps getting X appended to it.

define glusterfs::probe_peer ( $ensure, $master_node ) {

if $master_node == $::fqdn {
case $ensure {
'probed': {
exec {
"add-peer-$name":
#command => "/usr/sbin/gluster peer probe $name",
command => "/bin/echo X >> /tmp/foo",
logoutput => true,
unless => "/usr/sbin/gluster peer status |
/bin/grep $name";
}
}
}
}
}

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Loading Hiera into array/hash

2012-08-27 Thread Douglas Garstang
This is driving me crazy. I'm trying to load the nodes array into a
puppet array with hiera. Hiera seems to always flatten an array or a
hash to a string, with no delimiter in between, which makes it hard to
split into an array later on.

The hiera_hash and hiera_array functions only take a single key, so
there's no way that I can see to drill down into a multi level yaml
file like below.

glusterfs_volumes:
  gfsvol01:
master_server: gfs01.us1.xxx.com
transport: tcp
name: gfsvol01
replicas: 1
nodes:
  - gfs01.us1.xxx.com
  - gfs02.us1.xxx.com
brick_store: /var/bricks

How can I do this?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Append string to list items.

2012-08-27 Thread Douglas Garstang
Trevor,

Thanks. I'm getting 'bad target Array' with:

define glusterfs::volume_create ( $brick_store, $nodes, $replicas='1',
$transport='tcp' ) {
 .

$n2 = regsubst ($nodes, '$', ":$brick_store") # Bad target array here.
notice ("bricks = $n2")
}

On entering the define, $nodes = ['gfs01.us1.xxx.com',
'gfs02.us1.xxx.com'] and $brick_store="/var/bricks"

Doug.

On Mon, Aug 27, 2012 at 12:44 PM, Trevor Vaughan  wrote:
> Try using regsubst:
> http://docs.puppetlabs.com/references/stable/function.html#regsubst
>
> On Mon, Aug 27, 2012 at 3:03 PM, Douglas Garstang
>  wrote:
>> I have an array:
>>
>> $nodes = ['gfs01' ,'gfs02', 'gfs03', 'gfs04]
>>
>> and a string variable:
>>
>> $brick_store = "/var/bricks"
>>
>> How can I append "/var/bricks" to each item in the array? Lack of a
>> looping construct makes this challenging in puppet.
>>
>> Such that:
>>
>> brick_array = ['gfs01:/var/bricks', 'gfs02:/var/bricks', ... ]
>>
>> I also need to come up with a way to append a further sequence of
>> incrementing brick numbers to the items as well.
>>
>> Doug
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>
>
> --
> 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 post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Append string to list items.

2012-08-27 Thread Douglas Garstang
I have an array:

$nodes = ['gfs01' ,'gfs02', 'gfs03', 'gfs04]

and a string variable:

$brick_store = "/var/bricks"

How can I append "/var/bricks" to each item in the array? Lack of a
looping construct makes this challenging in puppet.

Such that:

brick_array = ['gfs01:/var/bricks', 'gfs02:/var/bricks', ... ]

I also need to come up with a way to append a further sequence of
incrementing brick numbers to the items as well.

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Dependencies between defines

2012-08-22 Thread Douglas Garstang
On Wed, Aug 22, 2012 at 6:06 AM, Martin Alfke  wrote:
>
> On 22.08.2012, at 14:27, Axel Bock wrote:
>
> Hi readers
>
> another question for my little puppet project: Can I (and if yes, how)
> define dependendies between puppet "defines"? (define like in define
> mymodule::mydefine() {...})
>
> Example: I have a define "prepare_cool_thing" and another define
> "cool_thing". Both can be on a machine several times (quite, actually, like
> vhosts :). So this is entirely valid:
>
> prepare_cool_thing{ "name1" : }
> cool_thing{ "name1" : }
>
> prepare_cool_thing{ "name2" : }
> cool_thing{ "name2" : }
>
> I'm sure you get it. BUT. I'd like to state within the cool_thing define
> that the prepare_cool_thing was executed. Can I do that? The following does
> not seem to do what I want:
>
> Prepare_cool_thing[ "name1" ] -> Cool_thing[ "name1" ]  # naah, does not
> work.
>
>
> Where did you put the dependency?
> What puppet version are you using.
>
> Normally this works:
>
> define task_one ( $user = 'root' ) {
> file { '/tmp/one':
>   owner => $user,
>   content => $user,
>}
> }
> define task_two ( $user = 'root' ) {
>file { '/tmp/two':
>   owner => $user,
>   content => $user,
>}
> }
> task_one { 'foo': }
> task_two { 'foo': }
> Task_one['foo'] -> Task_two['foo']
>
> You can also place the order inside the define:
>
> define task_two ( $user = 'root') {
>file { '/tmp/two':
>   owner => $name,
>   content => $name,
>}
>Task_one["$name"] -> Task_two["$name"]
> }

This really irks me. Is this documented anywhere? How did Task_one get
into scope inside Task_two? What is the scope for definitions? Are
they global?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Refreshing Definitions

2012-08-22 Thread Douglas Garstang
I'm very confused about something. The definition below is used to set
up swap. The three definitions, lvm::swapvol_make, lvm::swapvol_on and
lvm::swapvol_fstab, where previously inside this definition, but I
broke them into separate defines as I realised that the more I use the
$ensure parameter on a resource, the more likely it was that I'd have
to perform certain functions multiple times.

Previously I could chain those three resources together with subscribe
and refreshonly. However, refreshonly only works with Exec {}
resources. So, now that they are in their own definitions, how do I do
this? I can't put the refreshonly in the definition, because a) I
don't think it will be in scope, and b) it makes the definition no
longer general in nature.

Doug.

define lvm::swapvol ( $ensure, $volume_group, $size, $pvdisk_count ) {

case $ensure {

'mounted': {
#
# Logical volumes.
#
lvm::logical_volume {
#
# Create a logical volume for swap.
#
"$name":
ensure   => present,
volume_group => "$volume_group",
size => "$size",
pvdisk_count => "$pvdisk_count";
#require  => Lvm::Volume_group["$volume_group"];
}

lvm::swapvol_make {
"$name":
volume_group => "$volume_group",
subscribe => Lvm::Logical_volume["$name"],
refreshonly => true;
}

lvm::swapvol_on {
"$name":
volume_group => "$volume_group",
subscribe => Lvm::Swapvol_make["$name"],
refreshonly => true;
}

lvm::swapvol_fstab {
"$name":
volume_group => "$volume_group",
subscribe => Lvm::Swapvol_on["$name"],
refreshonly => true;
}

}

'umounted': {
}

'absent': {
}

}

}

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Hiera to hash

2012-08-22 Thread Douglas Garstang
This in insanity.

Now I have:
$ec2_config = hiera('ec2_config')

if $::ec2_instance_id {
$pvdisks = $ec2_config['instance'][$::ec2_instance_type]['pvdisks']
$pvdisk_count = inline_template('<%= @pvdisks.length %>')
$swapvol_enabled =
$ec2_config['instance'][$::ec2_instance_type]['volumes']['swap']['enabled']
$logvol_enabled =
$ec2_config['instance'][$::ec2_instance_type]['volumes']['log']['enabled']
notice ("HERE0 ($swapvol_enabled) ($logvol_enabled)")
if ($swapvol_enabled == 'true') {
$swapvol_size =
$ec2_config['instance'][$::ec2_instance_type]['volumes']['swap']['size']
notice ("HERE1")
}
if ($logvol_enabled == 'true') {
$logvol_size =
$ec2_config['instance'][$::ec2_instance_type]['volumes']['log']['size']
notice("HERE2")
}
notice ("HERE3 $swapvol_size $swapvol_size")
}

The first HERE0 correctly displays '(true) (true)' in the logs.
However, on the very next line, where the condition is if
$swapvol_enabled == 'true',it returns false. WTF???

Doug

On Wed, Aug 22, 2012 at 1:56 PM, Wolf Noble  wrote:
> I accomplished something similar awhile back.
>
> While I've not spent much time looking at your particular problem, I think 
> this'll help point you in the direction of what you need…
>
>
>
> class mymodule::params{
> $collector= hiera('mymodule_collector','')
> }
>
> class mymodule::config{
>  $collector   = $mymodule::params::collector
>  $ipstring= inline_template("<% collector.each_pair do |key, hash| 
> %><%=hash['ip']%>,<%end%>")
>  $ips = split ($ipstring,',')
> }
>
> define mymodule::add_hosts_allow () {
>   exec { "hosts_allow_$title":
> command => "/bin/echo \"myservice : $title : ALLOW\" >>/etc/hosts.allow",
> unless  => "/bin/grep -c \"myservice : $title : ALLOW\" /etc/hosts.allow",
>   } #end exec
> }
>
>
> On Aug 21, 2012, at 11:00 PM, Douglas Garstang  
> wrote:
>
>> I know I did this once before but can't find docs on how to do it again.
>>
>> I have this in a yaml file:
>>
>> pvdisks:
>>ec2_pvdisks_m1.small:
>>disks: /dev/xvdb1
>>enabled: yes
>>
>> Loading it with hiera.
>>
>> Manifest has:
>>
>>$testkey = hiera('pvdisks')
>>notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>
>> This is printing
>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>>
>> which obviously is the data picked into a string.
>>
>> Doug.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>
> 
>
> This message may contain confidential or privileged information. If you are 
> not the intended recipient, please advise us immediately and delete this 
> message. See http://www.datapipe.com/legal/email_disclaimer/ for further 
> information on confidentiality and the risks of non-secure electronic 
> communication. If you cannot access these links, please notify us by reply 
> message and we will send the contents to you.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Hiera to hash

2012-08-22 Thread Douglas Garstang
On Wed, Aug 22, 2012 at 1:52 PM, Douglas Garstang
 wrote:
> On Wed, Aug 22, 2012 at 1:43 PM, Justin Stoller  wrote:
>> On Wed, Aug 22, 2012 at 1:34 PM, Douglas Garstang
>>  wrote:
>>> On Wed, Aug 22, 2012 at 11:08 AM, Douglas Garstang
>>>  wrote:
>>>> On Tue, Aug 21, 2012 at 11:51 PM, Douglas Garstang
>>>>  wrote:
>>>>> On Tue, Aug 21, 2012 at 11:44 PM, Douglas Garstang
>>>>>  wrote:
>>>>>> On Tue, Aug 21, 2012 at 11:19 PM, Stephen Gran
>>>>>>  wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> On Tue, 2012-08-21 at 21:00 -0700, Douglas Garstang wrote:
>>>>>>>> I know I did this once before but can't find docs on how to do it 
>>>>>>>> again.
>>>>>>>>
>>>>>>>> I have this in a yaml file:
>>>>>>>>
>>>>>>>> pvdisks:
>>>>>>>> ec2_pvdisks_m1.small:
>>>>>>>> disks: /dev/xvdb1
>>>>>>>> enabled: yes
>>>>>>>>
>>>>>>>> Loading it with hiera.
>>>>>>>>
>>>>>>>> Manifest has:
>>>>>>>>
>>>>>>>> $testkey = hiera('pvdisks')
>>>>>>>> notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>>>>>>>
>>>>>>>> This is printing
>>>>>>>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>>>>>>>
>>>>>>> Try inspecting it some other way than printf debugging - notice always
>>>>>>> flattens variables by calling .to_s on them, so it is not a very useful
>>>>>>> tool.  I am assuming that things are indeed fine, but this is confusing
>>>>>>> matters.
>>>>>>
>>>>>> I've since learned that I have to use hiera_array and hiera_hash,
>>>>>> which aren't documented anywhere.
>>>>>>
>>>>>> Now I've got:
>>>>>>
>>>>>> ec2_config:
>>>>>>   instance:
>>>>>>   m1.small:
>>>>>> pvdisks:
>>>>>> - /dev/xvdb1
>>>>>> swapvol_size: 2G
>>>>>> logvol_size: 64G
>>>>>>   m1.medium:
>>>>>> pvdisks:
>>>>>> - /dev/xvdb1
>>>>>> swapvol_size: 2G
>>>>>> logvol_size: 64G
>>>>>>   m1.large:
>>>>>> pvdisks:
>>>>>> - /dev/xvdb1
>>>>>> - /dev/xvdc1
>>>>>> swapvol_size: 4G
>>>>>> logvol_size: 64G
>>>>>>
>>>>>> and I've tried to access the data every witch way.
>>>>>>
>>>>>> This gives me a syntax error...
>>>>>> $pvdisks = 
>>>>>> hiera_array(ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>>>>
>>>>>> and this:
>>>>>> $pvdisks = 
>>>>>> hiera_array($ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>>>>
>>>>>> gives me:
>>>>>> err: Could not retrieve catalog from remote server: Error 400 on
>>>>>> SERVER: ec2_config is not an hash or array when accessing it with
>>>>>> instance at 
>>>>>> /truth/sauce/env/prod/modules/role/manifests/base_server.pp:27
>>>>>> on node gfs01.us1.xxx.com
>>>>>>
>>>>>> Ugh.
>>>>>>
>>>>>> Doug.
>>>>>
>>>>> Actually, apparently, no, that's not what these functions are for. :(
>>>>>
>>>>> Doug.
>>>>
>>>> :(
>>>
>>> Apparently this is difficult and/or not supported...
>>
>> Is this what you're trying to do?
>>
>> $ec2_config = hiera('ec2_config')
>> $pvdisks = $ec2_config['instance'][$::ec2_instance_type]['pvdisks']
>>
>>
>> http://docs.puppetlabs.com/puppet/2.7/reference/lang_datatypes.html#hashes
>
> No luck.
>
> With:
>
> ec2_config:
>   instance:
>   m1.small:
> pvdisks:
> - /dev/xvdb1
> swapvol_size: 2G
> logvol_size: 64G
>   m1.medium:
> pvdisks:
> - /dev/xvdb1
> swapvol_size: 2G
> logvol_size: 64G
>
> etc...
>
> and in the manifest:
>
> $foo = hiera_hash('ec2_config')
> $pvdisks = $foo['instance'][$::ec2_instance_type]['pvdisks']  #
> Line 17 from error below.
> notice ("PVDISKS = $pvdisks")
>
> puppet bails with:
>
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: $foo["instance"] is not an hash or array when accessing it
> with m1.large at
> /truth/sauce/env/prod/modules/role/manifests/base_server.pp:17 on node
> gfs01.us1.xxx.co,
>
> G.
>
> Doug.

I think I got it... yaml file was bad...

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Hiera to hash

2012-08-22 Thread Douglas Garstang
On Wed, Aug 22, 2012 at 1:43 PM, Justin Stoller  wrote:
> On Wed, Aug 22, 2012 at 1:34 PM, Douglas Garstang
>  wrote:
>> On Wed, Aug 22, 2012 at 11:08 AM, Douglas Garstang
>>  wrote:
>>> On Tue, Aug 21, 2012 at 11:51 PM, Douglas Garstang
>>>  wrote:
>>>> On Tue, Aug 21, 2012 at 11:44 PM, Douglas Garstang
>>>>  wrote:
>>>>> On Tue, Aug 21, 2012 at 11:19 PM, Stephen Gran
>>>>>  wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Tue, 2012-08-21 at 21:00 -0700, Douglas Garstang wrote:
>>>>>>> I know I did this once before but can't find docs on how to do it again.
>>>>>>>
>>>>>>> I have this in a yaml file:
>>>>>>>
>>>>>>> pvdisks:
>>>>>>> ec2_pvdisks_m1.small:
>>>>>>> disks: /dev/xvdb1
>>>>>>> enabled: yes
>>>>>>>
>>>>>>> Loading it with hiera.
>>>>>>>
>>>>>>> Manifest has:
>>>>>>>
>>>>>>> $testkey = hiera('pvdisks')
>>>>>>> notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>>>>>>
>>>>>>> This is printing
>>>>>>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>>>>>>
>>>>>> Try inspecting it some other way than printf debugging - notice always
>>>>>> flattens variables by calling .to_s on them, so it is not a very useful
>>>>>> tool.  I am assuming that things are indeed fine, but this is confusing
>>>>>> matters.
>>>>>
>>>>> I've since learned that I have to use hiera_array and hiera_hash,
>>>>> which aren't documented anywhere.
>>>>>
>>>>> Now I've got:
>>>>>
>>>>> ec2_config:
>>>>>   instance:
>>>>>   m1.small:
>>>>> pvdisks:
>>>>> - /dev/xvdb1
>>>>> swapvol_size: 2G
>>>>> logvol_size: 64G
>>>>>   m1.medium:
>>>>> pvdisks:
>>>>> - /dev/xvdb1
>>>>> swapvol_size: 2G
>>>>> logvol_size: 64G
>>>>>   m1.large:
>>>>> pvdisks:
>>>>> - /dev/xvdb1
>>>>> - /dev/xvdc1
>>>>> swapvol_size: 4G
>>>>> logvol_size: 64G
>>>>>
>>>>> and I've tried to access the data every witch way.
>>>>>
>>>>> This gives me a syntax error...
>>>>> $pvdisks = 
>>>>> hiera_array(ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>>>
>>>>> and this:
>>>>> $pvdisks = 
>>>>> hiera_array($ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>>>
>>>>> gives me:
>>>>> err: Could not retrieve catalog from remote server: Error 400 on
>>>>> SERVER: ec2_config is not an hash or array when accessing it with
>>>>> instance at /truth/sauce/env/prod/modules/role/manifests/base_server.pp:27
>>>>> on node gfs01.us1.xxx.com
>>>>>
>>>>> Ugh.
>>>>>
>>>>> Doug.
>>>>
>>>> Actually, apparently, no, that's not what these functions are for. :(
>>>>
>>>> Doug.
>>>
>>> :(
>>
>> Apparently this is difficult and/or not supported...
>
> Is this what you're trying to do?
>
> $ec2_config = hiera('ec2_config')
> $pvdisks = $ec2_config['instance'][$::ec2_instance_type]['pvdisks']
>
>
> http://docs.puppetlabs.com/puppet/2.7/reference/lang_datatypes.html#hashes

No luck.

With:

ec2_config:
  instance:
  m1.small:
pvdisks:
- /dev/xvdb1
swapvol_size: 2G
logvol_size: 64G
  m1.medium:
pvdisks:
- /dev/xvdb1
swapvol_size: 2G
logvol_size: 64G

etc...

and in the manifest:

$foo = hiera_hash('ec2_config')
$pvdisks = $foo['instance'][$::ec2_instance_type]['pvdisks']  #
Line 17 from error below.
notice ("PVDISKS = $pvdisks")

puppet bails with:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: $foo["instance"] is not an hash or array when accessing it
with m1.large at
/truth/sauce/env/prod/modules/role/manifests/base_server.pp:17 on node
gfs01.us1.xxx.co,

G.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Hiera to hash

2012-08-22 Thread Douglas Garstang
On Wed, Aug 22, 2012 at 11:08 AM, Douglas Garstang
 wrote:
> On Tue, Aug 21, 2012 at 11:51 PM, Douglas Garstang
>  wrote:
>> On Tue, Aug 21, 2012 at 11:44 PM, Douglas Garstang
>>  wrote:
>>> On Tue, Aug 21, 2012 at 11:19 PM, Stephen Gran
>>>  wrote:
>>>> Hi,
>>>>
>>>> On Tue, 2012-08-21 at 21:00 -0700, Douglas Garstang wrote:
>>>>> I know I did this once before but can't find docs on how to do it again.
>>>>>
>>>>> I have this in a yaml file:
>>>>>
>>>>> pvdisks:
>>>>> ec2_pvdisks_m1.small:
>>>>> disks: /dev/xvdb1
>>>>> enabled: yes
>>>>>
>>>>> Loading it with hiera.
>>>>>
>>>>> Manifest has:
>>>>>
>>>>> $testkey = hiera('pvdisks')
>>>>> notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>>>>
>>>>> This is printing
>>>>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>>>>
>>>> Try inspecting it some other way than printf debugging - notice always
>>>> flattens variables by calling .to_s on them, so it is not a very useful
>>>> tool.  I am assuming that things are indeed fine, but this is confusing
>>>> matters.
>>>
>>> I've since learned that I have to use hiera_array and hiera_hash,
>>> which aren't documented anywhere.
>>>
>>> Now I've got:
>>>
>>> ec2_config:
>>>   instance:
>>>   m1.small:
>>> pvdisks:
>>> - /dev/xvdb1
>>> swapvol_size: 2G
>>> logvol_size: 64G
>>>   m1.medium:
>>> pvdisks:
>>> - /dev/xvdb1
>>> swapvol_size: 2G
>>> logvol_size: 64G
>>>   m1.large:
>>> pvdisks:
>>> - /dev/xvdb1
>>> - /dev/xvdc1
>>> swapvol_size: 4G
>>> logvol_size: 64G
>>>
>>> and I've tried to access the data every witch way.
>>>
>>> This gives me a syntax error...
>>> $pvdisks = 
>>> hiera_array(ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>
>>> and this:
>>> $pvdisks = 
>>> hiera_array($ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>
>>> gives me:
>>> err: Could not retrieve catalog from remote server: Error 400 on
>>> SERVER: ec2_config is not an hash or array when accessing it with
>>> instance at /truth/sauce/env/prod/modules/role/manifests/base_server.pp:27
>>> on node gfs01.us1.xxx.com
>>>
>>> Ugh.
>>>
>>> Doug.
>>
>> Actually, apparently, no, that's not what these functions are for. :(
>>
>> Doug.
>
> :(

Apparently this is difficult and/or not supported...

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Hiera to hash

2012-08-22 Thread Douglas Garstang
On Tue, Aug 21, 2012 at 11:51 PM, Douglas Garstang
 wrote:
> On Tue, Aug 21, 2012 at 11:44 PM, Douglas Garstang
>  wrote:
>> On Tue, Aug 21, 2012 at 11:19 PM, Stephen Gran
>>  wrote:
>>> Hi,
>>>
>>> On Tue, 2012-08-21 at 21:00 -0700, Douglas Garstang wrote:
>>>> I know I did this once before but can't find docs on how to do it again.
>>>>
>>>> I have this in a yaml file:
>>>>
>>>> pvdisks:
>>>> ec2_pvdisks_m1.small:
>>>> disks: /dev/xvdb1
>>>> enabled: yes
>>>>
>>>> Loading it with hiera.
>>>>
>>>> Manifest has:
>>>>
>>>> $testkey = hiera('pvdisks')
>>>> notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>>>
>>>> This is printing
>>>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>>>
>>> Try inspecting it some other way than printf debugging - notice always
>>> flattens variables by calling .to_s on them, so it is not a very useful
>>> tool.  I am assuming that things are indeed fine, but this is confusing
>>> matters.
>>
>> I've since learned that I have to use hiera_array and hiera_hash,
>> which aren't documented anywhere.
>>
>> Now I've got:
>>
>> ec2_config:
>>   instance:
>>   m1.small:
>> pvdisks:
>> - /dev/xvdb1
>> swapvol_size: 2G
>> logvol_size: 64G
>>   m1.medium:
>> pvdisks:
>> - /dev/xvdb1
>> swapvol_size: 2G
>> logvol_size: 64G
>>   m1.large:
>> pvdisks:
>> - /dev/xvdb1
>> - /dev/xvdc1
>> swapvol_size: 4G
>> logvol_size: 64G
>>
>> and I've tried to access the data every witch way.
>>
>> This gives me a syntax error...
>> $pvdisks = 
>> hiera_array(ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>
>> and this:
>> $pvdisks = 
>> hiera_array($ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>
>> gives me:
>> err: Could not retrieve catalog from remote server: Error 400 on
>> SERVER: ec2_config is not an hash or array when accessing it with
>> instance at /truth/sauce/env/prod/modules/role/manifests/base_server.pp:27
>> on node gfs01.us1.xxx.com
>>
>> Ugh.
>>
>> Doug.
>
> Actually, apparently, no, that's not what these functions are for. :(
>
> Doug.

:(

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Hiera to hash

2012-08-21 Thread Douglas Garstang
On Tue, Aug 21, 2012 at 11:44 PM, Douglas Garstang
 wrote:
> On Tue, Aug 21, 2012 at 11:19 PM, Stephen Gran
>  wrote:
>> Hi,
>>
>> On Tue, 2012-08-21 at 21:00 -0700, Douglas Garstang wrote:
>>> I know I did this once before but can't find docs on how to do it again.
>>>
>>> I have this in a yaml file:
>>>
>>> pvdisks:
>>> ec2_pvdisks_m1.small:
>>> disks: /dev/xvdb1
>>> enabled: yes
>>>
>>> Loading it with hiera.
>>>
>>> Manifest has:
>>>
>>> $testkey = hiera('pvdisks')
>>> notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>>
>>> This is printing
>>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>>
>> Try inspecting it some other way than printf debugging - notice always
>> flattens variables by calling .to_s on them, so it is not a very useful
>> tool.  I am assuming that things are indeed fine, but this is confusing
>> matters.
>
> I've since learned that I have to use hiera_array and hiera_hash,
> which aren't documented anywhere.
>
> Now I've got:
>
> ec2_config:
>   instance:
>   m1.small:
> pvdisks:
> - /dev/xvdb1
> swapvol_size: 2G
> logvol_size: 64G
>   m1.medium:
> pvdisks:
> - /dev/xvdb1
> swapvol_size: 2G
> logvol_size: 64G
>   m1.large:
> pvdisks:
> - /dev/xvdb1
> - /dev/xvdc1
> swapvol_size: 4G
> logvol_size: 64G
>
> and I've tried to access the data every witch way.
>
> This gives me a syntax error...
> $pvdisks = 
> hiera_array(ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>
> and this:
> $pvdisks = 
> hiera_array($ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>
> gives me:
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: ec2_config is not an hash or array when accessing it with
> instance at /truth/sauce/env/prod/modules/role/manifests/base_server.pp:27
> on node gfs01.us1.xxx.com
>
> Ugh.
>
> Doug.

Actually, apparently, no, that's not what these functions are for. :(

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Hiera to hash

2012-08-21 Thread Douglas Garstang
On Tue, Aug 21, 2012 at 11:19 PM, Stephen Gran
 wrote:
> Hi,
>
> On Tue, 2012-08-21 at 21:00 -0700, Douglas Garstang wrote:
>> I know I did this once before but can't find docs on how to do it again.
>>
>> I have this in a yaml file:
>>
>> pvdisks:
>> ec2_pvdisks_m1.small:
>> disks: /dev/xvdb1
>> enabled: yes
>>
>> Loading it with hiera.
>>
>> Manifest has:
>>
>> $testkey = hiera('pvdisks')
>> notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>
>> This is printing
>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>
> Try inspecting it some other way than printf debugging - notice always
> flattens variables by calling .to_s on them, so it is not a very useful
> tool.  I am assuming that things are indeed fine, but this is confusing
> matters.

I've since learned that I have to use hiera_array and hiera_hash,
which aren't documented anywhere.

Now I've got:

ec2_config:
  instance:
  m1.small:
pvdisks:
- /dev/xvdb1
swapvol_size: 2G
logvol_size: 64G
  m1.medium:
pvdisks:
- /dev/xvdb1
swapvol_size: 2G
logvol_size: 64G
  m1.large:
pvdisks:
- /dev/xvdb1
- /dev/xvdc1
swapvol_size: 4G
logvol_size: 64G

and I've tried to access the data every witch way.

This gives me a syntax error...
$pvdisks = hiera_array(ec2_config['instance'][$::ec2_instance_type]['pvdisks'])

and this:
$pvdisks = hiera_array($ec2_config['instance'][$::ec2_instance_type]['pvdisks'])

gives me:
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: ec2_config is not an hash or array when accessing it with
instance at /truth/sauce/env/prod/modules/role/manifests/base_server.pp:27
on node gfs01.us1.xxx.com

Ugh.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Hiera to hash

2012-08-21 Thread Douglas Garstang
I know I did this once before but can't find docs on how to do it again.

I have this in a yaml file:

pvdisks:
ec2_pvdisks_m1.small:
disks: /dev/xvdb1
enabled: yes

Loading it with hiera.

Manifest has:

$testkey = hiera('pvdisks')
notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")

This is printing
TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']

which obviously is the data picked into a string.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Dynamic Lookup of facter variable.

2012-08-19 Thread Douglas Garstang
Oh god that's ugly.

On Sun, Aug 19, 2012 at 7:48 PM, Eric Shamow  wrote:
> Facts exist at top scope, as indicated in the scoping doc several people have 
> referred you to on this list.  Use $::ec2_instance_type
>
> Sent from my iPad
>
> On Aug 19, 2012, at 10:44 PM, Douglas Garstang  
> wrote:
>
>> I don't get it...
>>
>>if ! ( $ec2_instance_type in [$ec2_inst_type_allow]) {
>>notice("NOT ALLOWED")
>>} else {
>>notice("ALLOWED")
>>}
>>
>> 2012-08-20T02:39:10.537134+00:00 truth puppet-master[24080]: Dynamic
>> lookup of $ec2_instance_type at /truth/sauce/env/prod/modules/rol
>> e/manifests/validate_server.pp:12 is deprecated.  Support will be
>> removed in Puppet 2.8.  Use a fully-qualified variable name (e.g., $
>> classname::variable) or parameterized classes.
>>
>> Line 12 is the if statement. However, on the same client system...
>>
>> [us1:i-16c5c050] root@testweb11:~# facter | grep ec2_instance_type
>> ec2_instance_type => m1.large
>>
>> It's a facter variable. What's it complaining about?
>>
>> Doug.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Dynamic Lookup of facter variable.

2012-08-19 Thread Douglas Garstang
I don't get it...

if ! ( $ec2_instance_type in [$ec2_inst_type_allow]) {
notice("NOT ALLOWED")
} else {
notice("ALLOWED")
}

2012-08-20T02:39:10.537134+00:00 truth puppet-master[24080]: Dynamic
lookup of $ec2_instance_type at /truth/sauce/env/prod/modules/rol
e/manifests/validate_server.pp:12 is deprecated.  Support will be
removed in Puppet 2.8.  Use a fully-qualified variable name (e.g., $
classname::variable) or parameterized classes.

Line 12 is the if statement. However, on the same client system...

[us1:i-16c5c050] root@testweb11:~# facter | grep ec2_instance_type
ec2_instance_type => m1.large

It's a facter variable. What's it complaining about?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Default node

2012-08-17 Thread Douglas Garstang
Totally lost.

On Fri, Aug 17, 2012 at 5:47 PM, Stuart Cracraft  wrote:
> Doug: I hope you are wrong about that as it would be a bad non-explicit, very 
> Ruby-like choice of indirectness
> for controlling and detailing what should be plain-and-simple and Iowa-like.
>
> Stuart
>
> On Aug 17, 2012, at 2:27 PM, Douglas Garstang  wrote:
>
>> Seems like nodes are matching the default node before they are
>> matching the more specific nodes. My site.pp has:
>>
>> include "nodes/*.pp"
>>
>> In the nodes directory are two files, default.pp and nagios_server.pp.
>>
>> default.pp:
>> node default {
>>include role::common
>> }
>>
>> nagios_server.pp:
>> node 'mon01.us1.xxx.com' {
>>$node_env = "production"
>>include nagios::plugins
>>include nagios::server
>> }
>>
>> Puppet is finding the default on mon01.us1.xxx.com. If I comment out
>> the lines in default.pp, it goes to mon01.us1.bitcasa.com. Shouldn't
>> it use the default node last?
>>
>> Doug.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Default node

2012-08-17 Thread Douglas Garstang
Seems like nodes are matching the default node before they are
matching the more specific nodes. My site.pp has:

include "nodes/*.pp"

In the nodes directory are two files, default.pp and nagios_server.pp.

default.pp:
node default {
include role::common
}

nagios_server.pp:
node 'mon01.us1.xxx.com' {
$node_env = "production"
include nagios::plugins
include nagios::server
}

Puppet is finding the default on mon01.us1.xxx.com. If I comment out
the lines in default.pp, it goes to mon01.us1.bitcasa.com. Shouldn't
it use the default node last?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Unless/Onlyif vs Subscribe/Refreshonly

2012-08-17 Thread Douglas Garstang
On Fri, Aug 17, 2012 at 2:01 PM, jcbollinger  wrote:
>
>
> On Friday, August 17, 2012 11:23:46 AM UTC-5, Douglas wrote:
>>
>> When chaining execs together, and wanting to ensure that exec
>> resources are not executed on every puppet run, which method is
>> better? Using unless/onlyif or subscribe/refreshonly?
>>
>> With unless/onlyif, the exec is evaluated every time. With
>> subscribe/refreshonly, the exec is only executed when a dependent
>> resource changes
>
>
>
> Neither mechanism is better than the other in any general sense.  They serve
> different purposes, and it is uncommon that both are applicable to any given
> configuration objective.
>
> The 'unless' and 'onlyif' (and 'creates') parameters serve as means for an
> Exec to determine whether it is already in sync.  If it is, then its command
> will not be run, in the same way that a File that is already in sync will
> not redundantly download its content.  This should also have implications
> for reports, etc..  The 'unless' and/or 'ifonly' commands must run every
> time, though.
>
> The 'refreshonly' parameter, on the other hand, makes application of the
> Exec conditional on (and subsequent to) one or more other resources
> changing, sort of like an 'on update' trigger in a database.
>
> In any given case, you should use whichever approach makes sense.

I think...and I might be wrong because I'm a little sleep deprived
today, that it seems like you just said the same thing twice...

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Class Naming Convention

2012-08-17 Thread Douglas Garstang
On Fri, Aug 17, 2012 at 9:33 AM, Douglas Garstang
 wrote:
> On Fri, Aug 17, 2012 at 12:52 AM, Denmat  wrote:
>>
>>
>> On 17/08/2012, at 17:19, Douglas Garstang  wrote:
>>
>>> On Thu, Aug 16, 2012 at 11:34 PM, Garrett Honeycutt
>>>  wrote:
>>>> On 8/16/12 10:44 PM, Douglas Garstang wrote:
>>>>> So, this has always puzzled me a bit. By convention, init.pp contains
>>>>> one class, named the same as the module. However, what is the
>>>>> convention when the module may have multiple external access points?
>>>>> Say you have a module called 'syslog' which provides both a client and
>>>>> a server class. I typically have used syslog::server and
>>>>> syslog::client. I've ended up using this convention more than init.pp
>>>>> because I don't know when I first put the class together exactly what
>>>>> it's going to do. In module mymodule, rather than create init.pp with
>>>>> class mymodule, I'll call it mymodule::base or something and stick it
>>>>> in base.pp. Confused...
>>>>>
>>>>> Doug
>>>>>
>>>>
>>>> Not all classes are meant to be directly included by nodes. A common
>>>> practice would be having a module where you might have a base class,
>>>> such as syslog and other sub classes, such as syslog::client and
>>>> syslog::server. Class syslog would contain resources that were common to
>>>> both syslog::client and syslog::server (ie: they both have a package and
>>>> a config file). Both syslog::client and syslog::server might include (or
>>>> possibly inherit) the syslog class. In this setup, a node might include
>>>> syslog::server or syslog::client, but not syslog directly. When using
>>>> this pattern, be sure to comment in your base class that it is not meant
>>>> to be included directly.
>>>
>>> Garrett, thanks. Aware of all that, but I'm not sure you really answer
>>> my question. :)
>>>
>>> Doug.
>>>
>> Well you can leave init.pp blank, ie,
>> class name {
>> }
>>
>> Then you can put whatever you like in the module's manifest dir.
>>
>> I tend to write 90% of modules with the following:
>> name::config
>> name::install
>> name::service
>> name::client
>> name::server
>>
>> All of those refer to individual .pp files of course.
>>
>> Then something like:
>> include name::server
>
> I guess you would normally include ::client or ::server, and it would
> in turn, include (inherit?) ::config, ::install and ::service?
>
> Ie:
>
> class foo::client {
> include foo::config
> include foo::install
> include foo::service
> }
>
> If variables are defined in ::config, does that cause any issues with scope?

So... I just gave this a try, and variables I defined in ::config have
gone out of scope in ::install. *sigh*

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Class Naming Convention

2012-08-17 Thread Douglas Garstang
On Fri, Aug 17, 2012 at 12:52 AM, Denmat  wrote:
>
>
> On 17/08/2012, at 17:19, Douglas Garstang  wrote:
>
>> On Thu, Aug 16, 2012 at 11:34 PM, Garrett Honeycutt
>>  wrote:
>>> On 8/16/12 10:44 PM, Douglas Garstang wrote:
>>>> So, this has always puzzled me a bit. By convention, init.pp contains
>>>> one class, named the same as the module. However, what is the
>>>> convention when the module may have multiple external access points?
>>>> Say you have a module called 'syslog' which provides both a client and
>>>> a server class. I typically have used syslog::server and
>>>> syslog::client. I've ended up using this convention more than init.pp
>>>> because I don't know when I first put the class together exactly what
>>>> it's going to do. In module mymodule, rather than create init.pp with
>>>> class mymodule, I'll call it mymodule::base or something and stick it
>>>> in base.pp. Confused...
>>>>
>>>> Doug
>>>>
>>>
>>> Not all classes are meant to be directly included by nodes. A common
>>> practice would be having a module where you might have a base class,
>>> such as syslog and other sub classes, such as syslog::client and
>>> syslog::server. Class syslog would contain resources that were common to
>>> both syslog::client and syslog::server (ie: they both have a package and
>>> a config file). Both syslog::client and syslog::server might include (or
>>> possibly inherit) the syslog class. In this setup, a node might include
>>> syslog::server or syslog::client, but not syslog directly. When using
>>> this pattern, be sure to comment in your base class that it is not meant
>>> to be included directly.
>>
>> Garrett, thanks. Aware of all that, but I'm not sure you really answer
>> my question. :)
>>
>> Doug.
>>
> Well you can leave init.pp blank, ie,
> class name {
> }
>
> Then you can put whatever you like in the module's manifest dir.
>
> I tend to write 90% of modules with the following:
> name::config
> name::install
> name::service
> name::client
> name::server
>
> All of those refer to individual .pp files of course.
>
> Then something like:
> include name::server

I guess you would normally include ::client or ::server, and it would
in turn, include (inherit?) ::config, ::install and ::service?

Ie:

class foo::client {
include foo::config
include foo::install
include foo::service
}

If variables are defined in ::config, does that cause any issues with scope?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Unless/Onlyif vs Subscribe/Refreshonly

2012-08-17 Thread Douglas Garstang
When chaining execs together, and wanting to ensure that exec
resources are not executed on every puppet run, which method is
better? Using unless/onlyif or subscribe/refreshonly?

With unless/onlyif, the exec is evaluated every time. With
subscribe/refreshonly, the exec is only executed when a dependent
resource changes

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Class Naming Convention

2012-08-17 Thread Douglas Garstang
On Thu, Aug 16, 2012 at 11:34 PM, Garrett Honeycutt
 wrote:
> On 8/16/12 10:44 PM, Douglas Garstang wrote:
>> So, this has always puzzled me a bit. By convention, init.pp contains
>> one class, named the same as the module. However, what is the
>> convention when the module may have multiple external access points?
>> Say you have a module called 'syslog' which provides both a client and
>> a server class. I typically have used syslog::server and
>> syslog::client. I've ended up using this convention more than init.pp
>> because I don't know when I first put the class together exactly what
>> it's going to do. In module mymodule, rather than create init.pp with
>> class mymodule, I'll call it mymodule::base or something and stick it
>> in base.pp. Confused...
>>
>> Doug
>>
>
> Not all classes are meant to be directly included by nodes. A common
> practice would be having a module where you might have a base class,
> such as syslog and other sub classes, such as syslog::client and
> syslog::server. Class syslog would contain resources that were common to
> both syslog::client and syslog::server (ie: they both have a package and
> a config file). Both syslog::client and syslog::server might include (or
> possibly inherit) the syslog class. In this setup, a node might include
> syslog::server or syslog::client, but not syslog directly. When using
> this pattern, be sure to comment in your base class that it is not meant
> to be included directly.

Garrett, thanks. Aware of all that, but I'm not sure you really answer
my question. :)

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Class Naming Convention

2012-08-16 Thread Douglas Garstang
So, this has always puzzled me a bit. By convention, init.pp contains
one class, named the same as the module. However, what is the
convention when the module may have multiple external access points?
Say you have a module called 'syslog' which provides both a client and
a server class. I typically have used syslog::server and
syslog::client. I've ended up using this convention more than init.pp
because I don't know when I first put the class together exactly what
it's going to do. In module mymodule, rather than create init.pp with
class mymodule, I'll call it mymodule::base or something and stick it
in base.pp. Confused...

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Custom Facts accessible via Facter

2012-08-15 Thread Douglas Garstang
On Wed, Aug 15, 2012 at 10:46 PM, Florian Koch
 wrote:
> Try
>
> Facter  - p
>
> Regards

Thanks. Didn't know about that. Now, back to scraping my eyeballs with
a blunt rusty razor blade, err looking at ruby code.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Custom Facts accessible via Facter

2012-08-15 Thread Douglas Garstang
I don't get it. I just wrote a simple test custom fact in ruby (ugh, I
hate ruby) and was able to access it as a variable on the client side.
However, it doesn't appear in the facter output. Is is supposed to?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Array Length

2012-08-15 Thread Douglas Garstang
On Wed, Aug 15, 2012 at 5:03 PM, Calvin Walton  wrote:
> On Wed, 2012-08-15 at 14:59 -0700, Douglas Garstang wrote:
>> On Wed, Aug 15, 2012 at 2:58 PM, Douglas Garstang
>> Oops.Typo in paste.I actually used
>>
>> $foo = inline_template("<%= [$pvdisks] %>.length")
>
> You seem to be misunderstanding how erb templates work; I strongly
> recommend that you go and re-read the docs. The syntax to use would look
> like this:
>   $foo = inline_template("<%= @pvdisks.length %>")
> if the variable is local (in the same class/define), or
>   $foo = inline_template("<%= scope.lookupvar('scope::varname').length %>")
> if it's from somewhere else.

The '@' character does not appear anywhere on the page
http://docs.puppetlabs.com/guides/templating.html.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Array Length

2012-08-15 Thread Douglas Garstang
On Wed, Aug 15, 2012 at 3:05 PM, Tom De Vylder  wrote:
>
> On 15 Aug 2012, at 23:58, Douglas Garstang wrote:
>
>> On Wed, Aug 15, 2012 at 2:55 PM, Ryan Coleman  wrote:
>>> On Wed, Aug 15, 2012 at 2:51 PM, Douglas Garstang
>>>  wrote:
>>>> How do I get get length of an array in puppet DSL?
>>>
>>> Hi Doug,
>>>
>>> You can install the puppetlabs-stdlib module from the Forge and use
>>> the size function.
>>>
>>
>> Ryan,
>>
>> No thanks. I've stopped using 3rd party modules. Providers don't work
>> with environments... at least I don't think they do no has has
>> provided a definitive answer.
>
> Could you elaborate on this one?
> I'm using the stdlib with environments. Never ran into any issues with that.

Ryan,

What version of puppet are you using? We're on 2.7.1.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Array Length

2012-08-15 Thread Douglas Garstang
On Wed, Aug 15, 2012 at 2:58 PM, Douglas Garstang
 wrote:
> On Wed, Aug 15, 2012 at 2:55 PM, Ryan Coleman  wrote:
>> On Wed, Aug 15, 2012 at 2:51 PM, Douglas Garstang
>>  wrote:
>>> How do I get get length of an array in puppet DSL?
>>
>> Hi Doug,
>>
>> You can install the puppetlabs-stdlib module from the Forge and use
>> the size function.
>>
>
> Ryan,
>
> No thanks. I've stopped using 3rd party modules. Providers don't work
> with environments... at least I don't think they do no has has
> provided a definitive answer.
>
> Thought this might work...
>
> $foo = inline_template("<%= [$pvdisks[ %>.length")
>
> but that gives meerr: Could not retrieve catalog from remote server:
> Error 400 on SERVER: compile error
> (erb):1: unknown regexp options - vdb
> (erb):1: syntax error, unexpected tINTEGER, expecting ']'
> ...; _erbout.concat(( [/dev/xvdb1/dev/xvdc1] ).to_s); _erbout.c...
>   ^
> (erb):1: syntax error, unexpected ']', expecting ')'
> ...oncat(( [/dev/xvdb1/dev/xvdc1] ).to_s); _erbout.concat ".len...
>
> Yucko.

Oops.Typo in paste.I actually used

$foo = inline_template("<%= [$pvdisks] %>.length")

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Array Length

2012-08-15 Thread Douglas Garstang
On Wed, Aug 15, 2012 at 2:55 PM, Ryan Coleman  wrote:
> On Wed, Aug 15, 2012 at 2:51 PM, Douglas Garstang
>  wrote:
>> How do I get get length of an array in puppet DSL?
>
> Hi Doug,
>
> You can install the puppetlabs-stdlib module from the Forge and use
> the size function.
>

Ryan,

No thanks. I've stopped using 3rd party modules. Providers don't work
with environments... at least I don't think they do no has has
provided a definitive answer.

Thought this might work...

$foo = inline_template("<%= [$pvdisks[ %>.length")

but that gives meerr: Could not retrieve catalog from remote server:
Error 400 on SERVER: compile error
(erb):1: unknown regexp options - vdb
(erb):1: syntax error, unexpected tINTEGER, expecting ']'
...; _erbout.concat(( [/dev/xvdb1/dev/xvdc1] ).to_s); _erbout.c...
  ^
(erb):1: syntax error, unexpected ']', expecting ')'
...oncat(( [/dev/xvdb1/dev/xvdc1] ).to_s); _erbout.concat ".len...

Yucko.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Array Length

2012-08-15 Thread Douglas Garstang
How do I get get length of an array in puppet DSL?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Puppetlabs lvm module

2012-08-15 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 2:34 PM, Ryan Coleman  wrote:
> On Tue, Aug 14, 2012 at 2:30 PM, Douglas Garstang
>  wrote:
>> Yep. That was the culprit. Maybe you guys wanna run this through a
>> 'puppet parser validate' before posting them to the forge...?
>
> Obviously, our intention is not to release borked code but a mistake was made.
>
>>
>> I'm still borked though because it seems that custom types don't work
>> with environments.
>
> I see you've got another thread going about this. Thanks for keeping
> them logically separate.

Seriously can you run it through a syntax checker before posting it?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Custom types in environments working .... yes/no/maybe ?

2012-08-15 Thread Douglas Garstang
What a horrible clusterf*ck mess.

http://www.mailinglistarchive.com/html/puppet-users@googlegroups.com/2010-03/msg00801.html

Doug.

On Wed, Aug 15, 2012 at 10:41 AM, Douglas Garstang
 wrote:
> On Wed, Aug 15, 2012 at 10:06 AM, Douglas Garstang
>  wrote:
>> My issue may be related to this bug:
>>
>> http://projects.puppetlabs.com/issues/13858
>>
>> "Custom types in environments require loading into master's libdir"
>>
>> However, now I'm not so sure, This was working previously with a given
>> client.  However, after trying on a fresh client, it's failing with:
>>
>> err: Could not run Puppet configuration client: Could not find a
>> default provider for logical_volume
>>
>> The server seems to have the files:
>> /var/lib/puppet/lib/puppet/provider/logical_volume
>> /var/lib/puppet/lib/puppet/type/logical_volume.rb
>>
>> And so does the client:
>> /var/lib/puppet/lib/puppet/type/logical_volume.rb
>> /var/lib/puppet/lib/puppet/provider/logical_volume
>>
>> pluginsync=true in /etc/puppet/puppet.conf. Using multiple
>> environments and puppet 2.7.1.
>
> I tried applying the patch at
> https://github.com/puppetlabs/puppet/commit/96712efeb543928704fc9938e7429552d8ded039
> on both the server and client. That had the effect of changing the
> error on the client from:
>
> err: Could not run Puppet configuration client: Could not find a
> default provider for logical_volume
>
> to:
>
> err: Could not run Puppet configuration client: Could not find a
> default provider for volume_group
>
> Doug.



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Custom types in environments working .... yes/no/maybe ?

2012-08-15 Thread Douglas Garstang
On Wed, Aug 15, 2012 at 10:06 AM, Douglas Garstang
 wrote:
> My issue may be related to this bug:
>
> http://projects.puppetlabs.com/issues/13858
>
> "Custom types in environments require loading into master's libdir"
>
> However, now I'm not so sure, This was working previously with a given
> client.  However, after trying on a fresh client, it's failing with:
>
> err: Could not run Puppet configuration client: Could not find a
> default provider for logical_volume
>
> The server seems to have the files:
> /var/lib/puppet/lib/puppet/provider/logical_volume
> /var/lib/puppet/lib/puppet/type/logical_volume.rb
>
> And so does the client:
> /var/lib/puppet/lib/puppet/type/logical_volume.rb
> /var/lib/puppet/lib/puppet/provider/logical_volume
>
> pluginsync=true in /etc/puppet/puppet.conf. Using multiple
> environments and puppet 2.7.1.

I tried applying the patch at
https://github.com/puppetlabs/puppet/commit/96712efeb543928704fc9938e7429552d8ded039
on both the server and client. That had the effect of changing the
error on the client from:

err: Could not run Puppet configuration client: Could not find a
default provider for logical_volume

to:

err: Could not run Puppet configuration client: Could not find a
default provider for volume_group

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Custom types in environments working .... yes/no/maybe ?

2012-08-15 Thread Douglas Garstang
My issue may be related to this bug:

http://projects.puppetlabs.com/issues/13858

"Custom types in environments require loading into master's libdir"

However, now I'm not so sure, This was working previously with a given
client.  However, after trying on a fresh client, it's failing with:

err: Could not run Puppet configuration client: Could not find a
default provider for logical_volume

The server seems to have the files:
/var/lib/puppet/lib/puppet/provider/logical_volume
/var/lib/puppet/lib/puppet/type/logical_volume.rb

And so does the client:
/var/lib/puppet/lib/puppet/type/logical_volume.rb
/var/lib/puppet/lib/puppet/provider/logical_volume

pluginsync=true in /etc/puppet/puppet.conf. Using multiple
environments and puppet 2.7.1.

*sigh*

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Class Execution order

2012-08-15 Thread Douglas Garstang
On Wed, Aug 15, 2012 at 7:38 AM, jcbollinger  wrote:
>
>
> On Tuesday, August 14, 2012 11:37:26 AM UTC-5, Douglas wrote:
>>
>>
>> Not really. I have three run stages that have been working fine. It
>> was when I tried to add
>>
>> Apt::Source <| |> -> Exec["apt-update"]
>> Exec['apt-update'] -> Package <| |>
>>
>> to site.pp to globally enforce apt source installs, an apt-get update
>> and then installation of packages, in that order, that the dependency
>> cycles started. I thought maybe mixing the two was bad, which was when
>> I tried replacing the run stages with Class->, which doesn't seem to
>> be allowed syntactically btw. Looks like a bug?
>
>
>
> There is no inherent problem with mixing stages and chaining, as far as I
> know.  Both are simply facades on top of Puppet's underlying relationship
> machinery, so fundamentally they are parts of the same thing.
>
> I am pretty confident that the problem is with Class<| |>.  There are at
> least two factors in play there:
>
> Classes are not resources.  PL has made a concerted effort since the
> introduction of v. 2.6 to blur, downplay, and obscure the distinction, but
> they have not removed it.
> Resource collections are conflated with realization of virtual resources (or
> collection of exported resources, where there isn't even a distinct name for
> the concept).  There is a longstanding ticket on this issue.
>
> Since classes are not resources, but collection syntax specifies, in part,
> realization of virtual resources of the specified type, I do not find it
> surprising that Puppet rejects Class<| |>.  It looks like it should work
> (because PL has done a good job of making classes appear to be resources),
> but I'm not surprised that it doesn't.  I would not consider that a bug per
> se, but that it should work as you expected seems a reasonable feature
> request.
>
>>
>> I could put the installation of apt sources in their own run stage
>> that runs first. However, different classes of servers need different
>> apt sources, and therefore I need the ability to be able to add apt
>> sources at arbitrary points after the initial run stage, yet still
>> ensuring that an apt-get update happens only once after all the apt
>> sources have been installed, but before any packages are installed.
>>
>> This must be a general problem. Wonder how people have solved it...?
>
>
>
> I agree that the problem seems general.  Does it not work to put your
> Apt::Source resources into their own classes, and assign those classes to
> your initial stage?  That seems the natural solution.

Not really. The setup of base apt sources is handled during one of the
initial run stages. However, additional repo's are added later as the
function of the server is further refined.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Custom Providers and Environmemts.

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 3:06 PM, Douglas Garstang
 wrote:
> On Tue, Aug 14, 2012 at 3:03 PM, Douglas Garstang
>  wrote:
>> On Tue, Aug 14, 2012 at 2:59 PM, Douglas Garstang
>>  wrote:
>>> On Tue, Aug 14, 2012 at 2:49 PM, Eric Shamow  wrote:
>>>> Specifically the types need to be in the server's $libdir. You can place 
>>>> them there manually, but the way they generally get there is via 
>>>> pluginsync. So the easiest way to ensure the master can process them is to 
>>>> place them in the module path used by the server *when the server is 
>>>> acting as a puppet agent* and run puppet agent on the server.
>>>>
>>>> This will sync the types to the correct directory on the master and enable 
>>>> it to parse them when they are used elsewhere.
>>>>
>>>> -Eric
>>>
>>> Actually, *sigh* something else is wrong, because I used the concat
>>> module earlier, after enabling pluginsync on both master and client,
>>> and it seems to have synced what it needs ok:
>>>
>>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# ls -l
>>> total 8
>>> drwxr-sr-x 2 root root 4096 2012-08-14 18:02 facter
>>> drwxr-sr-x 4 root root 4096 2012-08-14 20:35 puppet
>>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# cd facter/
>>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/facter# ls -l
>>> total 4
>>> -rw-r--r-- 1 root root 103 2012-08-14 18:02 concat_basedir.rb
>>>
>>> Something else is wrong, something specifically with puppetlabs/lvm.
>>> The concat module is in the same environment too.
>>>
>>> Doug.
>>
>> Now I'm really confused... The files _ARE_ on the client...
>>
>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/puppet# find . -ls
>> 2745884 drwxr-sr-x   4 root root 4096 Aug 14 20:35 .
>> 2745974 drwxr-sr-x   2 root root 4096 Aug 14 20:35 ./type
>> 2745984 -rw-r--r--   1 root root 1380 Aug 14 20:35
>> ./type/logical_volume.rb
>> 2746014 -rw-r--r--   1 root root  458 Aug 14 20:35
>> ./type/volume_group.rb
>> 2745994 -rw-r--r--   1 root root  320 Aug 14 20:35
>> ./type/physical_volume.rb
>> 2746004 -rw-r--r--   1 root root  531 Aug 14 20:35
>> ./type/filesystem.rb
>> 2745894 drwxr-sr-x   6 root root 4096 Aug 14 20:35 ./provider
>> 2745934 drwxr-sr-x   2 root root 4096 Aug 14 20:35
>> ./provider/logical_volume
>> 2745964 -rwxr-xr-x   1 root root 3653 Aug 14 20:35
>> ./provider/logical_volume/lvm.rb
>> 2745914 drwxr-sr-x   2 root root 4096 Aug 14 20:35
>> ./provider/filesystem
>> 2745924 -rw-r--r--   1 root root  825 Aug 14 20:35
>> ./provider/filesystem/lvm.rb
>> 2745944 drwxr-sr-x   2 root root 4096 Aug 14 20:35
>> ./provider/physical_volume
>> 2745954 -rw-r--r--   1 root root  401 Aug 14 20:35
>> ./provider/physical_volume/lvm.rb
>> 2745904 drwxr-sr-x   2 root root 4096 Aug 14 20:35
>> ./provider/volume_group
>> 2746024 -rw-r--r--   1 root root 1856 Aug 14 20:35
>> ./provider/volume_group/lvm.rb
>>
>> But...
>>
>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/puppet# puppet
>> agent --test --onetime --verbose
>> info: Retrieving plugin
>> info: Loading facts in concat_basedir
>> info: Loading facts in concat_basedir
>> err: Could not retrieve catalog from remote server: Error 400 on
>> SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
>> Invalid resource type physical_volume at
>> /truth/sauce/env/prod/modules/role/manifests/common.pp:44 on node
>> testweb10.us1.xxx.com
>>
>> Doug.
>
> Files are on the server too..
>
> [us1] root@truth:/truth# find / -name physical_volume.rb
> /truth/sauce/env/prod/modules/lvm/spec/unit/puppet/type/physical_volume.rb
> /truth/sauce/env/prod/modules/lvm/lib/puppet/type/physical_volume.rb
>
> The second one, under env/prod is the correct environment. So... this
> should work...

No... wait those files are the original ones imported into the git
source. Ignore that. Losing sanity.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Custom Providers and Environmemts.

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 3:03 PM, Douglas Garstang
 wrote:
> On Tue, Aug 14, 2012 at 2:59 PM, Douglas Garstang
>  wrote:
>> On Tue, Aug 14, 2012 at 2:49 PM, Eric Shamow  wrote:
>>> Specifically the types need to be in the server's $libdir. You can place 
>>> them there manually, but the way they generally get there is via 
>>> pluginsync. So the easiest way to ensure the master can process them is to 
>>> place them in the module path used by the server *when the server is acting 
>>> as a puppet agent* and run puppet agent on the server.
>>>
>>> This will sync the types to the correct directory on the master and enable 
>>> it to parse them when they are used elsewhere.
>>>
>>> -Eric
>>
>> Actually, *sigh* something else is wrong, because I used the concat
>> module earlier, after enabling pluginsync on both master and client,
>> and it seems to have synced what it needs ok:
>>
>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# ls -l
>> total 8
>> drwxr-sr-x 2 root root 4096 2012-08-14 18:02 facter
>> drwxr-sr-x 4 root root 4096 2012-08-14 20:35 puppet
>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# cd facter/
>> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/facter# ls -l
>> total 4
>> -rw-r--r-- 1 root root 103 2012-08-14 18:02 concat_basedir.rb
>>
>> Something else is wrong, something specifically with puppetlabs/lvm.
>> The concat module is in the same environment too.
>>
>> Doug.
>
> Now I'm really confused... The files _ARE_ on the client...
>
> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/puppet# find . -ls
> 2745884 drwxr-sr-x   4 root root 4096 Aug 14 20:35 .
> 2745974 drwxr-sr-x   2 root root 4096 Aug 14 20:35 ./type
> 2745984 -rw-r--r--   1 root root 1380 Aug 14 20:35
> ./type/logical_volume.rb
> 2746014 -rw-r--r--   1 root root  458 Aug 14 20:35
> ./type/volume_group.rb
> 2745994 -rw-r--r--   1 root root  320 Aug 14 20:35
> ./type/physical_volume.rb
> 2746004 -rw-r--r--   1 root root  531 Aug 14 20:35
> ./type/filesystem.rb
> 2745894 drwxr-sr-x   6 root root 4096 Aug 14 20:35 ./provider
> 2745934 drwxr-sr-x   2 root root 4096 Aug 14 20:35
> ./provider/logical_volume
> 2745964 -rwxr-xr-x   1 root root 3653 Aug 14 20:35
> ./provider/logical_volume/lvm.rb
> 2745914 drwxr-sr-x   2 root root 4096 Aug 14 20:35
> ./provider/filesystem
> 2745924 -rw-r--r--   1 root root  825 Aug 14 20:35
> ./provider/filesystem/lvm.rb
> 2745944 drwxr-sr-x   2 root root 4096 Aug 14 20:35
> ./provider/physical_volume
> 2745954 -rw-r--r--   1 root root  401 Aug 14 20:35
> ./provider/physical_volume/lvm.rb
> 2745904 drwxr-sr-x   2 root root 4096 Aug 14 20:35
> ./provider/volume_group
> 2746024 -rw-r--r--   1 root root 1856 Aug 14 20:35
> ./provider/volume_group/lvm.rb
>
> But...
>
> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/puppet# puppet
> agent --test --onetime --verbose
> info: Retrieving plugin
> info: Loading facts in concat_basedir
> info: Loading facts in concat_basedir
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
> Invalid resource type physical_volume at
> /truth/sauce/env/prod/modules/role/manifests/common.pp:44 on node
> testweb10.us1.xxx.com
>
> Doug.

Files are on the server too..

[us1] root@truth:/truth# find / -name physical_volume.rb
/truth/sauce/env/prod/modules/lvm/spec/unit/puppet/type/physical_volume.rb
/truth/sauce/env/prod/modules/lvm/lib/puppet/type/physical_volume.rb

The second one, under env/prod is the correct environment. So... this
should work...

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Custom Providers and Environmemts.

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 2:59 PM, Douglas Garstang
 wrote:
> On Tue, Aug 14, 2012 at 2:49 PM, Eric Shamow  wrote:
>> Specifically the types need to be in the server's $libdir. You can place 
>> them there manually, but the way they generally get there is via pluginsync. 
>> So the easiest way to ensure the master can process them is to place them in 
>> the module path used by the server *when the server is acting as a puppet 
>> agent* and run puppet agent on the server.
>>
>> This will sync the types to the correct directory on the master and enable 
>> it to parse them when they are used elsewhere.
>>
>> -Eric
>
> Actually, *sigh* something else is wrong, because I used the concat
> module earlier, after enabling pluginsync on both master and client,
> and it seems to have synced what it needs ok:
>
> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# ls -l
> total 8
> drwxr-sr-x 2 root root 4096 2012-08-14 18:02 facter
> drwxr-sr-x 4 root root 4096 2012-08-14 20:35 puppet
> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# cd facter/
> [us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/facter# ls -l
> total 4
> -rw-r--r-- 1 root root 103 2012-08-14 18:02 concat_basedir.rb
>
> Something else is wrong, something specifically with puppetlabs/lvm.
> The concat module is in the same environment too.
>
> Doug.

Now I'm really confused... The files _ARE_ on the client...

[us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/puppet# find . -ls
2745884 drwxr-sr-x   4 root root 4096 Aug 14 20:35 .
2745974 drwxr-sr-x   2 root root 4096 Aug 14 20:35 ./type
2745984 -rw-r--r--   1 root root 1380 Aug 14 20:35
./type/logical_volume.rb
2746014 -rw-r--r--   1 root root  458 Aug 14 20:35
./type/volume_group.rb
2745994 -rw-r--r--   1 root root  320 Aug 14 20:35
./type/physical_volume.rb
2746004 -rw-r--r--   1 root root  531 Aug 14 20:35
./type/filesystem.rb
2745894 drwxr-sr-x   6 root root 4096 Aug 14 20:35 ./provider
2745934 drwxr-sr-x   2 root root 4096 Aug 14 20:35
./provider/logical_volume
2745964 -rwxr-xr-x   1 root root 3653 Aug 14 20:35
./provider/logical_volume/lvm.rb
2745914 drwxr-sr-x   2 root root 4096 Aug 14 20:35
./provider/filesystem
2745924 -rw-r--r--   1 root root  825 Aug 14 20:35
./provider/filesystem/lvm.rb
2745944 drwxr-sr-x   2 root root 4096 Aug 14 20:35
./provider/physical_volume
2745954 -rw-r--r--   1 root root  401 Aug 14 20:35
./provider/physical_volume/lvm.rb
2745904 drwxr-sr-x   2 root root 4096 Aug 14 20:35
./provider/volume_group
2746024 -rw-r--r--   1 root root 1856 Aug 14 20:35
./provider/volume_group/lvm.rb

But...

[us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/puppet# puppet
agent --test --onetime --verbose
info: Retrieving plugin
info: Loading facts in concat_basedir
info: Loading facts in concat_basedir
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
Invalid resource type physical_volume at
/truth/sauce/env/prod/modules/role/manifests/common.pp:44 on node
testweb10.us1.xxx.com

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Custom Providers and Environmemts.

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 2:49 PM, Eric Shamow  wrote:
> Specifically the types need to be in the server's $libdir. You can place them 
> there manually, but the way they generally get there is via pluginsync. So 
> the easiest way to ensure the master can process them is to place them in the 
> module path used by the server *when the server is acting as a puppet agent* 
> and run puppet agent on the server.
>
> This will sync the types to the correct directory on the master and enable it 
> to parse them when they are used elsewhere.
>
> -Eric

Actually, *sigh* something else is wrong, because I used the concat
module earlier, after enabling pluginsync on both master and client,
and it seems to have synced what it needs ok:

[us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# ls -l
total 8
drwxr-sr-x 2 root root 4096 2012-08-14 18:02 facter
drwxr-sr-x 4 root root 4096 2012-08-14 20:35 puppet
[us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib# cd facter/
[us1:i-f8350ebe] root@testweb10:/var/lib/puppet/lib/facter# ls -l
total 4
-rw-r--r-- 1 root root 103 2012-08-14 18:02 concat_basedir.rb

Something else is wrong, something specifically with puppetlabs/lvm.
The concat module is in the same environment too.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Custom Providers and Environmemts.

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 2:40 PM, Eric Shamow  wrote:
> Douglas,
>
> Do you intend to use different versions of the type in different 
> environments, or are you just concerned with trying to get the same code out 
> everywhere?
>
> According to
>
> http://projects.puppetlabs.com/issues/13858
>
> this is fixed for Telly, and there is a patch available if you want to give 
> it a try.
>
> If you don't mind the type being available on the master as well, making it 
> available in the modulepath the master uses as a client should resolve the 
> issue. The problem is that the master loads new types locally for validation, 
> and so needs access to them itself.

Eric,

Not sure I follow. Your saying that puppetlabs-lvm-0.1.0/* needs to be
placed in the location set by modulepath on the server?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Custom Providers and Environmemts.

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 2:25 PM, Douglas Garstang
 wrote:
> I've installed the puppet labs lvm module. After fixing the missing
> "}" at line 20 in init.pp (really?!?!), I'm getting this:'
>
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
> Invalid resource type physical_volume at
> /truth/sauce/env/prod/modules/role/manifests/common.pp:43 on node
> testweb10.us1.xxx.com
>
> Seems related to:
> http://projects.puppetlabs.com/issues/4409
>
> I'm using environments. Is this fixed?
>
> Doug

Jeez, I dunno... the rb files are on the client...

[us1:i-f8350ebe] root@testweb10:/etc/sysctl.d# ls -l
/var/lib/puppet/lib/puppet/type
total 16
-rw-r--r-- 1 root root  531 2012-08-14 20:35 filesystem.rb
-rw-r--r-- 1 root root 1380 2012-08-14 20:35 logical_volume.rb
-rw-r--r-- 1 root root  320 2012-08-14 20:35 physical_volume.rb
-rw-r--r-- 1 root root  458 2012-08-14 20:35 volume_group.rb

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Puppetlabs lvm module

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 2:22 PM, Ryan Coleman  wrote:
> Well that's embarrassing. It seems as those the 'cleaned' match of the
> case statement isn't actually closed. :-/
>
> Would you try adding a closing brace in lvm/manifests/init.pp around
> like 26, where this code appears? It should close the 'cleaned: {'
> block.
>
> }
>   #
>   # Just clean up the logical volume
>   #
>
> Let us know if that was the culprit. We'll get that fixed and into a
> release. I apologize for the inconvenience -- this is our bad.

Yep. That was the culprit. Maybe you guys wanna run this through a
'puppet parser validate' before posting them to the forge...?

I'm still borked though because it seems that custom types don't work
with environments.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Custom Providers and Environmemts.

2012-08-14 Thread Douglas Garstang
I've installed the puppet labs lvm module. After fixing the missing
"}" at line 20 in init.pp (really?!?!), I'm getting this:'

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
Invalid resource type physical_volume at
/truth/sauce/env/prod/modules/role/manifests/common.pp:43 on node
testweb10.us1.xxx.com

Seems related to:
http://projects.puppetlabs.com/issues/4409

I'm using environments. Is this fixed?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Pass array to a define

2012-08-14 Thread Douglas Garstang
On Sat, Aug 11, 2012 at 7:48 PM, Stefan Schulte
 wrote:
> On Sat, Aug 11, 2012 at 01:46:57PM -0700, James A. Peltier wrote:
>> - Original Message -
>> | On Fri, Aug 10, 2012 at 05:10:20PM -0700, Douglas Garstang wrote:
>> | > How can I pass an array to a define? It's not documented in the
>> | > puppet
>> | > language guide.
>> | >
>> | > I've got:
>> | >
>> | > define lvm::create_vg ( $pvdisks ) {
>> | > exec {
>> | > 'pvcreate':
>> | > command => "/sbin/pvcreate -yf $pvdisks",
>> | > unless  => "/sbin/pvdisplay $pvdisks",
>> | >...
>> | > }
>> | > }
>> | >
>> | > class someclass {
>> | > lvm::create_vg {
>> | > 'bcvg01':
>> | > pvdisks => ['/dev/xvdb1', '/dev/xvdc1'];
>> | > }
>> | > }
>> | >
>> | > Inside the define, $pvdisks gets expanded to '/dev/xvdb1/dev/xvdc1'
>> | >
>> | > Doug.
>> |
>> | Inside your define $pvdisks is whatever you passed as the pvdisks
>> | parameter, so in your case $pvdisks *is* an array. But in the unless
>> | parameter you use the array in a string context so all your items are
>> | concatenated. Unfortunately puppet does not have a join function to
>> | convert an array to a string.
>> |
>> | On the other hand it may not be desired to destroy every disk you
>> | pass
>> | as in the pvdisks array if only one of the disks is not a LVM disk
>> | (as
>> | pvdisplay returns with a non-zero exitcode as soon as one disk is not
>> | recognized to be a LVM disk)
>> |
>> | So the best approach is probably to get the LVM puppet plugin and
>> | replace your exec with
>> |
>> | physical_volume { $pvdisks:
>> |   ensure => present,
>> | }
>> |
>> | The physical_volume is a new type that comes with the LVM plugin.
>> |
>> | [1] http://forge.puppetlabs.com/puppetlabs/lvm
>> |
>> | -Stefan
>>
>> Great!  But what happens if you want to specify multiple physical volumes be 
>> a member of a single data volume during creation.  Is the expectation that 
>> you'd always specify a lvm:vg with the initial disk and then lvm:vg extend 
>> that volume?
>
> Do you mean something like sda1 and sda2 beeing two physical volumes in
> the volume group vg? This should work:
>
>
> physical_volume { [ '/dev/sda1', '/dev/sda2']:
>   ensure => present.
> }
>
> volume_group { 'vg':
>   ensure   => present,
>   physical_volumes => [ '/dev/sda1', '/dev/sda2' ],
>   require  => [
> Physical_volume['/dev/sda1'],
> Physical_volume['/dev/sda2'],
>   ],
> }
>
> -Stefan

Yeah, well I tried the puppet labs lvm module. After I fixed the
syntax errors, which included a missing '}' in the code (wtf!??!), it
seems that custom types don't work with environments...

http://projects.puppetlabs.com/issues/4409

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Puppetlabs lvm module

2012-08-14 Thread Douglas Garstang
Eric,

Yes... that's specifically line 29.

19logical_volume { $name:
20  ensure => present,
21  volume_group => $vg,
22  size => $size,
23  before => Volume_group[$vg]
24}
25  }
26  #
27  # Just clean up the logical volume
28  #
29  absent: {
30logical_volume { $name: ensure => absent, volume_group =>
$vg, size => $size }
31  }
32  #
33  # Create the whole chain.
34  #

code compression syntax not familiar with that...

Doug.

On Tue, Aug 14, 2012 at 1:45 PM, Eric Shamow  wrote:
> Oh right - for the code compression syntax…I don't use it and so I tend to 
> forget it exists. Sorry about that.
>
> Is line 29 specifically this?
>
> absent: {
>
> It would be helpful to see in context with line numbers, such as in a gist.
>
> -Eric
>
> --
>
> Eric Shamow
> Professional Services
> http://puppetlabs.com/
> (c)631.871.6441
>
> Join us for PuppetConf 2012 at the Mission Bay Convention Center in San 
> Francisco, California on September 27th and 28th --> http://bit.ly/pcsig12
>
>
> On Tuesday, August 14, 2012 at 4:43 PM, Douglas Garstang wrote:
>
>> I've always used semicolons at the end of resources never caused a
>> problem before, and puppet-lint doesn't complain about them.
>>
>> On Tue, Aug 14, 2012 at 1:42 PM, Eric Shamow > (mailto:e...@puppetlabs.com)> wrote:
>> > Everything else aside, you have a semicolon after ensure => present 
>> > instead of a comma in your physical_volume resource. I'm not certain that 
>> > it's causing the problem but it might be confusing the parser.
>> >
>> > -Eric
>> >
>> > --
>> >
>> > Eric Shamow
>> > Professional Services
>> > http://puppetlabs.com/
>> > (c)631.871.6441
>> >
>> > Join us for PuppetConf 2012 at the Mission Bay Convention Center in San 
>> > Francisco, California on September 27th and 28th --> http://bit.ly/pcsig12
>> >
>> >
>> > On Tuesday, August 14, 2012 at 4:39 PM, Douglas Garstang wrote:
>> >
>> > > I just grabbed the puppet labs lvm module from Puppet forge.
>> > >
>> > > Attempting to use...
>> > >
>> > > physical_volume {
>> > > ['/dev/xvdb1', '/dev/xvdc1']:
>> > > ensure => present;
>> > > }
>> > >
>> > > results in:
>> > >
>> > > err: Could not retrieve catalog from remote server: Error 400 on
>> > > SERVER: Syntax error at ':'; expected '}' at
>> > > /truth/sauce/env/prod/modules/lvm/manifests/init.pp:29 on node
>> > > testweb10.us1.xxx.com (http://testweb10.us1.xxx.com)
>> > >
>> > > Line 29 of init.pp is:
>> > >
>> > > #
>> > > # Just clean up the logical volume
>> > > #
>> > > absent: {
>> > > logical_volume { $name: ensure => absent, volume_group => $vg,
>> > > size => $size }
>> > > }
>> > >
>> > > I don't get it what am I missing
>> > >
>> > > Doug.
>> > >
>> > > --
>> > > You received this message because you are subscribed to the Google 
>> > > Groups "Puppet Users" group.
>> > > To post to this group, send email to puppet-users@googlegroups.com 
>> > > (mailto:puppet-users@googlegroups.com).
>> > > To unsubscribe from this group, send email to 
>> > > puppet-users+unsubscr...@googlegroups.com 
>> > > (mailto:puppet-users+unsubscr...@googlegroups.com).
>> > > For more options, visit this group at 
>> > > http://groups.google.com/group/puppet-users?hl=en.
>> >
>> >
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Puppet Users" group.
>> > To post to this group, send email to puppet-users@googlegroups.com 
>> > (mailto:puppet-users@googlegroups.com).
>> > To unsubscribe from this group, send email to 
>> > puppet-users+unsubscr...@googlegroups.com 
>> > (mailto:puppet-users+unsubscr...@googlegroups.com).
>> > For more options, visit this group at 
>> > http://groups.google.com/group/puppet-users?hl=en.
>>
>>
>>
>>
>>
>> --
>> Regards,
>>
>> Douglas Garsta

Re: [Puppet Users] Puppetlabs lvm module

2012-08-14 Thread Douglas Garstang
I've always used semicolons at the end of resources never caused a
problem before, and puppet-lint doesn't complain about them.

On Tue, Aug 14, 2012 at 1:42 PM, Eric Shamow  wrote:
> Everything else aside, you have a semicolon after ensure => present instead 
> of a comma in your physical_volume resource. I'm not certain that it's 
> causing the problem but it might be confusing the parser.
>
> -Eric
>
> --
>
> Eric Shamow
> Professional Services
> http://puppetlabs.com/
> (c)631.871.6441
>
> Join us for PuppetConf 2012 at the Mission Bay Convention Center in San 
> Francisco, California on September 27th and 28th --> http://bit.ly/pcsig12
>
>
> On Tuesday, August 14, 2012 at 4:39 PM, Douglas Garstang wrote:
>
>> I just grabbed the puppet labs lvm module from Puppet forge.
>>
>> Attempting to use...
>>
>> physical_volume {
>> ['/dev/xvdb1', '/dev/xvdc1']:
>> ensure => present;
>> }
>>
>> results in:
>>
>> err: Could not retrieve catalog from remote server: Error 400 on
>> SERVER: Syntax error at ':'; expected '}' at
>> /truth/sauce/env/prod/modules/lvm/manifests/init.pp:29 on node
>> testweb10.us1.xxx.com (http://testweb10.us1.xxx.com)
>>
>> Line 29 of init.pp is:
>>
>> #
>> # Just clean up the logical volume
>> #
>> absent: {
>> logical_volume { $name: ensure => absent, volume_group => $vg,
>> size => $size }
>> }
>>
>> I don't get it what am I missing
>>
>> Doug.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com 
>> (mailto:puppet-users@googlegroups.com).
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com 
>> (mailto:puppet-users+unsubscr...@googlegroups.com).
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Puppetlabs lvm module

2012-08-14 Thread Douglas Garstang
I just grabbed the puppet labs lvm module from Puppet forge.

Attempting to use...

physical_volume {
['/dev/xvdb1', '/dev/xvdc1']:
ensure => present;
}

results in:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Syntax error at ':'; expected '}' at
/truth/sauce/env/prod/modules/lvm/manifests/init.pp:29 on node
testweb10.us1.xxx.com

Line 29 of init.pp is:

#
# Just clean up the logical volume
#
absent: {
  logical_volume { $name: ensure => absent, volume_group => $vg,
size => $size }
}

I don't get it what am I missing

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Class Execution order

2012-08-14 Thread Douglas Garstang
On Tue, Aug 14, 2012 at 6:09 AM, jcbollinger  wrote:
>
>
> On Tuesday, August 14, 2012 12:12:33 AM UTC-5, Douglas wrote:
>>
>> Trying to force puppet class execution order with:
>>
>> Class['lvm'] -> Class['network'] -> Class['apt'] -> Class <| |>
>>
>> This is giving me:
>>
>> err: Could not retrieve catalog from remote server: Error 400 on
>> SERVER: Resource type class doesn't exist at
>> /truth/sauce/env/prod/modules/role/manifests/common.pp:37 on node
>> testweb07.us1.xxx.com
>> warning: Not using cache on failed catalog
>>
>> I did have it working with run stages, but when trying to also use the
>> relationship syntax with the following in site.pp
>>
>> Apt::Source <| |> -> Exec["apt-update"]
>> Exec['apt-update'] -> Package <| |>
>>
>> got the dreaded cyclic dependency errors... :(
>
>
>
> Yes, both run stages and chaining from/to collections are prone to causing
> cycles.  They have their uses, but you do need to think very carefully about
> how you use them.  Moreover, the more you use them, the more likely you are
> to have trouble.  It is often quite hard to make correct blanket statements
> about resource relationships, more so the more complex your manifests
> become.
>
> It looks and sounds as if you are trying to re-express your stages-based
> manifests using resource chaining.  If that's the case then you are on a
> wild goose chase.  Declaring the same relationships via a different syntax
> must necessarily produce the same cycle(s).  To fix the problem you need to
> remove (the right) unneeded relationships.

Not really. I have three run stages that have been working fine. It
was when I tried to add

Apt::Source <| |> -> Exec["apt-update"]
Exec['apt-update'] -> Package <| |>

to site.pp to globally enforce apt source installs, an apt-get update
and then installation of packages, in that order, that the dependency
cycles started. I thought maybe mixing the two was bad, which was when
I tried replacing the run stages with Class->, which doesn't seem to
be allowed syntactically btw. Looks like a bug?

I could put the installation of apt sources in their own run stage
that runs first. However, different classes of servers need different
apt sources, and therefore I need the ability to be able to add apt
sources at arbitrary points after the initial run stage, yet still
ensuring that an apt-get update happens only once after all the apt
sources have been installed, but before any packages are installed.

This must be a general problem. Wonder how people have solved it...?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Class Execution order

2012-08-13 Thread Douglas Garstang
Trying to force puppet class execution order with:

Class['lvm'] -> Class['network'] -> Class['apt'] -> Class <| |>

This is giving me:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Resource type class doesn't exist at
/truth/sauce/env/prod/modules/role/manifests/common.pp:37 on node
testweb07.us1.xxx.com
warning: Not using cache on failed catalog

I did have it working with run stages, but when trying to also use the
relationship syntax with the following in site.pp

Apt::Source <| |> -> Exec["apt-update"]
Exec['apt-update'] -> Package <| |>

got the dreaded cyclic dependency errors... :(

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Return value from a define?

2012-08-11 Thread Douglas Garstang
So, general puppet design question. I have a definition called
create_vg that creates an lvm volume group. An input to this is
obviously the list of physical disks. In a  normal programming
language, I'd put the identification of the physical disks into one
function, and pass the result of that to create_vg().

However, since a define in puppet can't return a value (can it?), you
don't have many options unless you want to set it as a fact with
fact-add, which bothers me, because your effectively than accumulating
a list of global variables that may not need to be variable.

So, your effectively left with putting the logic that determines the
physical disks _inside_ create_vg(). No? Seems so... non functional!

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Installing Modules.

2012-08-11 Thread Douglas Garstang
On Sat, Aug 11, 2012 at 10:33 PM, Douglas Garstang
 wrote:
> Someone directed me to this...
>
> http://forge.puppetlabs.com/puppetlabs/lvm
>
> How do you install these...? The documentation at
> http://docs.puppetlabs.com/puppet/2.7/reference/modules_installing.html
> says to use the puppet module command... where? On the server? The
> docs also say this isn't available until puppet 2.7.14, and we're
> using 2.7.1. How do I install?
>
> Doug

Main page 
http://docs.puppetlabs.com/puppet/2.7/reference/modules_publishing.html

Seriously... is it that hard to document _how_ to install these
things? It HAS to be there but where...?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] variable scoping?

2012-08-11 Thread Douglas Garstang
I feel your pain.

On Sat, Aug 11, 2012 at 10:24 PM, Zachary Alex Stern
 wrote:
> Also, fwiw, I've read that document on scoping beginning to end several
> times. Doesn't mean much to me I'm afraid - pretty new to all this.
>
>
> On Saturday, August 11, 2012 10:36:48 PM UTC-4, Eric Shamow wrote:
>>
>> The best reference to explain how variable scoping works in Puppet is this
>> one -
>>
>> http://docs.puppetlabs.com/guides/scope_and_puppet.html
>>
>> Scoping has changed with 2.7, so you may find some confusing references
>> online that follow the pre-2.7 rules. In general the 2.7 changes are
>> designed to introduce some sanity to variable scopes and eliminate dynamic
>> scoping, which causes all kinds of pain.
>>
>> The easiest way to think about scoping in general is that a scope is
>> defined by its container. If I put something physical in a box, I have
>> access to it the moment I open the box, and other objects inside the box can
>> interact with it. If, however, I now put that box inside a second box, the
>> objects in the second box cannot interact directly with the objects in the
>> first - the first object is protected by its container.
>>
>> Scoping mostly works the same way. The right way to get at the variable is
>> to always explicitly scope, as you began to get at below with your
>> scope.lookupvar example. As that can be a bit of a pain to repeat, you can
>> always copy the value into a local variable:
>>
>> class puppet::config {
>> include puppet::params
>> $puppetserver = puppet::params::puppetserver
>> …
>> }
>>
>> -Eric
>>
>> --
>>
>> Eric Shamow
>> Professional Services
>> http://puppetlabs.com/
>> ©631.871.6441
>>
>> Join us for PuppetConf 2012 at the Mission Bay Convention Center in San
>> Francisco, California on September 27th and 28th --> http://bit.ly/pcsig12
>>
>>
>> On Saturday, August 11, 2012 at 8:45 PM, Zachary Stern wrote:
>>
>> > I'm having a really hard time grasping how variables are scoped in
>> > puppet (not really much of a programmer).
>> >
>> > I've got a manifest that looks like this:
>> > ###
>> > class puppet::config {
>> > include puppet::params
>> > file { '/etc/puppet/puppet.conf':
>> > ensure => present,
>> > content => template('puppet/puppet.conf.erb'),
>> > owner => 'root',
>> > group => 'admins',
>> > require => Class['puppet::install'],
>> > notify => Class['puppet::service'],
>> > }
>> > }
>> > ###
>> >
>> >
>> > I've then got a manifest like this, which has a class being included
>> > above:
>> > ###
>> > class puppet::params {
>> > $puppetserver = 'command.enterawesome.com
>> > (http://command.enterawesome.com)'
>> > }
>> > ###
>> >
>> > The template being used in the first class includes the variable
>> > $puppetserver, but somehow, the include statement isn't enough for the
>> > variable to be defined within the scope of the manifest/template
>> > above.
>> > What gives?
>> > It works just fine if I include a statement like this in the erb file:
>> > <%= scope.lookupvar('puppet::params::puppetserver') %>
>> >
>> > But I'd really like to understand scoping better. What is it I need to
>> > do to just refer to the variable by name? Why isn't the include
>> > statement enough? Isn't in including the puppet::params class inside
>> > the puppet::config class, and therefore having the variable defined in
>> > that context? Apparently not. But I don't understand why. I wan't to
>> > end up at a point where the variable is in the proper scope, such that
>> > I can just have a statement like <%= puppetserver %> inside of the
>> > template I'm using.
>> >
>> > Thanks in advance!
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Puppet Users" group.
>> > To post to this group, send email to puppet...@googlegroups.com
>> > (mailto:puppet...@googlegroups.com).
>> > To unsubscribe from this group, send email to
>> > puppet-users...@googlegroups.com
>> > (mailto:puppet-users+unsubscr...@googlegroups.com).
>> > For more options, visit this group at
>> > h

[Puppet Users] Installing Modules.

2012-08-11 Thread Douglas Garstang
Someone directed me to this...

http://forge.puppetlabs.com/puppetlabs/lvm

How do you install these...? The documentation at
http://docs.puppetlabs.com/puppet/2.7/reference/modules_installing.html
says to use the puppet module command... where? On the server? The
docs also say this isn't available until puppet 2.7.14, and we're
using 2.7.1. How do I install?

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Pass array to a define

2012-08-11 Thread Douglas Garstang
On Sat, Aug 11, 2012 at 5:21 AM, Stefan Schulte
 wrote:
> On Fri, Aug 10, 2012 at 05:10:20PM -0700, Douglas Garstang wrote:
>> How can I pass an array to a define? It's not documented in the puppet
>> language guide.
>>
>> I've got:
>>
>> define lvm::create_vg ( $pvdisks ) {
>> exec {
>> 'pvcreate':
>> command => "/sbin/pvcreate -yf $pvdisks",
>> unless  => "/sbin/pvdisplay $pvdisks",
>>...
>> }
>> }
>>
>> class someclass {
>> lvm::create_vg {
>> 'bcvg01':
>> pvdisks => ['/dev/xvdb1', '/dev/xvdc1'];
>> }
>> }
>>
>> Inside the define, $pvdisks gets expanded to '/dev/xvdb1/dev/xvdc1'
>>
>> Doug.
>
> Inside your define $pvdisks is whatever you passed as the pvdisks
> parameter, so in your case $pvdisks *is* an array. But in the unless
> parameter you use the array in a string context so all your items are
> concatenated. Unfortunately puppet does not have a join function to
> convert an array to a string.
>
> On the other hand it may not be desired to destroy every disk you pass
> as in the pvdisks array if only one of the disks is not a LVM disk (as
> pvdisplay returns with a non-zero exitcode as soon as one disk is not
> recognized to be a LVM disk)
>
> So the best approach is probably to get the LVM puppet plugin and
> replace your exec with
>
> physical_volume { $pvdisks:
>   ensure => present,
> }
>
> The physical_volume is a new type that comes with the LVM plugin.
>
> [1] http://forge.puppetlabs.com/puppetlabs/lvm

Thanks. What am I looking at when I extract this? I was expecting to
see a couple of .pp files. Installation documentation!?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Pass array to a define

2012-08-10 Thread Douglas Garstang
How can I pass an array to a define? It's not documented in the puppet
language guide.

I've got:

define lvm::create_vg ( $pvdisks ) {
exec {
'pvcreate':
command => "/sbin/pvcreate -yf $pvdisks",
unless  => "/sbin/pvdisplay $pvdisks",
   ...
}
}

class someclass {
lvm::create_vg {
'bcvg01':
pvdisks => ['/dev/xvdb1', '/dev/xvdc1'];
}
}

Inside the define, $pvdisks gets expanded to '/dev/xvdb1/dev/xvdc1'

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: New Scope > 2.7

2012-08-10 Thread Douglas Garstang
On Fri, Aug 10, 2012 at 2:24 PM, llowder  wrote:
>
>
> On Friday, August 10, 2012 3:52:42 PM UTC-5, Douglas wrote:
>>
>> On Fri, Aug 10, 2012 at 1:42 PM, llowder  wrote:
>> >
>> >
>> > On Friday, August 10, 2012 3:28:33 PM UTC-5, Douglas wrote:
>> >>
>> >> So...
>> >>
>> >> I was just reading the new puppet scoping documentation at
>> >> http://docs.puppetlabs.com/guides/scope_and_puppet.html.
>> >>
>> >> I don't get it. If I have this...
>> >>
>> >> class web_server {
>> >> include common
>> >> include webserver
>> >> $my_role = "web_server"
>> >> }
>> >>
>> >> Can I access the $my_role variable in the webserver class?
>> >
>> >
>> > If you use: $web_server::my_role
>>
>> This seems completely screwed to me. What if your in a general class,
>> one not necessarily related to the function of a web server (but still
>> included from a web server), and you need to access the role?
>>
>
> Then use the fully qualified variable name as I mentioned in my last post.

What if the class I am in doesn't KNOW that the parent is $web_server ...?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: New Scope > 2.7

2012-08-10 Thread Douglas Garstang
On Fri, Aug 10, 2012 at 1:42 PM, llowder  wrote:
>
>
> On Friday, August 10, 2012 3:28:33 PM UTC-5, Douglas wrote:
>>
>> So...
>>
>> I was just reading the new puppet scoping documentation at
>> http://docs.puppetlabs.com/guides/scope_and_puppet.html.
>>
>> I don't get it. If I have this...
>>
>> class web_server {
>> include common
>> include webserver
>> $my_role = "web_server"
>> }
>>
>> Can I access the $my_role variable in the webserver class?
>
>
> If you use: $web_server::my_role

This seems completely screwed to me. What if your in a general class,
one not necessarily related to the function of a web server (but still
included from a web server), and you need to access the role?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] New Scope > 2.7

2012-08-10 Thread Douglas Garstang
So...

I was just reading the new puppet scoping documentation at
http://docs.puppetlabs.com/guides/scope_and_puppet.html.

I don't get it. If I have this...

class web_server {
include common
include webserver
$my_role = "web_server"
}

Can I access the $my_role variable in the webserver class?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Running apt-get update on package install

2012-08-09 Thread Douglas Garstang
I'm on Ubuntu, and I wanted to always have 'apt-get update' run before
attempting to install packages, so I put this in my top level site.pp
file:

exec {
'refresh-repos':
command => '/usr/bin/apt-get update';
}

Package {
require => Exec['refresh-repos']
}

However, that causes a nasty cyclic dependency error. I really HATE
those because the error message makes it impossible to interpret
what's actually going on.

How can I do this without the awful cyclic error messages?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Tag Negation

2012-08-09 Thread Douglas Garstang
Well that sucks,

On Wed, Aug 8, 2012 at 4:53 PM, Peter Brown  wrote:
> I don't think the tag system was designed to be used like that.
> Have you checked all the docs?
>
> On 9 August 2012 01:19, Douglas Garstang  wrote:
>> Anyone? Anyone?
>>
>> Sent from my iPhone
>>
>> On Aug 7, 2012, at 4:47 PM, Douglas Garstang  wrote:
>>
>>> All,
>>>
>>> Is there a way to run puppet and specify to apply resources NOT
>>> containing a tag?
>>>
>>> ie, negating something like this?
>>>
>>> puppetd --tags solaris
>>>
>>> The use case for this is to put a tag in our application code so that
>>> when running puppet we know changes made there will NOT be enacted.
>>> The only way I can see to do it is to do the opposite put a tag
>>> indicating it isn't our code everywher else and run puppetd WITH the
>>> tag, which isn't as maintainable.
>>>
>>> Doug
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Scope Confusion!

2012-08-08 Thread Douglas Garstang
On Wed, Aug 8, 2012 at 6:25 AM, jcbollinger  wrote:
>
>
> On Tuesday, August 7, 2012 1:25:32 PM UTC-5, Douglas wrote:
>>
>> As usual, I'm confused about scope in puppet. This puppet 2.7.1.
>>
>> In my classes below, the bottom class, company::web::content, requires
>> the file resource '/usr/local/company'. However, that resource is
>> defined two includes back in the class company::common. I always
>> thought this wasn't supposed to work, and that you could only access
>> the immediate scope, not the scope of stuff beyond this. It does work
>> however. Is it supposed to. Why?
>
>
> Yes, it is supposed to.  All classes and resources have global scope once
> they are declared.  The 'include' function does not introduce classes and
> their resources into the current, innermost scope -- it doesn't need to do
> so, and couldn't even if it wanted to do.  Instead, 'include' ensures that
> the specified class has been parsed and added to the catalog, which, as I
> said, puts them into the global scope.
>
> The model pretty much has to work that way, because the physical resources
> of the target node all have global scope, too.
>
> It is useful and appropriate for classes and definitions to 'include' (or
> 'require') the classes on which they rely, provided that those classes are
> not parametrized (Puppet <= 2.7.x).  Aside from it's plain aggregation
> function, that way it's a lot easier to make classes independent of the
> order in which they are declared, plus it has documentary value.  Classes
> that 'include' all the classes on which they directly rely are more robust.
>
> However, there is no requirement for a class to 'include' its dependencies.
> If a class does not do so, then it simply relies on those dependencies to
> have been declared by some other class that was parsed before it.  Users of
> parametrized classes rely heavily on this, because parametrized classes can
> be declared only once, but they may need to be referenced by many other
> classes.
>

Ok, so to put it another way, your saying that once a class is
included, it's scope becomes global and can be used anywhere else, no
matter the relationship between the class where it was included, and
the class that's trying to access it?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Tag Negation

2012-08-08 Thread Douglas Garstang
Anyone? Anyone?

Sent from my iPhone

On Aug 7, 2012, at 4:47 PM, Douglas Garstang  wrote:

> All,
> 
> Is there a way to run puppet and specify to apply resources NOT
> containing a tag?
> 
> ie, negating something like this?
> 
> puppetd --tags solaris
> 
> The use case for this is to put a tag in our application code so that
> when running puppet we know changes made there will NOT be enacted.
> The only way I can see to do it is to do the opposite put a tag
> indicating it isn't our code everywher else and run puppetd WITH the
> tag, which isn't as maintainable.
> 
> Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Tag Negation

2012-08-07 Thread Douglas Garstang
All,

Is there a way to run puppet and specify to apply resources NOT
containing a tag?

ie, negating something like this?

puppetd --tags solaris

The use case for this is to put a tag in our application code so that
when running puppet we know changes made there will NOT be enacted.
The only way I can see to do it is to do the opposite put a tag
indicating it isn't our code everywher else and run puppetd WITH the
tag, which isn't as maintainable.

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Scope Confusion!

2012-08-07 Thread Douglas Garstang
As usual, I'm confused about scope in puppet. This puppet 2.7.1.

In my classes below, the bottom class, company::web::content, requires
the file resource '/usr/local/company'. However, that resource is
defined two includes back in the class company::common. I always
thought this wasn't supposed to work, and that you could only access
the immediate scope, not the scope of stuff beyond this. It does work
however. Is it supposed to. Why?


class company::common {
file {
'/usr/local/company':

}
}


class company::web::common {
include company::common
}


class company::web::content {
include company::web::common

file {
'/usr/local/company/www':
require => File['/usr/local/company']
}
}

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] File default precedence..?

2012-08-03 Thread Douglas Garstang
Something that I have been confused about for a while.

If I have:

/etc/puppet/modules/foo/manifests/bar.pp:
class foo::bar {
File {
backup => false
}
}

/etc/puppet/manifests/site.pp:
File { backup => true }

 which one takes precedence in this situation? What about when an
include or an inherit is used instead?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Relative Symlinks

2012-03-21 Thread Douglas Garstang
Thanks.

On Wed, Mar 21, 2012 at 10:04 AM, Christopher Wood
 wrote:
> $ cat /tmp/symlink.pp
> file { '/tmp/link_to_zz':
>  ensure => link,
>  target => 'zz',
> }
> $ puppet /tmp/symlink.pp
> notice: /Stage[main]//File[/tmp/link_to_zz]/ensure: created
> $ ls -l /tmp/link_to_zz
> lrwxrwxrwx 1 cwood cwood 2 Mar 21 13:03 /tmp/link_to_zz -> zz
>
> (ln target linkname)
>
> On Wed, Mar 21, 2012 at 09:59:50AM -0700, Douglas Garstang wrote:
>> Is there any way to get relative symlinks in puppet?
>>
>> This:
>>
>>     file {
>>         "tomcat-current":
>>         #"/opt/foo/apache-tomcat-current":
>>             ensure => link,
>>             target => "/opt/foo/apache-tomcat-${tomcat_version}";
>>     }
>>
>> yields:
>>
>> Wed Mar 21 09:58:05 -0700 2012 Puppet (err): Failed to apply catalog:
>> Parameter path failed: File paths must be fully qualified, not
>> 'tomcat-current' at
>> /etc/puppet/env/development/modules/tomcat7/manifests/server.pp:18
>>
>> Doug
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Relative Symlinks

2012-03-21 Thread Douglas Garstang
Is there any way to get relative symlinks in puppet?

This:

file {
"tomcat-current":
#"/opt/foo/apache-tomcat-current":
ensure => link,
target => "/opt/foo/apache-tomcat-${tomcat_version}";
}

yields:

Wed Mar 21 09:58:05 -0700 2012 Puppet (err): Failed to apply catalog:
Parameter path failed: File paths must be fully qualified, not
'tomcat-current' at
/etc/puppet/env/development/modules/tomcat7/manifests/server.pp:18

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] OpenSUSE weirdness.

2012-03-20 Thread Douglas Garstang
I'm having some weird issues with puppet 2.7.6 on OpenSUSE.

When I run puppet in the foreground, it's all fine. However, when I
run it as a service, all that get's logged is:

abc:/var/log/puppet # cat puppet.log
Tue Mar 20 10:11:57 -0700 2012 Puppet (warning): iconv doesn't seem to
support UTF-8/UTF-16 conversions
Tue Mar 20 10:11:58 -0700 2012 Puppet (notice): Reopening log files
Tue Mar 20 10:11:57 -0700 2012 Puppet (warning): iconv doesn't seem to
support UTF-8/UTF-16 conversions

Although, it seems to be running fine. When I stop the daemon, the
following is immediately flushed to puppet.log:

Tue Mar 20 10:12:47 -0700 2012 Puppet (notice): Starting Puppet client
version 2.7.6
Tue Mar 20 10:12:48 -0700 2012 Puppet (err): Could not retrieve
catalog from remote server: getaddrinfo: Name or service not known
Tue Mar 20 10:12:48 -0700 2012 Puppet (notice): Using cached catalog
Tue Mar 20 10:12:50 -0700 2012
/Stage[main]/Sudo::Common/File[/etc/sudoers] (err): Could not
evaluate: getaddrinfo: Name or service not known Could not retrieve
file metadata for puppet:///modules/sudo/etc/sudoers: getaddrinfo:
Name or service not known at
/etc/puppet/modules/sudo/manifests/common.pp:17
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Snmp::Agent/File[/etc/snmp/snmpd.conf] (err): Could not
evaluate: getaddrinfo: Name or service not known Could not retrieve
file metadata for puppet:///modules/snmp/etc/snmp/snmpd.conf:
getaddrinfo: Name or service not known at
/etc/puppet/modules/snmp/manifests/agent.pp:26
Tue Mar 20 10:12:51 -0700 2012 /Stage[main]/Snmp::Agent/Service[snmpd]
(notice): Dependency File[/etc/snmp/snmpd.conf] has failures: true
Tue Mar 20 10:12:51 -0700 2012 /Stage[main]/Snmp::Agent/Service[snmpd]
(warning): Skipping because of failed dependencies
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Ssh::Server/File[/etc/ssh/sshd_config] (err): Could not
evaluate: getaddrinfo: Name or service not known Could not retrieve
file metadata for puppet:///modules/ssh/etc/ssh/sshd_config:
getaddrinfo: Name or service not known at
/etc/puppet/modules/ssh/manifests/server.pp:26
Tue Mar 20 10:12:51 -0700 2012 /Stage[main]/Ssh::Server/Service[sshd]
(notice): Dependency File[/etc/ssh/sshd_config] has failures: true
Tue Mar 20 10:12:51 -0700 2012 /Stage[main]/Ssh::Server/Service[sshd]
(warning): Skipping because of failed dependencies
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Mcollective::Agent/File[/usr/libexec/mcollective/mcollective/agent/package.rb]
(err): Could not evaluate: getaddrinfo: Name or service not known
Could not retrieve file metadata for
puppet:///modules/mcollective/agent/package.rb: getaddrinfo: Name or
service not known at
/etc/puppet/modules/mcollective/manifests/agent.pp:43
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Mcollective::Agent/Service[mcollective] (notice):
Dependency File[/usr/libexec/mcollective/mcollective/agent/package.rb]
has failures: true
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Mcollective::Agent/Service[mcollective] (warning):
Skipping because of failed dependencies
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Postfix::Server/File[/etc/postfix/main.cf] (err): Could
not evaluate: getaddrinfo: Name or service not known Could not
retrieve file metadata for
puppet:///modules/postfix/etc/postfix/main.cf: getaddrinfo: Name or
service not known at
/etc/puppet/modules/postfix/manifests/server.pp:27
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Postfix::Server/Service[postfix] (notice): Dependency
File[/etc/postfix/main.cf] has failures: true
Tue Mar 20 10:12:51 -0700 2012
/Stage[main]/Postfix::Server/Service[postfix] (warning): Skipping
because of failed dependencies
Tue Mar 20 10:12:51 -0700 2012 Puppet (notice): Finished catalog run
in 1.82 seconds
Tue Mar 20 10:12:52 -0700 2012 Puppet (err): Could not send report:
getaddrinfo: Name or service not known
Tue Mar 20 10:13:24 -0700 2012 Puppet (notice): Caught TERM; calling stop

I'm rather confused. I tried putting autoflush = true in the [user]
section of puppet.conf but it had no effect. I also don't know why
those name service errors are occurring.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] extlookup can't match key.

2012-03-20 Thread Douglas Garstang
On Tue, Mar 20, 2012 at 9:55 AM, Nan Liu  wrote:
> On Tue, Mar 20, 2012 at 9:33 AM, Douglas Garstang
>  wrote:
>> On Tue, Mar 20, 2012 at 8:03 AM, Douglas Garstang
>>  wrote:
>>> On Tue, Mar 20, 2012 at 7:33 AM, Douglas Garstang
>>>  wrote:
>>>> On Mon, Mar 19, 2012 at 5:53 PM, Gary Larizza  wrote:
>>>>>
>>>>>
>>>>> On Tue, Mar 20, 2012 at 11:35 AM, Douglas Garstang 
>>>>> 
>>>>> wrote:
>>>>>>
>>>>>> I have a 2.7.6 server and a 2.6.4 client. I'm trying to use ext_lookup.
>>>>>>
>>>>>> site.pp:
>>>>>> $extlookup_datadir = "/etc/puppet/manifests/extdata"
>>>>>> $extlookup_precedence = ["%{fqdn}", "domain_%{domain}", "common"]
>>>>>
>>>>>
>>>>> Try using Puppet variables:  [$fqdn, "domain_${domain}", 'common']
>>>>
>>>> Tried. Still getting the same error. I don't think it's even
>>>> recognizing ext lookup(). Wasn't that functionality added in puppet
>>>> 2.6? Btw, what I originally had was copied straight from the docs.
>>>>
>>>> Doug
>>>
>>> I get the same error if I replace ext lookup with xxx. It seems like
>>> the function isn't there, yet the docs clearly state it was added in
>>> puppet 2.6.1, and my server is 2.7.6 and my client is 2.6.4...
>
> If you replace extlookup with xxx it should error:
> $ puppet apply -e " notice(xxx('key1','unknown'))"
> Unknown function xxx at line 1 ...
>
> $ puppet apply -e "notice(extlookup('key1','unknown'))"
> notice: Scope(Class[main]): unknown
> notice: Finished catalog run in 0.04 seconds
>
> Feel free to try the one line example above, it doesn't seem like it's
> compiling the manifest you are describing.

So, now it's working. _after_ I upgraded the client to 2.7.6...

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] extlookup can't match key.

2012-03-20 Thread Douglas Garstang
On Tue, Mar 20, 2012 at 8:03 AM, Douglas Garstang
 wrote:
> On Tue, Mar 20, 2012 at 7:33 AM, Douglas Garstang
>  wrote:
>> On Mon, Mar 19, 2012 at 5:53 PM, Gary Larizza  wrote:
>>>
>>>
>>> On Tue, Mar 20, 2012 at 11:35 AM, Douglas Garstang 
>>> wrote:
>>>>
>>>> I have a 2.7.6 server and a 2.6.4 client. I'm trying to use ext_lookup.
>>>>
>>>> site.pp:
>>>> $extlookup_datadir = "/etc/puppet/manifests/extdata"
>>>> $extlookup_precedence = ["%{fqdn}", "domain_%{domain}", "common"]
>>>
>>>
>>> Try using Puppet variables:  [$fqdn, "domain_${domain}", 'common']
>>
>> Tried. Still getting the same error. I don't think it's even
>> recognizing ext lookup(). Wasn't that functionality added in puppet
>> 2.6? Btw, what I originally had was copied straight from the docs.
>>
>> Doug
>
> I get the same error if I replace ext lookup with xxx. It seems like
> the function isn't there, yet the docs clearly state it was added in
> puppet 2.6.1, and my server is 2.7.6 and my client is 2.6.4...
>
> Doug

Jeez... it shouldn't be this damn hard...

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] extlookup can't match key.

2012-03-20 Thread Douglas Garstang
On Tue, Mar 20, 2012 at 7:33 AM, Douglas Garstang
 wrote:
> On Mon, Mar 19, 2012 at 5:53 PM, Gary Larizza  wrote:
>>
>>
>> On Tue, Mar 20, 2012 at 11:35 AM, Douglas Garstang 
>> wrote:
>>>
>>> I have a 2.7.6 server and a 2.6.4 client. I'm trying to use ext_lookup.
>>>
>>> site.pp:
>>> $extlookup_datadir = "/etc/puppet/manifests/extdata"
>>> $extlookup_precedence = ["%{fqdn}", "domain_%{domain}", "common"]
>>
>>
>> Try using Puppet variables:  [$fqdn, "domain_${domain}", 'common']
>
> Tried. Still getting the same error. I don't think it's even
> recognizing ext lookup(). Wasn't that functionality added in puppet
> 2.6? Btw, what I originally had was copied straight from the docs.
>
> Doug

I get the same error if I replace ext lookup with xxx. It seems like
the function isn't there, yet the docs clearly state it was added in
puppet 2.6.1, and my server is 2.7.6 and my client is 2.6.4...

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] extlookup can't match key.

2012-03-20 Thread Douglas Garstang
On Mon, Mar 19, 2012 at 5:53 PM, Gary Larizza  wrote:
>
>
> On Tue, Mar 20, 2012 at 11:35 AM, Douglas Garstang 
> wrote:
>>
>> I have a 2.7.6 server and a 2.6.4 client. I'm trying to use ext_lookup.
>>
>> site.pp:
>> $extlookup_datadir = "/etc/puppet/manifests/extdata"
>> $extlookup_precedence = ["%{fqdn}", "domain_%{domain}", "common"]
>
>
> Try using Puppet variables:  [$fqdn, "domain_${domain}", 'common']

Tried. Still getting the same error. I don't think it's even
recognizing ext lookup(). Wasn't that functionality added in puppet
2.6? Btw, what I originally had was copied straight from the docs.

Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



  1   2   3   4   5   6   7   >