Sha256: 840d7c02a6ddf790763180218de0ae0ef6b142b45ca40c5f5720f1e31ebbf461

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

class Puppet::Type
    # Look up the schedule and set it appropriately.  This is done after
    # the instantiation phase, so that the schedule can be anywhere in the
    # file.
    def schedule
        unless defined? @schedule
            if name = self[:schedule]
                if sched = Puppet.type(:schedule)[name]
                    @schedule = sched
                else
                    self.fail "Could not find schedule %s" % name
                end
            else
                @schedule = nil
            end
        end
        @schedule
    end

    # Check whether we are scheduled to run right now or not.
    def scheduled?
        return true if Puppet[:ignoreschedules]
        return true unless schedule = self.schedule

        # We use 'checked' here instead of 'synced' because otherwise we'll
        # end up checking most resources most times, because they will generally
        # have been synced a long time ago (e.g., a file only gets updated
        # once a month on the server and its schedule is daily; the last sync time
        # will have been a month ago, so we'd end up checking every run).
        return schedule.match?(self.cached(:checked).to_i)
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-0.24.0 lib/puppet/metatype/schedules.rb
puppet-0.24.3 lib/puppet/metatype/schedules.rb
puppet-0.24.4 lib/puppet/metatype/schedules.rb
puppet-0.24.2 lib/puppet/metatype/schedules.rb
puppet-0.24.1 lib/puppet/metatype/schedules.rb
puppet-0.24.5 lib/puppet/metatype/schedules.rb