problems with dependencies

7 views
Skip to first unread message

russell.fulton

unread,
Jan 20, 2011, 11:00:12 PM1/20/11
to Puppet Users
Hi

I get this error from this manifest:
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find resource 'File[/home/snort/resnet/Rules/]File[/
home/snort/resnet/conf/pp]File[/home/snort/resnet/conf/pp.conf]' for
relationship from 'Exec[/home/snort/bin/pulledpork -nc resnet/conf/
pp.conf]' on node mon263550.insec.auckland.ac.nz

I have resource definitions for all the files so what am I doing
wrong?

This is my first try at explicitly spelling out dependencies.


Abbreviated contents of the manifest.


class monitor {

define sensor ( $name, $master, $instance, $rule_categories,
$base_filter, $rule_files ) {

exec {
"/home/snort/bin/pulledpork -nc $master/conf/pp.conf":
}

file {
"/home/snort/$master":
ensure => directory;
"/home/snort/$master/conf/barnyard.conf":
ensure => present;
"/home/snort/$master/conf/snort.conf":
ensure=>directory;
"/home/snort/$master/conf/pp.conf":
ensure=>present;
"/home/snort/$name.instance.conf":
ensure=>present;
"/home/snort/$master/conf/pp":
ensure => present;
"/home/snort/$master/Rules/":
ensure => present;
}
Exec["/home/snort/bin/pulledpork -nc $master/conf/pp.conf"] ->
File["/home/snort/$master/Rules/","/home/snort/$master/conf/
pp","/home/snort/$master/conf/pp.conf"]
<- File["/home/snort/$master"]
}
}

jcbollinger

unread,
Jan 21, 2011, 3:36:08 PM1/21/11
to Puppet Users
Hmm. Your particular usage of resource chaining is not among those
described in the language docs. In any case, I don't see anything
gained in this case by separating the dependency declarations from the
resource declarations. Maybe I'm just old fashioned. Anyway, here's
how I would write it:

class monitor {

define sensor ( $name, $master, $instance, $rule_categories,
$base_filter, $rule_files ) {

file {
"/home/snort/$master":
ensure => directory;
"/home/snort/$master/conf/barnyard.conf":
ensure => present;
"/home/snort/$master/conf/snort.conf":
ensure=>directory;
"/home/snort/$master/conf/pp.conf":
ensure=>present;
"/home/snort/$name.instance.conf":
ensure=>present;
"/home/snort/$master/conf/pp":
ensure => present;
"/home/snort/$master/Rules/":
ensure => present;
}

exec {
"/home/snort/bin/pulledpork -nc $master/conf/pp.conf":
before => [ File["/home/snort/$master/Rules/"],
File["/home/snort/$master/conf/pp"],
File["/home/snort/$master/conf/pp.conf"] ];
}
}
}


Note that

1) Your braces were unbalanced. I balanced them by inserting a
closing brace where it looked like one belonged.

2) Although I moved the Exec resource after the Files, their relative
locations in the manifest should not matter.

3) Puppet automatically generates dependencies between File["/parent/
foo"] and File["/parent"] (the former requires / is managed before the
latter). I therefore omitted the explicit declaration of this same
dependency.

Also,

4) I've never configured snort. Is /home/snort/$master/conf/
snort.conf really supposed to be a directory?

5) /home/snort/$master/Rules/ sure looks like a directory. Are you
sure you don't want to declare ensure => directory for it?


Cheers,

John

russell.fulton

unread,
Jan 23, 2011, 9:17:21 PM1/23/11
to Puppet Users
Thanks John... using before worked.

I'm new to puppet and I found the independent resource chaining stuff
before I found 'before' which I note is not mentioned anywhere in the
docs for exec.

is this a doc bug or is it a generic option available with all
resources?

On Jan 22, 4:36 am, jcbollinger <John.Bollin...@stJude.org> wrote:
> On Jan 20, 5:00 pm, "russell.fulton" <russell.ful...@gmail.com> wrote:
>
>

>
> Note that
>
> 1) Your braces were unbalanced.  I balanced them by inserting a
> closing brace where it looked like one belonged.

Sorry about that I trimmed the manifest...

>
> 3) Puppet automatically generates dependencies between File["/parent/
> foo"] and File["/parent"] (the former requires / is managed before the
> latter).  I therefore omitted the explicit declaration of this same
> dependency.

makes sense....

>
> Also,
>
> 4) I've never configured snort.  Is /home/snort/$master/conf/
> snort.conf really supposed to be a directory?

it isn't -- something else that got mangled when I stripped the
manifest...

>
> 5) /home/snort/$master/Rules/ sure looks like a directory.  Are you
> sure you don't want to declare ensure => directory for it?


I had assumed that having recursive defined (this again was stripped)
would be enough -- I've changed it and it still works :)

Nigel Kersten

unread,
Jan 23, 2011, 10:17:22 PM1/23/11
to puppet...@googlegroups.com
On Sun, Jan 23, 2011 at 1:17 PM, russell.fulton
<russell...@gmail.com> wrote:
> Thanks John... using before worked.
>
> I'm new to puppet and I found the independent resource chaining stuff
> before I found 'before' which I note is not mentioned anywhere in the
> docs for exec.
>
> is this a doc bug or is it a generic option available with all
> resources?

It's the latter Russell. You can find them all in the metaparameter docs.

http://docs.puppetlabs.com/references/latest/metaparameter.html


>
> On Jan 22, 4:36 am, jcbollinger <John.Bollin...@stJude.org> wrote:
>> On Jan 20, 5:00 pm, "russell.fulton" <russell.ful...@gmail.com> wrote:
>>
>>
>
>>
>> Note that
>>
>> 1) Your braces were unbalanced.  I balanced them by inserting a
>> closing brace where it looked like one belonged.
>
> Sorry about that I trimmed the manifest...
>
>>
>> 3) Puppet automatically generates dependencies between File["/parent/
>> foo"] and File["/parent"] (the former requires / is managed before the
>> latter).  I therefore omitted the explicit declaration of this same
>> dependency.
>
> makes sense....
>
>>
>> Also,
>>
>> 4) I've never configured snort.  Is /home/snort/$master/conf/
>> snort.conf really supposed to be a directory?
>
> it isn't -- something else that got mangled when I stripped the
> manifest...
>
>>
>> 5) /home/snort/$master/Rules/ sure looks like a directory.  Are you
>> sure you don't want to declare ensure => directory for it?
>
>
> I had assumed that having recursive defined (this again was stripped)
> would be enough -- I've changed it and it still works :)
>

> --
> 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.
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
>
>

jcbollinger

unread,
Jan 24, 2011, 2:55:27 PM1/24/11
to Puppet Users
Russel, I'm glad it's working for you now. I just want to clear up a
typo in my previous comments, lest it confuse someone else later:

On Jan 21, 9:36 am, jcbollinger <John.Bollin...@stJude.org> wrote:
[...]
> 3) Puppet automatically generates dependencies between File["/parent/
> foo"] and File["/parent"] (the former requires / is managed before the
> latter). [...]

That should say File["/parent/foo"] requires / is managed *after*
File["/parent"].


John
Reply all
Reply to author
Forward
0 new messages