/usr/lib/ruby/vendor_ruby/specinfra/helper/os.rb is in ruby-specinfra 2.66.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | require 'specinfra/helper/detect_os'
module Specinfra
module Helper
module Os
def os
property[:os] = {} if ! property[:os]
if ! property[:os].include?(:family)
property[:os] = detect_os
end
property[:os]
end
private
def detect_os
return Specinfra.configuration.os if Specinfra.configuration.os
backend = Specinfra.configuration.backend
if backend == :cmd || backend == :winrm
return { :family => 'windows', :release => nil, :arch => nil }
end
Specinfra::Helper::DetectOs.subclasses.each do |c|
res = c.detect
if res
res[:arch] ||= Specinfra.backend.run_command('uname -m').stdout.strip
return res
end
end
raise NotImplementedError, "Specinfra failed os detection."
end
end
end
end
|