On Jan 20, 5:00 pm, "russell.fulton" <russell.ful...@gmail.com> wrote:
> 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"]
>     }
>
>
>
> }

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

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

Reply via email to