Just in case anyone searches on some keywords in this thread, I feel it only
appropriate to put the final, working manifests here.  Note that the
environment variable in Exec['install supervisor'] changed to lower case and
the set for $id/process in the define uses quotes around the value since the
value provided has a space.

  1 # class to install supervisor
  2 class supervisor {
  3         include inittab
  4
  5         # pre-requisites
  6         package{"python-setuptools":
  7                 ensure => installed,
  8         }
  9
 10         # install supervisor
 11         # this will resolve some python dependencies
 12         # also, ausprod probably needs the http_proxy
 13         exec{"install supervisor":
 14                 command => "/usr/bin/easy_install supervisor",
 15                 environment => $hostname ? {
 16                         /^ind/ => 'http_proxy=http://proxyservice:3128',
 17                         default => '',
 18                 },
 19                 require => Package['python-setuptools'],
 20                 creates => '/usr/local/bin/supervisord',
 21                 logoutput => "on_failure",
 22         }
 23
 24         # default supervisord.conf for supervisord and supervisordctl
should not be readable by world
 25         file{"/etc/supervisord.conf":
 26                 owner => 'root',
 27                 group => 'root',
 28                 mode => '600',
 29                 source =>
"puppet:///modules/supervisor/supervisord.conf",
 30         }
 31
 32         # running 'init a' will start supervisord -- should be called at
the end of /etc/init.d/Indeed to start tomcats after slaving/caching
 33         inittab::conf{"supervisor":
 34                 id => 'supe',
 35                 runlevels => 'a',
 36                 action => 'respawn',
 37                 process => '/usr/local/bin/supervisord -n',
 38                 require => Exec["install supervisor"],
 39         }
...


  1 # generic class to allow /etc/inittab management
  2 class inittab {
  3         define conf (
  4                 $id,
  5                 $runlevels = '123456',
  6                 $action = 'respawn',
  7                 $process
  8         ) {
  9
 10                 augeas {"inittab_$id":
 11                         context => "/files/etc/inittab",
 12                         force => "true",
 13                         require => $require,
 14                         changes => [
 15                                 "set $id/runlevels $runlevels",
 16                                 "set $id/action $action",
 17                                 "set $id/process '$process'",
 18                                 ],
 19                 }
 20         }
 21
 22 }



On Fri, Aug 6, 2010 at 6:31 PM, Jason Koppe <jason.robert.ko...@gmail.com>wrote:

> I ended up getting this syntax to work:
>
> Here is the class calling the define:
>
>   2 class supervisor {
> ...
>  13         exec{"install supervisor":
> ...
>  32
>  33         # running 'init a' will start supervisord -- should be called
> at the end of /etc/init.d/Indeed to start tomcats after slaving/caching
>  34         inittab::conf{"supervisor":
>  35                 id => 'supe',
>  36                 runlevels => 'a',
>  37                 action => 'respawn',
>  38                 process => '/usr/local/bin/supervisord -n',
>  39                 require => Exec["install supervisor"],
>  40         }
>
>
> Here is the inittab module with the define:
>
>
>   1 # generic class to allow /etc/inittab management
>   2 class inittab {
>   3         define conf (
>   4                 $id,
>   5                 $runlevels = '123456',
>   6                 $action = 'respawn',
>   7                 $process
>   8         ) {
>   9
>  10                 augeas {"inittab_$id":
>  11                         context => "/files/etc/inittab",
>  12                         force => "true",
>  13                         require => $require,
>  14                         changes => [
>  15                                 "set $id/runlevels $runlevels",
>  16                                 "set $id/action $action",
>  17                                 "set $id/process $process",
>  18                                 ],
>  19                 }
>  20         }
>  21
>  22 }
>
>
>
>
> On Fri, Aug 6, 2010 at 6:21 PM, Jason Koppe 
> <jason.robert.ko...@gmail.com>wrote:
>
>> If you just mean this:
>>
>>   1 # generic class to allow /etc/inittab management
>>   2 class inittab {
>>   3         define conf (
>>   4                 $id,
>>   5                 $runlevels = '123456',
>>   6                 $action = 'respawn',
>>   7                 $process
>>   8         ) {
>>   9                 $require
>>  10
>>  11                 augeas {"inittab_$id":
>>  12                         context => "/files/etc/inittab",
>>  13                         changes => [
>>  14                                 "set $id/runlevels $runlevels",
>>  15                                 "set $id/action $action",
>>  16                                 "set $id/process $process",
>>  17                                 ],
>>  18                 }
>>  19         }
>>  20
>>  21 }
>>
>>
>> Now, I'm getting this error:
>> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
>> Could not parse for environment jkoppe: Syntax error at 'augeas'; expected
>> '}' at
>> /home/jkoppe/svn/production/puppet/modules/inittab/manifests/init.pp:11 on
>> node indtst5
>>
>>
>>
>> On Fri, Aug 6, 2010 at 6:13 PM, Jason Koppe <jason.robert.ko...@gmail.com
>> > wrote:
>>
>>> I'm having similar problems, should it be:
>>>
>>> class inittab {
>>>         define conf (
>>>                 $id,
>>>                 $runlevels = '123456',
>>>                 $action = 'respawn',
>>>                 $process
>>>         ) {
>>>                 $require {
>>>                         $require
>>>                 }
>>>
>>>                 augeas {"inittab_$id":
>>>                         context => "/files/etc/inittab",
>>>                         changes => [
>>>                                 "set $id/runlevels $runlevels",
>>>                                 "set $id/action $action",
>>>                                 "set $id/process $process",
>>>                                 ],
>>>
>>>
>>>                 }
>>>         }
>>>
>>> }
>>>
>>> With that, I get:
>>> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
>>> Could not parse for environment jkoppe: Syntax error at '{'; expected '}' at
>>> /home/jkoppe/svn/production/puppet/modules/inittab/manifests/init.pp:10 on
>>> node indtst5
>>>
>>>
>>> On Mon, Jul 12, 2010 at 6:48 AM, Tim <tkedwa...@fastmail.com.au> wrote:
>>>
>>>> Thanks, that fixed it.
>>>>
>>>> On Jul 9, 5:10 pm, Alan Barrett <a...@cequrux.com> wrote:
>>>> > On Fri, 09 Jul 2010, Tim wrote:
>>>> > > # Generic config file
>>>> > > define config-file ($fullpath, $source) {
>>>> > >         if $require {
>>>> > >                 require $require
>>>> > >         }
>>>> > >         file { $fullpath:
>>>> > >         source => 
>>>> > > "puppet://puppet.hq.eso.org/modules/${source}<http://puppet.hq.eso.org/modules/$%7Bsource%7D>
>>>> ",
>>>> > >         backup => mainbackup,
>>>> > >         mode => 644,
>>>> > >         ensure => file,
>>>> > >         group => root,
>>>> > >         owner => root
>>>> > >         }
>>>> > > }
>>>> >
>>>> > Just delete the "if" statement and the explicit "require" statement,
>>>> and
>>>> > the right thing should happen.  Any "require" passed to your
>>>> definition
>>>> > should propagate to the "file" resource insuide the definition
>>>> > automatically.
>>>> >
>>>> > --apb (Alan Barrett)
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Puppet Users" group.
>>>> To post to this group, send email to puppet-us...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/puppet-users?hl=en.
>>>>
>>>>
>>>
>>>
>>> --
>>> Jason Koppe
>>> jason.robert.ko...@gmail.com
>>> Cell (210) 445-8242
>>>
>>
>>
>>
>> --
>> Jason Koppe
>> jason.robert.ko...@gmail.com
>> Cell (210) 445-8242
>>
>
>
>
> --
> Jason Koppe
> jason.robert.ko...@gmail.com
> Cell (210) 445-8242
>



-- 
Jason Koppe
jason.robert.ko...@gmail.com
Cell (210) 445-8242

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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