Sha256: 5f101f5753ad72d694d640934c1f1739b67238b76246c4510360c0dc5359bcde

Contents?: true

Size: 960 Bytes

Versions: 5

Compression:

Stored size: 960 Bytes

Contents

require 'serverspec'
require 'net/ssh'
require 'specinfra/helper/set'
require 'json'
include Specinfra::Helper::Set

if ENV['LOCAL_MODE']
  set :backend, :exec
else
  set :backend, :ssh
end

 if ENV['ASK_SUDO_PASSWORD']
   begin
     require 'highline/import'
   rescue LoadError
     fail "highline is not available. Try installing it."
   end
   set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
 else
   set :sudo_password, ENV['SUDO_PASSWORD']
 end

host = ENV['TARGET_HOST']
node_file = ENV['NODE_FILE']
attributes = JSON.parse(File.read(node_file), symbolize_names: true)
set_property attributes

unless ENV['LOCAL_MODE']
  options = Net::SSH::Config.for(host)
  options[:user] = ENV['SSH_USER']
  options[:password] = ENV['SSH_PASSWORD']
  options[:keys] = ENV['SSH_KEY']
  options[:port] = ENV['SSH_PORT']

  set :host, options[:host_name] || host
  set :shell, '/bin/bash'
  set :ssh_options, options
end

set :request_pty, true

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
itamae-spec-0.0.6 lib/itamae-spec/generators/templates/project/spec/spec_helper.rb
itamae-spec-0.0.5 lib/itamae-spec/generators/templates/project/spec/spec_helper.rb
itamae-spec-0.0.4 lib/itamae-spec/generators/templates/project/spec/spec_helper.rb
itamae-spec-0.0.3 lib/itamae-spec/generators/templates/project/spec/spec_helper.rb
itamae-spec-0.0.2 lib/itamae-spec/generators/templates/project/spec/spec_helper.rb