class CORL::Plugin::Machine
Public Instance Methods
create(options = {}) { |config| ... }
click to toggle source
# File lib/core/plugin/machine.rb 93 def create(options = {}) 94 success = true 95 96 if created? 97 logger.debug("Machine #{plugin_name} already exists") 98 else 99 logger.debug("Creating #{plugin_provider} machine with: #{options.inspect}") 100 config = Config.ensure(options) 101 success = yield(config) if block_given? 102 end 103 104 logger.warn("There was an error creating the machine #{plugin_name}") unless success 105 success 106 end
create_image(options = {}) { |config| ... }
click to toggle source
# File lib/core/plugin/machine.rb 194 def create_image(options = {}) 195 success = true 196 197 if running? 198 logger.debug("Creating image of #{plugin_provider} machine with: #{options.inspect}") 199 config = Config.ensure(options) 200 success = yield(config) if block_given? 201 else 202 logger.debug("Machine #{plugin_name} is not running") 203 end 204 205 logger.warn("There was an error creating an image of the machine #{plugin_name}") unless success 206 success 207 end
created?()
click to toggle source
# File lib/core/plugin/machine.rb 9 def created? 10 false 11 end
destroy(options = {}) { |config| ... }
click to toggle source
# File lib/core/plugin/machine.rb 250 def destroy(options = {}) 251 success = true 252 253 if created? 254 logger.debug("Destroying #{plugin_provider} machine with: #{options.inspect}") 255 config = Config.ensure(options) 256 success = yield(config) if block_given? 257 else 258 logger.debug("Machine #{plugin_name} does not yet exist") 259 end 260 261 logger.warn("There was an error destroying the machine #{plugin_name}") unless success 262 success 263 end
download(remote_path, local_path, options = {}) { |config, success| ... }
click to toggle source
# File lib/core/plugin/machine.rb 110 def download(remote_path, local_path, options = {}) 111 success = true 112 113 if running? 114 logger.debug("Downloading #{local_path} from #{remote_path} on #{plugin_provider} machine with: #{options.inspect}") 115 config = Config.ensure(options) 116 success = yield(config, success) if block_given? 117 else 118 logger.debug("Machine #{plugin_name} is not running") 119 end 120 121 logger.warn("There was an error downloading from the machine #{plugin_name}") unless success 122 success 123 end
exec(commands, options = {}) { |config, results| ... }
click to toggle source
# File lib/core/plugin/machine.rb 144 def exec(commands, options = {}) 145 results = [] 146 147 if running? 148 logger.info("Executing commands ( #{commands.inspect} ) on machine #{plugin_name}") 149 config = Config.ensure(options) 150 results = yield(config, results) if block_given? 151 else 152 logger.debug("Machine #{plugin_name} is not running") 153 end 154 155 logger.warn("There was an error executing command on the machine #{plugin_name}") unless results 156 results 157 end
hostname()
click to toggle source
# File lib/core/plugin/machine.rb 38 def hostname 39 nil 40 end
image()
click to toggle source
# File lib/core/plugin/machine.rb 74 def image 75 nil 76 end
images()
click to toggle source
# File lib/core/plugin/machine.rb 68 def images 69 [] 70 end
load() { || ... }
click to toggle source
# File lib/core/plugin/machine.rb 81 def load 82 success = true 83 84 logger.debug("Loading #{plugin_provider} machine: #{plugin_name}") 85 success = yield if block_given? 86 87 logger.warn("There was an error loading the machine #{plugin_name}") unless success 88 success 89 end
machine_type()
click to toggle source
# File lib/core/plugin/machine.rb 62 def machine_type 63 nil 64 end
machine_types()
click to toggle source
# File lib/core/plugin/machine.rb 56 def machine_types 57 [] 58 end
node()
click to toggle source
# File lib/core/plugin/machine.rb 22 def node 23 plugin_parent 24 end
node=(node)
click to toggle source
# File lib/core/plugin/machine.rb 26 def node=node 27 myself.plugin_parent = node 28 end
private_ip()
click to toggle source
# File lib/core/plugin/machine.rb 50 def private_ip 51 nil 52 end
public_ip()
click to toggle source
# File lib/core/plugin/machine.rb 44 def public_ip 45 nil 46 end
reload(options = {}) { |config| ... }
click to toggle source
# File lib/core/plugin/machine.rb 177 def reload(options = {}) 178 success = true 179 180 if created? 181 logger.debug("Reloading #{plugin_provider} machine with: #{options.inspect}") 182 config = Config.ensure(options) 183 success = yield(config) if block_given? 184 else 185 logger.debug("Machine #{plugin_name} does not yet exist") 186 end 187 188 logger.warn("There was an error reloading the machine #{plugin_name}") unless success 189 success 190 end
running?()
click to toggle source
# File lib/core/plugin/machine.rb 15 def running? 16 ( created? && false ) 17 end
start(options = {}) { |config| ... }
click to toggle source
# File lib/core/plugin/machine.rb 228 def start(options = {}) 229 success = true 230 231 if running? 232 logger.debug("Machine #{plugin_name} is already running") 233 else 234 logger.debug("Starting #{plugin_provider} machine with: #{options.inspect}") 235 236 logger.debug("Machine #{plugin_name} is not running yet") 237 if block_given? 238 success = yield(config) 239 else 240 success = create(options) 241 end 242 end 243 244 logger.warn("There was an error starting the machine #{plugin_name}") unless success 245 success 246 end
state()
click to toggle source
# File lib/core/plugin/machine.rb 32 def state 33 nil 34 end
stop(options = {}) { |config| ... }
click to toggle source
# File lib/core/plugin/machine.rb 211 def stop(options = {}) 212 success = true 213 214 if running? 215 logger.debug("Stopping #{plugin_provider} machine with: #{options.inspect}") 216 config = Config.ensure(options) 217 success = yield(config) if block_given? 218 else 219 logger.debug("Machine #{plugin_name} is not running") 220 end 221 222 logger.warn("There was an error stopping the machine #{plugin_name}") unless success 223 success 224 end
terminal(user, options = {}) { |config| ... }
click to toggle source
# File lib/core/plugin/machine.rb 161 def terminal(user, options = {}) 162 status = code.unknown_status 163 164 if running? 165 logger.debug("Launching #{user} terminal on #{plugin_provider} machine with: #{options.inspect}") 166 config = Config.ensure(options) 167 status = yield(config) if block_given? 168 else 169 logger.debug("Machine #{plugin_name} is not running") 170 end 171 logger.warn("There was an error launching a #{user} terminal on the machine #{plugin_name}") unless status == code.success 172 status 173 end
translate_state(state)
click to toggle source
# File lib/core/plugin/machine.rb 268 def translate_state(state) 269 return string(state).downcase.to_sym if status 270 :unknown 271 end
upload(local_path, remote_path, options = {}) { |config, success| ... }
click to toggle source
# File lib/core/plugin/machine.rb 127 def upload(local_path, remote_path, options = {}) 128 success = true 129 130 if running? 131 logger.debug("Uploading #{local_path} to #{remote_path} on #{plugin_provider} machine with: #{options.inspect}") 132 config = Config.ensure(options) 133 success = yield(config, success) if block_given? 134 else 135 logger.debug("Machine #{plugin_name} is not running") 136 end 137 138 logger.warn("There was an error uploading to the machine #{plugin_name}") unless success 139 success 140 end