On Feb 16, 2:44 am, Felix Frank <[email protected]>
wrote:
> here's what I'd do:
>
> > include devices
> > class service {
> >     file {
> >         "/opt":
> >             ensure => directory,
> >             owner => root,
> >             group => wheel,
> >             mode => 755;
> >         "/opt/home":
> >             ensure => directory,
> >             owner => root,
> >             group => wheel,
> >             mode => 755;
> >     }
> >     define app (
> >         $homedir = "/opt/home",
> >         $service_num
> >     ) {
> >         file {
> >             "$homedir/${service_num}":
> >                 ensure  =>  directory,
> >                 owner   =>  root,
> >                 group   =>  wheel,
> >                 mode    =>  0750;
> >             "$homedir/${service_num}/dev":
> >                 ensure  =>  directory,
> >                 owner   =>  root,
> >                 group   =>  wheel,
> >                 mode    =>  0750;
> >         }
>
>           Devices::Device_node {
>               dir     => "$homedir/${service_num}/dev/",
>               require => File["$homedir/${service_num}/dev/"],
>           }
>
> >         devices::device_node {
> >             "${homedir}/${service_num}/dev/null": ;
> >             "${homedir}/${service_num}/dev/random": ;
> >         }
> >     }
> > }

> Although why your original approach didn't work is not quite fathomable
> to me. If the error persistes, try and make a simplified version of your
> manifests that reproduces the same problem. Often, this will make a
> mistake obvious (when it stops to reproduce after all).

In general, if Puppet attempts to apply resources in a sequence that
doesn't work, then it means that there are resource relationships that
are not implicit and have not been declared.  That's exactly the case
in the OP's manifest: there is nothing in it that would create an
order relation between devices::device_node instances and the
directories named in their $dir parameters.  Exec resources are not
documented to (and evidently do not) autorequire any part of the path
to their 'cwd' or 'creates' parameters.  The sequence of declarations
in the manifest is irrelevant.

Adding an appropriate requires => to Devices::device_node
instantiations, as suggested, should do the trick.  Alternatively, the
requires => could be put on one of the resources inside the defined
type (in this case, the only candidate is the Exec).  Personally, I
prefer the latter whenever it is feasible, which in this case it is.


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

Reply via email to