Class: Admiral::Layers::AdmiralTestServerspecInstall

Inherits:
Admiral::LayerBase show all
Defined in:
lib/admiral/layers/admiral.test.serverspec.install.rb

Instance Method Summary collapse

Methods inherited from Admiral::LayerBase

#add_parameter, inherited, #run, #run_ssh_command, #show_information, #upload, #verify

Constructor Details

#initialize(config, ipaddress) ⇒ AdmiralTestServerspecInstall

Returns a new instance of AdmiralTestServerspecInstall.



10
11
12
13
14
# File 'lib/admiral/layers/admiral.test.serverspec.install.rb', line 10

def initialize(config, ipaddress)
  description = "Install serverspec and infraspec"

  super(description, config, ipaddress)
end

Instance Method Details

#do_actionObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/admiral/layers/admiral.test.serverspec.install.rb', line 16

def do_action()
  username  = @config['username']

  gemsdir   = "/tmp/#{username}/gems"
  cachedir  = "#{gemsdir}/cache"

  env = {
    'username'  => username,
    'GEM_HOME'  => gemsdir,
    'GEM_PATH'  => gemsdir,
    'GEM_CACHE' => cachedir,
  }

  cmd = "/tmp/#{username}/#{$uid}.sh"

  rc = run_ssh_command(cmd, :allow_proxy => true, :env => env)
  return (rc == 0)
end