diff options
author | Gabriel Nagy <gabrielnagy@me.com> | 2020-05-06 15:21:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 15:21:55 +0300 |
commit | 575c45082d48624ab8ed952b01c17302c0e4e1ef (patch) | |
tree | d4fd1507999a0d61b2edbc89f5381048470afb1b /lib | |
parent | c5367aa3508b49ccb19ede20967ecfff8fe6e124 (diff) | |
parent | 196dea8289d126aaf9a011a15b348fde0d5159d5 (diff) | |
download | puppet-cron_core-575c45082d48624ab8ed952b01c17302c0e4e1ef.tar.gz puppet-cron_core-575c45082d48624ab8ed952b01c17302c0e4e1ef.tar.bz2 |
Merge pull request #12 from ekohl/hidden-files
(MODULES-8603) Ignore .keep_* files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/cron/crontab.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/puppet/provider/cron/crontab.rb b/lib/puppet/provider/cron/crontab.rb index bfbdc30..9144725 100644 --- a/lib/puppet/provider/cron/crontab.rb +++ b/lib/puppet/provider/cron/crontab.rb @@ -273,17 +273,27 @@ Puppet::Type.type(:cron).provide(:crontab, parent: Puppet::Provider::ParsedFile, '/var/spool/cron' end + # Return the directory holding crontab files stored on the local system. + # + # @api private + def self.crontab_dir + CRONTAB_DIR + end + # Yield the names of all crontab files stored on the local system. # - # @note Ignores files that are not writable for the puppet process. + # @note Ignores files that are not writable for the puppet process and hidden + # files that start with .keep # # @api private def self.enumerate_crontabs Puppet.debug "looking for crontabs in #{CRONTAB_DIR}" return unless File.readable?(CRONTAB_DIR) Dir.foreach(CRONTAB_DIR) do |file| - path = "#{CRONTAB_DIR}/#{file}" - yield(file) if File.file?(path) && File.writable?(path) + path = File.join(CRONTAB_DIR, file) + # Gentoo creates .keep_PACKAGE-SLOT files to make sure the directory is not + # removed + yield(file) if File.file?(path) && File.writable?(path) && !file.start_with?('.keep_') end end |