Sha256: 612bfe09fb65c648e8b63f4bc50aa14d8e8087e41f0bcb02c42c96a27ebb2ff4

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

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

set :backend, :ssh

 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

options = Net::SSH::Config.for(host)
options[:user] ||= Etc.getlogin
options[:password] = ENV['SSH_PASSWORD']
options[:keys] = ENV['SSH_KEY']

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itamae-mitsurin-0.3 lib/itamae/mitsurin/creators/templates/project/spec/spec_helper.rb
itamae-mitsurin-0.2 lib/itamae/mitsurin/creators/templates/project/spec/spec_helper.rb
itamae-mitsurin-0.1 lib/itamae/mitsurin/creators/templates/project/spec/spec_helper.rb