diff --git a/lib/beaker-rspec/helpers/serverspec.rb b/lib/beaker-rspec/helpers/serverspec.rb index 56e9034..f89a66a 100644 --- a/lib/beaker-rspec/helpers/serverspec.rb +++ b/lib/beaker-rspec/helpers/serverspec.rb @@ -61,6 +61,17 @@ class << self end module Specinfra::Helper::Os + + @@known_nodes = {} + + def os + working_node_name = get_working_node.to_s + if !@@known_nodes[working_node_name] # haven't seen this yet, better detect the os + @@known_nodes[working_node_name] = property[:os] = detect_os + end + @@known_nodes[working_node_name] + end + private # Override detect_os to look at the node platform, short circuit discoverability @@ -265,7 +276,7 @@ def run_command(cmd, opt = {}) def build_command(cmd) useshell = '/bin/sh' cmd = cmd.shelljoin if cmd.is_a?(Array) - cmd = "#{useshell.shellescape} -c #{cmd.shellescape}" + cmd = "#{String(useshell).shellescape} -c \"#{String(cmd)}\"" path = Specinfra.configuration.path if path diff --git a/spec/acceptance/example_spec.rb b/spec/acceptance/example_spec.rb index ea839b1..e64de4f 100644 --- a/spec/acceptance/example_spec.rb +++ b/spec/acceptance/example_spec.rb @@ -32,7 +32,7 @@ context "has serverspec support" do hosts.each do |node| sshd = case node['platform'] - when /windows|el-|redhat|centos|debian/ + when /windows|el-|redhat|centos/ 'sshd' else 'ssh'