Class: CORL::Machine::Physical

Inherits:
Object
  • Object
show all
Defined in:
lib/CORL/machine/physical.rb

Instance Method Summary collapse

Instance Method Details

#create(options = {}) ⇒ Object




75
76
77
78
79
80
# File 'lib/CORL/machine/physical.rb', line 75

def create(options = {})
  super do
    logger.warn("Damn!  We can't create new instances of physical machines")
    true
  end
end

#create_image(name, options = {}) ⇒ Object




145
146
147
148
149
150
# File 'lib/CORL/machine/physical.rb', line 145

def create_image(name, options = {})
  super do
    logger.warn("Creating images of local machines not supported yet")
    true
  end
end

#created?Boolean


Checks

Returns:

  • (Boolean)


17
18
19
# File 'lib/CORL/machine/physical.rb', line 17

def created?
  true
end

#destroy(options = {}) ⇒ Object




162
163
164
165
166
167
# File 'lib/CORL/machine/physical.rb', line 162

def destroy(options = {})
  super do
    logger.warn("If you want to destroy your physical machine, grab a hammer")
    true  
  end
end

#download(remote_path, local_path, options = {}) ⇒ Object




84
85
86
87
88
89
# File 'lib/CORL/machine/physical.rb', line 84

def download(remote_path, local_path, options = {})
  super do |config, success|
    logger.debug("Executing SCP downloads not yet supported on physical machines")
    true
  end
end

#exec(commands, options = {}, &code) ⇒ Object




102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/CORL/machine/physical.rb', line 102

def exec(commands, options = {}, &code)
  super do |config, results|
    logger.debug("Executing shell commands ( #{commands.inspect} ) on machine #{plugin_name}")
    
    commands.each do |command|
      result = CORL.cli_run(command, config) do |op, command_str, data|
        code ? code.call(op, command_str, data) : true
      end        
      results << result
    end
    results
  end
end

#hostnameObject




36
37
38
# File 'lib/CORL/machine/physical.rb', line 36

def hostname
  fact(:fqdn)
end

#imageObject




60
61
62
# File 'lib/CORL/machine/physical.rb', line 60

def image
  nil
end

#loadObject


Management



67
68
69
70
71
# File 'lib/CORL/machine/physical.rb', line 67

def load
  super do
    true
  end    
end

#machine_typeObject




54
55
56
# File 'lib/CORL/machine/physical.rb', line 54

def machine_type
  'physical'
end

#normalize(reload) ⇒ Object


Machine plugin interface



9
10
11
12
# File 'lib/CORL/machine/physical.rb', line 9

def normalize(reload)
  super
  myself.plugin_name = hostname
end

#private_ipObject




48
49
50
# File 'lib/CORL/machine/physical.rb', line 48

def private_ip
  nil
end

#public_ipObject




42
43
44
# File 'lib/CORL/machine/physical.rb', line 42

def public_ip
  CORL.public_ip   
end

#reload(options = {}) ⇒ Object




136
137
138
139
140
141
# File 'lib/CORL/machine/physical.rb', line 136

def reload(options = {})
  return super do
    logger.warn("Reloading not currently supported on physical machines")
    true
  end
end

#running?Boolean


Returns:

  • (Boolean)


23
24
25
# File 'lib/CORL/machine/physical.rb', line 23

def running?
  true
end

#start(options = {}) ⇒ Object




127
128
129
130
131
132
# File 'lib/CORL/machine/physical.rb', line 127

def start(options = {})
  super do
    logger.warn("This machine is already running so can not be started")
    true
  end
end

#stateObject


Property accessors / modifiers



30
31
32
# File 'lib/CORL/machine/physical.rb', line 30

def state
  translate_state('RUNNING')
end

#stop(options = {}) ⇒ Object




153
154
155
156
157
158
# File 'lib/CORL/machine/physical.rb', line 153

def stop(options = {})
  super do
    logger.warn("Stopping the machine we are operating is not supported right now")
    true
  end
end

#terminal(user, options = {}) ⇒ Object




118
119
120
121
122
123
# File 'lib/CORL/machine/physical.rb', line 118

def terminal(user, options = {})
  super do |config|
    logger.debug("Launching terminals on the local machine is not currently supported")
    1
  end
end

#upload(local_path, remote_path, options = {}) ⇒ Object




93
94
95
96
97
98
# File 'lib/CORL/machine/physical.rb', line 93

def upload(local_path, remote_path, options = {})
  super do |config, success|
    logger.debug("Executing SCP uploads not yet supported on physical machines")
    true
  end
end