Class: CORL::Node::Vagrant
- Inherits:
-
Object
- Object
- CORL::Node::Vagrant
- Defined in:
- lib/CORL/node/vagrant.rb
Instance Method Summary collapse
- #bootstrap_script ⇒ Object
-
#bootstrap_script=(bootstrap) ⇒ Object
—.
-
#build(options = {}) ⇒ Object
—————————————————————————– Node operations.
- #build_time ⇒ Object
-
#build_time=(time) ⇒ Object
—.
-
#create(options = {}) ⇒ Object
—.
-
#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
—.
-
#image_id(image) ⇒ Object
—————————————————————————– Image utilities.
-
#image_search_text(image) ⇒ Object
—.
-
#init_shares ⇒ Object
—————————————————————————– Utilities.
-
#machine_config ⇒ Object
—————————————————————————– Settings groups.
-
#machine_type_id(machine_type) ⇒ Object
—————————————————————————– Machine type utilities.
-
#normalize(reload) ⇒ Object
—————————————————————————– Node plugin interface.
-
#reload(options = {}) ⇒ Object
—.
-
#render_image(image) ⇒ Object
—.
-
#render_machine_type(machine_type) ⇒ Object
—.
-
#save(options = {}) ⇒ Object
—.
- #shares ⇒ Object
-
#shares=(shares) ⇒ Object
—.
- #ssh ⇒ Object
-
#ssh=(ssh) ⇒ Object
—.
-
#start(options = {}) ⇒ Object
—.
-
#state(reset = false) ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#stop(options = {}) ⇒ Object
—.
-
#upload(local_path, remote_path, options = {}) ⇒ Object
—.
- #vm ⇒ Object
-
#vm=(vm) ⇒ Object
—.
Instance Method Details
#bootstrap_script ⇒ Object
80 81 82 |
# File 'lib/CORL/node/vagrant.rb', line 80 def bootstrap_script cache_setting(:bootstrap, nil) end |
#bootstrap_script=(bootstrap) ⇒ Object
76 77 78 |
# File 'lib/CORL/node/vagrant.rb', line 76 def bootstrap_script=bootstrap set_cache_setting(:bootstrap, bootstrap) end |
#build(options = {}) ⇒ Object
Node operations
105 106 107 |
# File 'lib/CORL/node/vagrant.rb', line 105 def build( = {}) super(Config.ensure().import({ :save => false })) end |
#build_time ⇒ Object
70 71 72 |
# File 'lib/CORL/node/vagrant.rb', line 70 def build_time cache_setting(:build, nil) end |
#build_time=(time) ⇒ Object
66 67 68 |
# File 'lib/CORL/node/vagrant.rb', line 66 def build_time=time set_cache_setting(:build, time) end |
#create(options = {}) ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/CORL/node/vagrant.rb', line 111 def create( = {}) super do |op, config| if op == :config config.import((:create)) config[:provision_enabled] = false end end end |
#create_image(options = {}) ⇒ Object
183 184 185 186 187 188 189 |
# File 'lib/CORL/node/vagrant.rb', line 183 def create_image( = {}) super do |op, config| if op == :config config.import((:image)) end end end |
#destroy(options = {}) ⇒ Object
205 206 207 208 209 210 211 |
# File 'lib/CORL/node/vagrant.rb', line 205 def destroy( = {}) super do |op, config| if op == :config config.import((:destroy)) end end end |
#download(remote_path, local_path, options = {}) ⇒ Object
122 123 124 125 126 127 128 |
# File 'lib/CORL/node/vagrant.rb', line 122 def download(remote_path, local_path, = {}) super do |op, config| if op == :config config.import((:download)) end end end |
#exec(options = {}) ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/CORL/node/vagrant.rb', line 142 def exec( = {}) super do |op, config| if op == :config config.import((:exec)) end end end |
#exec_options(name, options = {}) ⇒ Object
98 99 100 |
# File 'lib/CORL/node/vagrant.rb', line 98 def (name, = {}) extended_config(name, ).export end |
#filter_output(type, data) ⇒ Object
225 226 227 228 229 230 231 232 233 234 |
# File 'lib/CORL/node/vagrant.rb', line 225 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 |
#image_id(image) ⇒ Object
Image utilities
252 253 254 |
# File 'lib/CORL/node/vagrant.rb', line 252 def image_id(image) image.id end |
#image_search_text(image) ⇒ Object
264 265 266 |
# File 'lib/CORL/node/vagrant.rb', line 264 def image_search_text(image) image.to_s end |
#init_shares ⇒ Object
Utilities
216 217 218 219 220 221 |
# File 'lib/CORL/node/vagrant.rb', line 216 def init_shares shares.each do |name, info| local_dir = info[:local] network.ignore(local_dir) end end |
#machine_config ⇒ Object
Settings groups
87 88 89 90 91 92 93 94 |
# File 'lib/CORL/node/vagrant.rb', line 87 def machine_config super do |config| config[:vm] = vm config[:shares] = shares yield(config) if block_given? end end |
#machine_type_id(machine_type) ⇒ Object
Machine type utilities
239 240 241 |
# File 'lib/CORL/node/vagrant.rb', line 239 def machine_type_id(machine_type) machine_type end |
#normalize(reload) ⇒ Object
Node plugin interface
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/CORL/node/vagrant.rb', line 9 def normalize(reload) super unless reload machine_provider = :vagrant machine_provider = yield if block_given? myself.machine = create_machine(:machine, machine_provider, machine_config) end network.ignore([ '.vagrant', 'boxes' ]) init_shares end |
#reload(options = {}) ⇒ Object
172 173 174 175 176 177 178 179 |
# File 'lib/CORL/node/vagrant.rb', line 172 def reload( = {}) super do |op, config| if op == :config config.import((:reload)) config[:provision_enabled] = false end end end |
#render_image(image) ⇒ Object
258 259 260 |
# File 'lib/CORL/node/vagrant.rb', line 258 def render_image(image) '' end |
#render_machine_type(machine_type) ⇒ Object
245 246 247 |
# File 'lib/CORL/node/vagrant.rb', line 245 def render_machine_type(machine_type) machine_type.to_s end |
#save(options = {}) ⇒ Object
152 153 154 155 156 157 |
# File 'lib/CORL/node/vagrant.rb', line 152 def save( = {}) super do id(true) delete_setting(:machine_type) end end |
#shares ⇒ Object
60 61 62 |
# File 'lib/CORL/node/vagrant.rb', line 60 def shares hash(myself[:shares]) end |
#shares=(shares) ⇒ Object
55 56 57 58 |
# File 'lib/CORL/node/vagrant.rb', line 55 def shares=shares myself[:shares] = shares init_shares end |
#ssh ⇒ Object
49 50 51 |
# File 'lib/CORL/node/vagrant.rb', line 49 def ssh hash(myself[:ssh]) end |
#ssh=(ssh) ⇒ Object
45 46 47 |
# File 'lib/CORL/node/vagrant.rb', line 45 def ssh=ssh myself[:ssh] = ssh end |
#start(options = {}) ⇒ Object
161 162 163 164 165 166 167 168 |
# File 'lib/CORL/node/vagrant.rb', line 161 def start( = {}) super do |op, config| if op == :config config.import((:start)) config[:provision_enabled] = false end end end |
#state(reset = false) ⇒ Object
Property accessors / modifiers
29 30 31 |
# File 'lib/CORL/node/vagrant.rb', line 29 def state(reset = false) machine.state end |
#stop(options = {}) ⇒ Object
193 194 195 196 197 198 199 200 201 |
# File 'lib/CORL/node/vagrant.rb', line 193 def stop( = {}) super do |op, config| if op == :config config.import((:stop)) elsif op == :finalize true end end end |
#upload(local_path, remote_path, options = {}) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/CORL/node/vagrant.rb', line 132 def upload(local_path, remote_path, = {}) super do |op, config| if op == :config config.import((:upload)) end end end |
#vm ⇒ Object
39 40 41 |
# File 'lib/CORL/node/vagrant.rb', line 39 def vm hash(myself[:vm]) end |
#vm=(vm) ⇒ Object
35 36 37 |
# File 'lib/CORL/node/vagrant.rb', line 35 def vm=vm myself[:vm] = vm end |