文件操作 - catalog_collector.rb
返回文件管理
返回主菜单
删除本文件
文件: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/collectors/catalog_collector.rb
编辑文件内容
# frozen_string_literal: true class Puppet::Pops::Evaluator::Collectors::CatalogCollector < Puppet::Pops::Evaluator::Collectors::AbstractCollector # Creates a CatalogCollector using the AbstractCollector's # constructor to set the scope and overrides # # param [Puppet::CompilableResourceType] type the resource type to be collected # param [Proc] query the query which defines which resources to match def initialize(scope, type, query, overrides = nil) super(scope, overrides) @query = query @type = Puppet::Resource.new(type, 'whatever').type end # Collects virtual resources based off a collection in a manifest def collect t = @type q = @query scope.compiler.resources.find_all do |resource| resource.type == t && (q ? q.call(resource) : true) end end def to_s "Catalog-Collector[#{@type}]" end end
修改文件时间
将文件时间修改为当前时间的前一年
删除文件