On Fri, Aug 10, 2012 at 10:14 AM, Matt Zagrabelny <mzagr...@d.umn.edu> wrote:
> On Fri, Aug 10, 2012 at 9:53 AM, David Schmitt <da...@dasz.at> wrote:
>> On 10.08.2012 16:19, Matt Zagrabelny wrote:
>>>
>>> Hi!
>>>
>>> I've got a simple file and exec resource coupling that does not seem
>>> to be working as expected:
>>>
>>>    file { "/etc/postfix/transport":
>>>      source  => "puppet:///private/etc/postfix/transport",
>>>    }
>>>
>>>    exec { "rebuild_transport_index_for_mailman":
>>>      command     => "postmap /etc/postfix/transport",
>>>      path        => "/bin:/sbin:/usr/bin:/usr/sbin",
>>>      subscribe   => File["/etc/postfix/transport"],
>>>      refreshonly => true,
>>>    }
>>>
>>> The above postmap command should create the file
>>> "/etc/postfix/transport.db".
>>>
>>> I restart puppet on the node and the exec is not run:
>>>
>>> Aug 10 09:16:11 lists puppet-agent[1099]: Starting Puppet client version
>>> 2.6.2
>>> Aug 10 09:16:13 lists puppet-agent[1099]:
>>> (/Stage[main]/Mailman::Service/Service[mailman]/ensure) ensure changed
>>> 'stopped' to 'running'
>>> Aug 10 09:16:18 lists puppet-agent[1099]: Finished catalog run in 5.43
>>> seconds
>>>
>>> Of course the "transport.db" does not get created:
>>>
>>> % ls -alhrt /etc/postfix
>>> total 84K
>>> drwxr-xr-x  2 root root 4.0K May  4  2011 sasl
>>> -rwxr-xr-x  1 root root  24K May  4  2011 post-install
>>> -rwxr-xr-x  1 root root 8.6K May  4  2011 postfix-script
>>> -rw-r--r--  1 root root  19K May  4  2011 postfix-files
>>> -rw-r--r--  1 root root  318 Aug  9 14:57 dynamicmaps.cf
>>> drwxr-xr-x 77 root root 4.0K Aug  9 15:35 ..
>>> -rw-r--r--  1 root root 1.7K Aug  9 16:26 main.cf
>>> -rw-r--r--  1 root root   31 Aug  9 16:52 transport
>>> -rw-r--r--  1 root root 4.0K Aug  9 16:52 master.cf
>>> drwxr-xr-x  3 root root 4.0K Aug 10 09:11 .
>>>
>>> Any ideas of how to debug this?
>
> Hi David,
>
>> You already have all the information. "/etc/postfix/transport" didn't
>> change, and thus didn't notify the exec, which didn't run.
>
> Thanks for the pointer. I had a disconnect between a resource not
> existing (supposing in my head /etc/postfix/transport.db was a file
> resource) and the fact that it resulted from an exec resource.

A followup to this discussion. Is there a more optimal way to ensure
the file (/etc/postfix/transport.db) is created by the exec and is
subscribed to the source file?

  file { "/etc/postfix/transport":
    source  => "puppet:///private/etc/postfix/transport",
  }
  exec { "build_transport_index_for_mailman_if_it_doesnt_exist":
    command     => "postmap /etc/postfix/transport",
    path        => "/bin:/sbin:/usr/bin:/usr/sbin",
    unless      => "test -f /etc/postfix/transport.db",
  }
  exec { "rebuild_transport_index_for_mailman":
    command     => "postmap /etc/postfix/transport",
    path        => "/bin:/sbin:/usr/bin:/usr/sbin",
    subscribe   => File["/etc/postfix/transport"],
    refreshonly => true,
  }

Thanks for any hints.

-mz

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