文件操作 - win_os_description.rb
返回文件管理
返回主菜单
删除本文件
文件: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/windows/win_os_description.rb
编辑文件内容
# frozen_string_literal: true module Facter module Resolvers class WinOsDescription < BaseResolver init_resolver class << self private def post_resolve(fact_name, _options) @fact_list.fetch(fact_name) { read_from_ole(fact_name) } end def read_from_ole(fact_name) win = Facter::Util::Windows::Win32Ole.new op_sys = win.return_first('SELECT ProductType,OtherTypeDescription FROM Win32_OperatingSystem') unless op_sys @log.debug 'WMI query returned no results for Win32_OperatingSystem'\ 'with values ProductType and OtherTypeDescription.' return end @fact_list[:consumerrel] = (op_sys.ProductType == 1) @fact_list[:description] = op_sys.OtherTypeDescription @fact_list[fact_name] end end end end end
修改文件时间
将文件时间修改为当前时间的前一年
删除文件