How to exclude named pipes and sockets in Puppet?
We have an application which spawns named pipes (type p) on the fly. We want to manage the other files of the directory where the pipes are spawned with Puppet. Is there a simple way to tell puppet to skip that type of file. I could ignore a couple of files, like so:
file {'/var/opt/OV/share/tmp':
ensure => directory,
recurse => true, # enable recursive directory management
owner => user,
group => group,
mode => 2775,
ignore => 'ovcd.*',
}
But as I said, I cannot determine how the pipes are named beforehand. I should really like ignore => Type p or something like that. Can this be done standardly in Puppet?
I ended up with:
exec { "set_perms_tmp":
command => '/usr/bin/find /var/opt/OV/tmp ! \( -type s -o -type p \) -exec chmod 2775 {} \; -exec chown -R bin:bin /var/opt/OV/tmp/* {} \;'
}
Sockets and Puppet are no joy either.
When something isn't builtin to file, I generally just to turn to an puppet exec
declaration. By using find to execute whatever commands you mean by "manage files" you should be able to accomplish your goal.
Find can exclude Named Pipes:
-type c
File is of type c:
b block (buffered) special
c character (unbuffered) special
d directory
p named pipe (FIFO)
f regular file
....
So something like:
exec { "set_perms":
command => "/usr/bin/find /var/opt/OV/share/tmp ! -type p -exec chmod 2775 {} \;"
}