Class: CORL::Machine::Physical
- Inherits:
-
Object
- Object
- CORL::Machine::Physical
- Defined in:
- lib/CORL/machine/physical.rb
Instance Method Summary collapse
-
#create(options = {}) ⇒ Object
—.
-
#create_image(name, options = {}) ⇒ Object
—.
-
#created? ⇒ Boolean
—————————————————————————– Checks.
-
#destroy(options = {}) ⇒ Object
—.
-
#download(remote_path, local_path, options = {}) ⇒ Object
—.
-
#exec(commands, options = {}, &code) ⇒ Object
—.
-
#hostname ⇒ Object
—.
-
#image ⇒ Object
—.
-
#load ⇒ Object
—————————————————————————– Management.
-
#machine_type ⇒ Object
—.
-
#normalize(reload) ⇒ Object
—————————————————————————– Machine plugin interface.
-
#private_ip ⇒ Object
—.
-
#public_ip ⇒ Object
—.
-
#reload(options = {}) ⇒ Object
—.
-
#running? ⇒ Boolean
—.
-
#start(options = {}) ⇒ Object
—.
-
#state ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#stop(options = {}) ⇒ Object
—.
-
#terminal(user, options = {}) ⇒ Object
—.
-
#upload(local_path, remote_path, options = {}) ⇒ Object
—.
Instance Method Details
#create(options = {}) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/CORL/machine/physical.rb', line 75 def create( = {}) 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, = {}) super do logger.warn("Creating images of local machines not supported yet") true end end |
#created? ⇒ Boolean
Checks
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( = {}) 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, = {}) 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, = {}, &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 |
#hostname ⇒ Object
36 37 38 |
# File 'lib/CORL/machine/physical.rb', line 36 def hostname fact(:fqdn) end |
#image ⇒ Object
60 61 62 |
# File 'lib/CORL/machine/physical.rb', line 60 def image nil end |
#load ⇒ Object
Management
67 68 69 70 71 |
# File 'lib/CORL/machine/physical.rb', line 67 def load super do true end end |
#machine_type ⇒ Object
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_ip ⇒ Object
48 49 50 |
# File 'lib/CORL/machine/physical.rb', line 48 def private_ip nil end |
#public_ip ⇒ Object
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( = {}) return super do logger.warn("Reloading not currently supported on physical machines") true end end |
#running? ⇒ 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( = {}) super do logger.warn("This machine is already running so can not be started") true end end |
#state ⇒ Object
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( = {}) 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, = {}) 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, = {}) super do |config, success| logger.debug("Executing SCP uploads not yet supported on physical machines") true end end |