文件操作 - exec.rb
返回文件管理
返回主菜单
删除本文件
文件: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/exec.rb
编辑文件内容
# frozen_string_literal: true require_relative '../../puppet/indirector/terminus' require_relative '../../puppet/util' class Puppet::Indirector::Exec < Puppet::Indirector::Terminus # Look for external node definitions. def find(request) name = request.key external_command = command # Make sure it's an array raise Puppet::DevError, _("Exec commands must be an array") unless external_command.is_a?(Array) # Make sure it's fully qualified. raise ArgumentError, _("You must set the exec parameter to a fully qualified command") unless Puppet::Util.absolute_path?(external_command[0]) # Add our name to it. external_command << name begin output = execute(external_command, :failonfail => true, :combine => false) rescue Puppet::ExecutionFailure => detail raise Puppet::Error, _("Failed to find %{name} via exec: %{detail}") % { name: name, detail: detail }, detail.backtrace end if output =~ /\A\s*\Z/ # all whitespace Puppet.debug { "Empty response for #{name} from #{self.name} terminus" } nil else output end end private # Proxy the execution, so it's easier to test. def execute(command, arguments) Puppet::Util::Execution.execute(command, arguments) end end
修改文件时间
将文件时间修改为当前时间的前一年
删除文件