file copy, multiple ignore doesn't work

549 views
Skip to first unread message

iamauser

unread,
Jan 2, 2013, 4:17:39 PM1/2/13
to puppet...@googlegroups.com
I am trying the following to recursively copy a dir while ignoring things like .hg and a few others.

file { 
  "/etc/work-related-dir" :
      source => "/path/to/masterfiles/work-related-dir",
      recurse => 'inf',
      owner => '0',
      group => '0',
      ignore => '{.hg,*.conf~}',
      checksum => 'mtime',
      backup => false;
}

Running a noop mode tries to copy everything including the one that matches ".hg, *.conf~". If I specify only a single parameter value for ignore, i.e. ".hg", then it doesn't try the copy of .hg directory and works as expected.

Following an earlier post about this, I checked Ruby's globing options,and found that the pattern I am providing matches multiple files in the source area.

Any help or suggestion would be appreciated.

jcbollinger

unread,
Jan 3, 2013, 9:22:44 AM1/3/13
to puppet...@googlegroups.com

When you say "you checked Ruby's globbing options", do you mean you actually ran the glob against the target directory using the same Ruby that the master runs on?  It should be pretty easy to do that via irb, just to be sure, though I don't actually see a problem with your glob.  Since the type docs specifically say that the ignore pattern is interpreted via Ruby's globbing engine, I suggest you file a ticket if Puppet is including files that genuinely match your 'ignore' glob.

Meanwhile, the Puppet type documentation subtly hints that you may be able to pass an array of ignore patterns.  I don't know whether that actually works, but you could try it instead of glob alternation, i.e. "ignore => ['.hg', '*.conf~']".


John

iamauser

unread,
Jan 3, 2013, 11:35:47 AM1/3/13
to puppet...@googlegroups.com


When you say "you checked Ruby's globbing options", do you mean you actually ran the glob against the target directory using the same Ruby that the master runs on?  It should be pretty easy to do that via irb, just to be sure, though I don't actually see a problem with your glob.  Since the type docs specifically say that the ignore pattern is interpreted via Ruby's globbing engine, I suggest you file a ticket if Puppet is including files that genuinely match your 'ignore' glob.


Yes, I used irb to test the matching files with the patterns.
 
Meanwhile, the Puppet type documentation subtly hints that you may be able to pass an array of ignore patterns.  I don't know whether that actually works, but you could try it instead of glob alternation, i.e. "ignore => ['.hg', '*.conf~']".

That worked... Thanks for the tips... I believe I tried this earlier, but missing a comma somewhere ;)
 


John

Peter Brown

unread,
Jan 6, 2013, 10:32:18 PM1/6/13
to puppet-users
More a random question than anything.
I am going to assume the .hg files are from mercurial.
Assuming this I am wondering why you aren't using something like puppetlabs-vcsrepo on puppet forge to deploy the directory via mercurial.
It seems like a better idea in my brain.

Pete.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/u2yIrhvtie0J.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Reply all
Reply to author
Forward
0 new messages