文件操作 - yaml.rb
返回文件管理
返回主菜单
删除本文件
文件: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/facts/yaml.rb
编辑文件内容
# frozen_string_literal: true require_relative '../../../puppet/node/facts' require_relative '../../../puppet/indirector/yaml' require_relative '../../../puppet/indirector/fact_search' class Puppet::Node::Facts::Yaml < Puppet::Indirector::Yaml desc "Store client facts as flat files, serialized using YAML, or return deserialized facts from disk." include Puppet::Indirector::FactSearch def search(request) node_names = [] Dir.glob(yaml_dir_path).each do |file| facts = load_file(file) if facts && node_matches?(facts, request.options) node_names << facts.name end end node_names end private # Return the path to a given node's file. def yaml_dir_path base = Puppet.run_mode.server? ? Puppet[:yamldir] : Puppet[:clientyamldir] File.join(base, 'facts', '*.yaml') end end
修改文件时间
将文件时间修改为当前时间的前一年
删除文件