Issue #3873 has been updated by Paul Lathrop.

We also ran into this, in a slightly different use case. We want to trigger an 
exec resource but only if a file doesn't contain the string /mnt. So 
(sanitized):

exec { 'update_status':
  command => '/usr/local/bin/update_status',
  unless       => '/bin/grep -E "[[:blank:]]/mnt[[:blank:]]" 
/var/lib/status_file',
}

This causes Puppet to fail to apply the catalog with an error message saying: 
'invalid tag: "/mnt"', because we are managing a mount resource for /mnt 
elsewhere in the catalog.

I would argue that this behavior brutally violates the Principle of Least 
Surprise, and is the bad kind of magic (as opposed to the good kind, i.e. 
auto-requiring parent directory resources when they are managed).

This is on puppet version 2.6.14
----------------------------------------
Bug #3873: Unexpected dependency created by exec
https://projects.puppetlabs.com/issues/3873#change-61523

Author: Ben Beuchler
Status: Accepted
Priority: Normal
Assignee: Randall Hansen
Category: RAL
Target version: 
Affected Puppet version: 0.25.4
Keywords: 
Branch: 


It looks like the Exec type is automatically creating dependencies on any files 
mentioned in the "onlyif" and "unless" parameters.  While I understand that 
this is likely to be the most commonly desired behavior, it can unexpectedly 
break things.  As an example, this is the code that triggered the behavior for 
me:

<pre>
class syslog-ng::weblogger inherits syslog-ng {
    $alp = "/var/spool/apache2/access_log_pipe"

    file { "/var/spool/apache2":
        ensure => directory,
        owner  => www-data,
        group  => www-data
    }

    File["/etc/syslog-ng/syslog-ng.conf"] {
        require => File[ "$alp" ]
    }

    # If apache started first and created $alp as a normal file, delete
    # it.
    exec { "cleanup_alp":
        command => "/bin/rm ${alp}",
        unless  => "/usr/bin/test -p ${alp}",
    }

    # If the FIFO doesn't exist, create it.
    exec { "access_log_pipe":
        command => "/usr/bin/mkfifo ${alp}",
        unless  => "/usr/bin/test -p ${alp}",
        require => Exec["cleanup_alp"],
    }

    # Ensure permissions are correct on the pipe.
    file { "$alp":
        ensure => present,
        owner  => www-data,
        group  => www-data,
        mode   => 0770,
        require => Exec["access_log_pipe"]
    }

}
</pre>

I'll attach the relevant section of the `--graph` output.  Note the unrequested 
dependency between `Exec[cleanup_alp]` and 
`File[/var/spool/apache2/access_log_pipe]`.

Filing this as a bug as suggested by Dan Bode: 
http://groups.google.com/group/puppet-users/browse_thread/thread/73a98af374c3f7f2


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to