module Specinfra::Helper::Os

Public Instance Methods

os() click to toggle source
# File lib/beaker-rspec/helpers/serverspec.rb, line 61
def os
  working_node_name = get_working_node.to_s
  # haven't seen this yet, better detect the os
  @@known_nodes[working_node_name] = property[:os] = detect_os unless @@known_nodes[working_node_name]
  @@known_nodes[working_node_name]
end

Private Instance Methods

detect_os() click to toggle source

Override detect_os to look at the node platform, short circuit discoverability when we know that we have a windows node

# File lib/beaker-rspec/helpers/serverspec.rb, line 72
def detect_os
  return Specinfra.configuration.os if Specinfra.configuration.os

  backend = Specinfra.backend
  node = get_working_node
  return { family: 'windows' } if node['platform'].include?('windows')

  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
end