Class: CORL::Machine::Raspberrypi
- Inherits:
-
Object
- Object
- CORL::Machine::Raspberrypi
- Includes:
- CORL::Mixin::Machine::SSH
- Defined in:
- lib/CORL/machine/raspberrypi.rb
Instance Method Summary collapse
-
#create(options = {}) ⇒ Object
—.
-
#create_image(options = {}) ⇒ Object
—.
-
#created? ⇒ Boolean
—————————————————————————– Checks.
-
#destroy(options = {}) ⇒ Object
—.
-
#download(remote_path, local_path, options = {}, &code) ⇒ Object
—.
-
#exec(commands, options = {}, &code) ⇒ Object
—.
-
#image ⇒ Object
—.
-
#load ⇒ Object
—————————————————————————– Management.
-
#machine_type ⇒ Object
—.
-
#normalize(reload) ⇒ Object
—————————————————————————– Machine plugin interface.
-
#public_ip ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#reload(options = {}) ⇒ Object
—.
-
#running? ⇒ Boolean
—.
-
#start(options = {}) ⇒ Object
—.
-
#state ⇒ Object
—.
-
#stop(options = {}) ⇒ Object
—.
-
#terminal(user, options = {}) ⇒ Object
—.
-
#upload(local_path, remote_path, options = {}, &code) ⇒ Object
—.
Methods included from CORL::Mixin::Machine::SSH
#close_ssh_session, #init_ssh_session, #ssh_download, #ssh_exec, #ssh_terminal, #ssh_upload, #ssh_wait_for_ready
Instance Method Details
#create(options = {}) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/CORL/machine/raspberrypi.rb', line 67 def create( = {}) super do logger.warn("Damn! We can't create new instances of Raspberry Pi machines") true end end |
#create_image(options = {}) ⇒ Object
119 120 121 122 123 124 |
# File 'lib/CORL/machine/raspberrypi.rb', line 119 def create_image( = {}) super do logger.warn("Creating images of Raspberry Pi machines not supported yet") true end end |
#created? ⇒ Boolean
Checks
21 22 23 |
# File 'lib/CORL/machine/raspberrypi.rb', line 21 def created? true end |
#destroy(options = {}) ⇒ Object
146 147 148 149 150 151 |
# File 'lib/CORL/machine/raspberrypi.rb', line 146 def destroy( = {}) super do logger.warn("If you want to destroy your Raspberry Pi machine, grab a hammer") true end end |
#download(remote_path, local_path, options = {}, &code) ⇒ Object
76 77 78 79 80 |
# File 'lib/CORL/machine/raspberrypi.rb', line 76 def download(remote_path, local_path, = {}, &code) super do |config, success| ssh_download(remote_path, local_path, config, &code) end end |
#exec(commands, options = {}, &code) ⇒ Object
92 93 94 95 96 |
# File 'lib/CORL/machine/raspberrypi.rb', line 92 def exec(commands, = {}, &code) super do |config| ssh_exec(commands, config, &code) end end |
#image ⇒ Object
52 53 54 |
# File 'lib/CORL/machine/raspberrypi.rb', line 52 def image nil end |
#load ⇒ Object
Management
59 60 61 62 63 |
# File 'lib/CORL/machine/raspberrypi.rb', line 59 def load super do true end end |
#machine_type ⇒ Object
46 47 48 |
# File 'lib/CORL/machine/raspberrypi.rb', line 46 def machine_type 'raspberrypi' end |
#normalize(reload) ⇒ Object
Machine plugin interface
11 12 13 14 15 16 |
# File 'lib/CORL/machine/raspberrypi.rb', line 11 def normalize(reload) require 'net/ping' super myself.plugin_name = node.plugin_name if node end |
#public_ip ⇒ Object
Property accessors / modifiers
34 35 36 |
# File 'lib/CORL/machine/raspberrypi.rb', line 34 def public_ip node[:public_ip] end |
#reload(options = {}) ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'lib/CORL/machine/raspberrypi.rb', line 108 def reload( = {}) super do success = node.command('reboot', { :as_admin => true }) sleep 5 sleep 1 until running? success end end |
#running? ⇒ Boolean
27 28 29 |
# File 'lib/CORL/machine/raspberrypi.rb', line 27 def running? Net::Ping::TCP.new(public_ip, node.ssh_port).ping? end |
#start(options = {}) ⇒ Object
137 138 139 140 141 142 |
# File 'lib/CORL/machine/raspberrypi.rb', line 137 def start( = {}) super do logger.warn("Starting a Raspberry Pi machine is not supported right now") true end end |
#state ⇒ Object
40 41 42 |
# File 'lib/CORL/machine/raspberrypi.rb', line 40 def state running? ? :running : :not_running end |
#stop(options = {}) ⇒ Object
128 129 130 131 132 133 |
# File 'lib/CORL/machine/raspberrypi.rb', line 128 def stop( = {}) super do logger.warn("Stopping a Raspberry Pi machine is not supported right now") true end end |
#terminal(user, options = {}) ⇒ Object
100 101 102 103 104 |
# File 'lib/CORL/machine/raspberrypi.rb', line 100 def terminal(user, = {}) super do |config| ssh_terminal(user, config) end end |
#upload(local_path, remote_path, options = {}, &code) ⇒ Object
84 85 86 87 88 |
# File 'lib/CORL/machine/raspberrypi.rb', line 84 def upload(local_path, remote_path, = {}, &code) super do |config, success| ssh_upload(local_path, remote_path, config, &code) end end |