Sha256: 72cebbf36504e64198cdb00f53ca72795669b7e1d1d0b0bbfe4a468e24ea124d

Contents?: true

Size: 1019 Bytes

Versions: 12

Compression:

Stored size: 1019 Bytes

Contents

require 'serverspec'
require 'net/ssh'
require 'tempfile'

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']
target = host.split('_')[1]

`vagrant up #{host}`
system("bundle exec itamae ssh -h #{host} --vagrant '#{File.expand_path("../#{target}/role.rb", __FILE__)}' -j '#{File.expand_path("../#{target}/node.json", __FILE__)}'")

config = Tempfile.new('', Dir.tmpdir)
`vagrant ssh-config #{host} > #{config.path}`

options = Net::SSH::Config.for(host, [config.path])

options[:user] ||= Etc.getlogin

set :host,        options[:host_name] || host
set :ssh_options, options

# Disable sudo
# set :disable_sudo, true


# Set environment variables
# set :env, :LANG => 'C', :LC_MESSAGES => 'C' 

# Set PATH
# set :path, '/sbin:/usr/local/sbin:$PATH'

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
itamae-plugin-recipe-rtn_rbenv-0.1.5 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.1.4 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.1.3 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.1.2 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.1.1 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.1.0 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.0.6 spec/spec_helper.rb
itamae-plugin-recipe-rtn_php_nabe-0.0.1 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.0.5 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.0.4 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.0.3 spec/spec_helper.rb
itamae-plugin-recipe-rtn_rbenv-0.0.2 spec/spec_helper.rb