Sha256: 6a74394a2002fec9789653818cf38bc56544500e439375832220aee6a87b8819

Contents?: true

Size: 1.44 KB

Versions: 200

Compression:

Stored size: 1.44 KB

Contents

require 'specinfra'
require 'pp'

a = Specinfra::Backend::Exec.new

ssh_options = Net::SSH::Config.for(ENV['SSH_HOST'], [ENV['SSH_CONFIG']])
b = Specinfra::Backend::Ssh.new(
  :host => ssh_options[:host_name],
  :ssh_options => ssh_options,
)

threads = [a, b].map do |backend|
  Thread.start(backend) do |backend|
    result = []
    result << backend.run_command("uname -a")
    result << backend.command
    result << backend.command.get(:install_package, 'dstat')
    result
  end
end

threads.each(&:join)
threads.each do |t|
  pp t.value
end

# example:
# [#<Specinfra::CommandResult:0x007fb3b1352e30
#   @exit_signal=nil,
#   @exit_status=0,
#   @stderr="",
#   @stdout=
#    "Darwin p411 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64\n">,
#  #<Specinfra::CommandFactory:0x007fb3b1153508
#   @os_info={:family=>"darwin", :release=>nil, :arch=>"x86_64"}>,
#  "/usr/local/bin/brew install  'dstat'"]
# [#<Specinfra::CommandResult:0x007fb3b0b9c2e0
#   @exit_signal=nil,
#   @exit_status=0,
#   @stderr="",
#   @stdout=
#    "Linux itamae-trusty 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux\n">,
#  #<Specinfra::CommandFactory:0x007fb3b0d4d4b8
#   @os_info={:family=>"ubuntu", :release=>"14.04", :arch=>"x86_64"}>,
#  "DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold'  install dstat"]

Version data entries

200 entries across 200 versions & 3 rubygems

Version Path
specinfra-2.30.2 examples/multiple_backends.rb
specinfra-2.30.1 examples/multiple_backends.rb
specinfra-2.30.0 examples/multiple_backends.rb
specinfra-2.29.0 examples/multiple_backends.rb
specinfra-2.28.4 examples/multiple_backends.rb
specinfra-2.28.3 examples/multiple_backends.rb
specinfra-2.28.2 examples/multiple_backends.rb
specinfra-2.28.1 examples/multiple_backends.rb
specinfra-2.28.0 examples/multiple_backends.rb
specinfra-2.27.1 examples/multiple_backends.rb
specinfra-2.27.0 examples/multiple_backends.rb
specinfra-2.26.1 examples/multiple_backends.rb
specinfra-2.26.0 examples/multiple_backends.rb
specinfra-2.25.1 examples/multiple_backends.rb
specinfra-2.25.0 examples/multiple_backends.rb
specinfra-2.24.2 examples/multiple_backends.rb
specinfra-2.24.1 examples/multiple_backends.rb
specinfra-2.24.0 examples/multiple_backends.rb
specinfra-2.23.0 examples/multiple_backends.rb
specinfra-2.22.0 examples/multiple_backends.rb