Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
1  
From giving the documentation a cursory examination, that does not seem to be possible, sadly. –  Felix Frank Jun 26 at 13:40
1  
Is there any option to change the location of the named pipe? –  ewwhite Jun 26 at 13:51
    
General note, you want to add checksum => none to such resources, otherwise an agent run may become quite expensive (with puppet calculating each file's md5sum). –  Felix Frank Jun 26 at 14:35
    
Sadly no, it is already a tmp directory, and I think build in the software –  Willem Noorduin Jun 27 at 7:10

1 Answer 1

up vote 2 down vote accepted

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 {} \;"
} 
share|improve this answer
1  
Ah, the pragmatic way - crude and effective ;-) I've been there, but have since found it to be better practice to have puppet manage a cron job to do just that work instead. YMMV. This may just be fine for you. –  Felix Frank Jun 26 at 14:33
    
Thanks for this –  Willem Noorduin Jun 27 at 7:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.