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(reset = false) ⇒ Object
-
#image=(image) ⇒ 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.
- #private_ip(reset = false) ⇒ Object
-
#public_ip(reset = false) ⇒ Object
—.
-
#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
103 104 105 |
# File 'lib/CORL/node/vagrant.rb', line 103 def bootstrap_script cache_setting(:bootstrap, nil) end |
#bootstrap_script=(bootstrap) ⇒ Object
99 100 101 |
# File 'lib/CORL/node/vagrant.rb', line 99 def bootstrap_script=bootstrap set_cache_setting(:bootstrap, bootstrap) end |
#build(options = {}) ⇒ Object
Node operations
128 129 130 |
# File 'lib/CORL/node/vagrant.rb', line 128 def build( = {}) super(Config.ensure().import({ :save => false })) end |
#build_time ⇒ Object
93 94 95 |
# File 'lib/CORL/node/vagrant.rb', line 93 def build_time cache_setting(:build, nil) end |
#build_time=(time) ⇒ Object
89 90 91 |
# File 'lib/CORL/node/vagrant.rb', line 89 def build_time=time set_cache_setting(:build, time) end |
#create(options = {}) ⇒ Object
134 135 136 137 138 139 140 141 |
# File 'lib/CORL/node/vagrant.rb', line 134 def create( = {}) super do |op, config| if op == :config config.import((:create)) config[:provision_enabled] = false end end end |
#create_image(options = {}) ⇒ Object
206 207 208 209 210 211 212 |
# File 'lib/CORL/node/vagrant.rb', line 206 def create_image( = {}) super do |op, config| if op == :config config.import((:image)) end end end |
#destroy(options = {}) ⇒ Object
228 229 230 231 232 233 234 |
# File 'lib/CORL/node/vagrant.rb', line 228 def destroy( = {}) super do |op, config| if op == :config config.import((:destroy)) end end end |
#download(remote_path, local_path, options = {}) ⇒ Object
145 146 147 148 149 150 151 |
# File 'lib/CORL/node/vagrant.rb', line 145 def download(remote_path, local_path, = {}) super do |op, config| if op == :config config.import((:download)) end end end |
#exec(options = {}) ⇒ Object
165 166 167 168 169 170 171 |
# File 'lib/CORL/node/vagrant.rb', line 165 def exec( = {}) super do |op, config| if op == :config config.import((:exec)) end end end |
#exec_options(name, options = {}) ⇒ Object
121 122 123 |
# File 'lib/CORL/node/vagrant.rb', line 121 def (name, = {}) extended_config(name, ).export end |
#filter_output(type, data) ⇒ Object
248 249 250 251 252 253 254 255 256 257 |
# File 'lib/CORL/node/vagrant.rb', line 248 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(reset = false) ⇒ Object
71 72 73 74 |
# File 'lib/CORL/node/vagrant.rb', line 71 def image(reset = false) return machine.image if machine nil end |
#image=(image) ⇒ Object
67 68 69 |
# File 'lib/CORL/node/vagrant.rb', line 67 def image=image # Images can not be set end |
#image_id(image) ⇒ Object
Image utilities
275 276 277 |
# File 'lib/CORL/node/vagrant.rb', line 275 def image_id(image) image.id end |
#image_search_text(image) ⇒ Object
287 288 289 |
# File 'lib/CORL/node/vagrant.rb', line 287 def image_search_text(image) image.to_s end |
#init_shares ⇒ Object
Utilities
239 240 241 242 243 244 |
# File 'lib/CORL/node/vagrant.rb', line 239 def init_shares shares.each do |name, info| local_dir = info[:local] network.ignore(local_dir) unless info[:type].to_s =~ /^rsync-?.*/ end end |
#machine_config ⇒ Object
Settings groups
110 111 112 113 114 115 116 117 |
# File 'lib/CORL/node/vagrant.rb', line 110 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
262 263 264 |
# File 'lib/CORL/node/vagrant.rb', line 262 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 |
#private_ip(reset = false) ⇒ Object
40 41 42 43 |
# File 'lib/CORL/node/vagrant.rb', line 40 def private_ip(reset = false) return machine.private_ip if machine nil end |
#public_ip(reset = false) ⇒ Object
35 36 37 38 |
# File 'lib/CORL/node/vagrant.rb', line 35 def public_ip(reset = false) return machine.public_ip if machine nil end |
#reload(options = {}) ⇒ Object
195 196 197 198 199 200 201 202 |
# File 'lib/CORL/node/vagrant.rb', line 195 def reload( = {}) super do |op, config| if op == :config config.import((:reload)) config[:provision_enabled] = false end end end |
#render_image(image) ⇒ Object
281 282 283 |
# File 'lib/CORL/node/vagrant.rb', line 281 def render_image(image) '' end |
#render_machine_type(machine_type) ⇒ Object
268 269 270 |
# File 'lib/CORL/node/vagrant.rb', line 268 def render_machine_type(machine_type) machine_type.to_s end |
#save(options = {}) ⇒ Object
175 176 177 178 179 180 |
# File 'lib/CORL/node/vagrant.rb', line 175 def save( = {}) super do id(true) delete_setting(:machine_type) end end |
#shares ⇒ Object
83 84 85 |
# File 'lib/CORL/node/vagrant.rb', line 83 def shares hash(myself[:shares]) end |
#shares=(shares) ⇒ Object
78 79 80 81 |
# File 'lib/CORL/node/vagrant.rb', line 78 def shares=shares myself[:shares] = shares init_shares end |
#ssh ⇒ Object
61 62 63 |
# File 'lib/CORL/node/vagrant.rb', line 61 def ssh hash(myself[:ssh]) end |
#ssh=(ssh) ⇒ Object
57 58 59 |
# File 'lib/CORL/node/vagrant.rb', line 57 def ssh=ssh myself[:ssh] = ssh end |
#start(options = {}) ⇒ Object
184 185 186 187 188 189 190 191 |
# File 'lib/CORL/node/vagrant.rb', line 184 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
216 217 218 219 220 221 222 223 224 |
# File 'lib/CORL/node/vagrant.rb', line 216 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
155 156 157 158 159 160 161 |
# File 'lib/CORL/node/vagrant.rb', line 155 def upload(local_path, remote_path, = {}) super do |op, config| if op == :config config.import((:upload)) end end end |
#vm ⇒ Object
51 52 53 |
# File 'lib/CORL/node/vagrant.rb', line 51 def vm hash(myself[:vm]) end |
#vm=(vm) ⇒ Object
47 48 49 |
# File 'lib/CORL/node/vagrant.rb', line 47 def vm=vm myself[:vm] = vm end |