Skip to content

Commit

Permalink
Merge pull request #72 from anodelman/ruby2
Browse files Browse the repository at this point in the history
 (BKR-467) beaker-rspec does not correctly update os when cycling through hosts
  • Loading branch information
kevpl committed Aug 27, 2015
2 parents 261dacd + a6b3e50 commit 86157a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/beaker-rspec/helpers/serverspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 86157a9

Please sign in to comment.