Class: CORL::Node::FogBase
- Inherits:
-
Object
- Object
- CORL::Node::FogBase
- Defined in:
- lib/core/plugin/fog_node.rb
Instance Method Summary collapse
- #api_key ⇒ Object
-
#api_key=(api_key) ⇒ Object
—.
- #api_user ⇒ Object
-
#api_user=(api_user) ⇒ Object
—————————————————————————– Property accessors / modifiers.
- #auth_url ⇒ Object
-
#auth_url=(auth_url) ⇒ Object
—.
- #connection_options ⇒ Object
-
#connection_options=(options) ⇒ Object
—.
-
#create(options = {}) ⇒ Object
—————————————————————————– Node operations.
-
#create_image(options = {}) ⇒ Object
—.
-
#destroy(options = {}) ⇒ Object
—.
-
#download(remote_path, local_path, options = {}) ⇒ Object
—.
-
#exec(options = {}) ⇒ Object
—.
-
#exec_options(name, options = {}) ⇒ Object
—.
-
#filter_output(type, data) ⇒ Object
—————————————————————————– Utilities.
-
#key_config ⇒ Object
—.
-
#machine_config ⇒ Object
—————————————————————————– Settings groups.
-
#normalize(reload) ⇒ Object
—————————————————————————– Node plugin interface.
- #region ⇒ Object
- #region=(region) ⇒ Object
-
#region_info ⇒ Object
—.
- #regions ⇒ Object
-
#reload(options = {}) ⇒ Object
—.
-
#start(options = {}) ⇒ Object
—.
-
#stop(options = {}) ⇒ Object
—.
-
#upload(local_path, remote_path, options = {}) ⇒ Object
—.
Instance Method Details
#api_key ⇒ Object
48 49 50 |
# File 'lib/core/plugin/fog_node.rb', line 48 def api_key myself[:api_key] end |
#api_key=(api_key) ⇒ Object
44 45 46 |
# File 'lib/core/plugin/fog_node.rb', line 44 def api_key=api_key myself[:api_key] = api_key end |
#api_user ⇒ Object
38 39 40 |
# File 'lib/core/plugin/fog_node.rb', line 38 def api_user myself[:api_user] end |
#api_user=(api_user) ⇒ Object
Property accessors / modifiers
34 35 36 |
# File 'lib/core/plugin/fog_node.rb', line 34 def api_user=api_user myself[:api_user] = api_user end |
#auth_url ⇒ Object
58 59 60 |
# File 'lib/core/plugin/fog_node.rb', line 58 def auth_url myself[:auth_url] end |
#auth_url=(auth_url) ⇒ Object
54 55 56 |
# File 'lib/core/plugin/fog_node.rb', line 54 def auth_url=auth_url myself[:auth_url] = auth_url end |
#connection_options ⇒ Object
68 69 70 |
# File 'lib/core/plugin/fog_node.rb', line 68 def myself[:connection_options] end |
#connection_options=(options) ⇒ Object
64 65 66 |
# File 'lib/core/plugin/fog_node.rb', line 64 def myself[:connection_options] = end |
#create(options = {}) ⇒ Object
Node operations
121 122 123 124 125 126 127 128 129 |
# File 'lib/core/plugin/fog_node.rb', line 121 def create( = {}) super do |op, config| if op == :config config.import((:create)) config.defaults(key_config) end yield(op, config) if block_given? end end |
#create_image(options = {}) ⇒ Object
189 190 191 192 193 194 195 196 |
# File 'lib/core/plugin/fog_node.rb', line 189 def create_image( = {}) super do |op, config| if op == :config config.import((:image)) end yield(op, config) if block_given? end end |
#destroy(options = {}) ⇒ Object
211 212 213 214 215 216 217 218 |
# File 'lib/core/plugin/fog_node.rb', line 211 def destroy( = {}) super do |op, config| if op == :config config.import((:destroy)) end yield(op, config) if block_given? end end |
#download(remote_path, local_path, options = {}) ⇒ Object
133 134 135 136 137 138 139 140 |
# File 'lib/core/plugin/fog_node.rb', line 133 def download(remote_path, local_path, = {}) super do |op, config| if op == :config config.import((:download)) end yield(op, config) if block_given? end end |
#exec(options = {}) ⇒ Object
155 156 157 158 159 160 161 162 |
# File 'lib/core/plugin/fog_node.rb', line 155 def exec( = {}) super do |op, config| if op == :config config.import((:exec)) end yield(op, config) if block_given? end end |
#exec_options(name, options = {}) ⇒ Object
114 115 116 |
# File 'lib/core/plugin/fog_node.rb', line 114 def (name, = {}) extended_config(name, ).export end |
#filter_output(type, data) ⇒ Object
Utilities
223 224 225 226 227 228 229 230 231 232 |
# File 'lib/core/plugin/fog_node.rb', line 223 def filter_output(type, data) data = super if type == :error if data.include?('stdin: is not a tty') || data.include?('unable to re-open stdin') data = '' end end data end |
#key_config ⇒ Object
108 109 110 |
# File 'lib/core/plugin/fog_node.rb', line 108 def key_config { :private_key_path => private_key, :public_key_path => public_key } end |
#machine_config ⇒ Object
Settings groups
99 100 101 102 103 104 |
# File 'lib/core/plugin/fog_node.rb', line 99 def machine_config super do |config| config[:connection_options] = if yield(config) if block_given? end end |
#normalize(reload) ⇒ Object
Node plugin interface
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/core/plugin/fog_node.rb', line 13 def normalize(reload) super @region_info = Config.new({}, {}, true, false) unless reload myself.region = region unless reload machine_provider = :fog machine_provider = yield if block_given? myself.machine = create_machine(:machine, machine_provider, machine_config) end end |
#region ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/core/plugin/fog_node.rb', line 86 def region if region = myself[:region] region else first_region = regions.first myself.region = first_region first_region end end |
#region=(region) ⇒ Object
82 83 84 |
# File 'lib/core/plugin/fog_node.rb', line 82 def region=region myself[:region] = region end |
#region_info ⇒ Object
74 75 76 |
# File 'lib/core/plugin/fog_node.rb', line 74 def region_info @region_info end |
#regions ⇒ Object
78 79 80 |
# File 'lib/core/plugin/fog_node.rb', line 78 def regions @region_info.keys end |
#reload(options = {}) ⇒ Object
178 179 180 181 182 183 184 185 |
# File 'lib/core/plugin/fog_node.rb', line 178 def reload( = {}) super do |op, config| if op == :config config.import((:reload)) end yield(op, config) if block_given? end end |
#start(options = {}) ⇒ Object
166 167 168 169 170 171 172 173 174 |
# File 'lib/core/plugin/fog_node.rb', line 166 def start( = {}) super do |op, config| if op == :config config.import((:start)) config.defaults(key_config) end yield(op, config) if block_given? end end |
#stop(options = {}) ⇒ Object
200 201 202 203 204 205 206 207 |
# File 'lib/core/plugin/fog_node.rb', line 200 def stop( = {}) super do |op, config| if op == :config config.import((:stop)) end yield(op, config) if block_given? end end |
#upload(local_path, remote_path, options = {}) ⇒ Object
144 145 146 147 148 149 150 151 |
# File 'lib/core/plugin/fog_node.rb', line 144 def upload(local_path, remote_path, = {}) super do |op, config| if op == :config config.import((:upload)) end yield(op, config) if block_given? end end |