Class: TestLab::Provider::BareMetal

Inherits:
Object
  • Object
show all
Defined in:
lib/testlab/providers/bare_metal.rb

Overview

BareMetal Provider Class

Author:

  • Zachary Patten <zachary AT jovelabs DOT com>

Instance Method Summary collapse

Constructor Details

#initialize(config = {}, ui = nil) ⇒ BareMetal

Returns a new instance of BareMetal.



13
14
15
16
17
18
19
# File 'lib/testlab/providers/bare_metal.rb', line 13

def initialize(config={}, ui=nil)
  @config = (config || Hash.new)
  @ui     = (ui     || TestLab.ui)

  # ensure our bare_metal key exists
  @config[:bare_metal] ||= Hash.new
end

Instance Method Details

#alive?Boolean

This is a NO-OP

Returns:

  • (Boolean)


60
61
62
# File 'lib/testlab/providers/bare_metal.rb', line 60

def alive?
  true
end

#createObject

This is a NO-OP



22
23
24
# File 'lib/testlab/providers/bare_metal.rb', line 22

def create
  true
end

#dead?Boolean

This is a NO-OP

Returns:

  • (Boolean)


65
66
67
# File 'lib/testlab/providers/bare_metal.rb', line 65

def dead?
  false
end

#destroyObject

This is a NO-OP



27
28
29
# File 'lib/testlab/providers/bare_metal.rb', line 27

def destroy
  true
end

#downObject

This is a NO-OP



37
38
39
# File 'lib/testlab/providers/bare_metal.rb', line 37

def down
  true
end

#exists?Boolean

This is a NO-OP

Returns:

  • (Boolean)


55
56
57
# File 'lib/testlab/providers/bare_metal.rb', line 55

def exists?
  true
end

#identityObject



77
78
79
# File 'lib/testlab/providers/bare_metal.rb', line 77

def identity
  (@config[:bare_metal][:identity] || File.join(ENV['HOME'], ".ssh", "id_rsa"))
end

#instance_idObject



69
70
71
# File 'lib/testlab/providers/bare_metal.rb', line 69

def instance_id
  TestLab.hostname
end

#ipObject



81
82
83
# File 'lib/testlab/providers/bare_metal.rb', line 81

def ip
  (@config[:bare_metal][:ip] || "127.0.0.1")
end

#portObject



85
86
87
# File 'lib/testlab/providers/bare_metal.rb', line 85

def port
  (@config[:bare_metal][:port] || 22)
end

#reloadObject

This is a NO-OP



42
43
44
45
46
47
# File 'lib/testlab/providers/bare_metal.rb', line 42

def reload
  self.down
  self.up

  true
end

#stateObject

This is a NO-OP



50
51
52
# File 'lib/testlab/providers/bare_metal.rb', line 50

def state
  :running
end

#upObject

This is a NO-OP



32
33
34
# File 'lib/testlab/providers/bare_metal.rb', line 32

def up
  true
end

#userObject



73
74
75
# File 'lib/testlab/providers/bare_metal.rb', line 73

def user
  (@config[:bare_metal][:user] || ENV['USER'])
end