vagrant-mos 0.8.39 → 0.8.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/vagrant-mos/version.rb +1 -1
- metadata +1 -5
- data/dummy.box +0 -0
- data/lib/vagrant-mos/action/elb_deregister_instance.rb +0 -24
- data/lib/vagrant-mos/action/elb_register_instance.rb +0 -24
- data/lib/vagrant-mos/util/elb.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67e38e4955ab94f5e0ecb0b51b44c2fbc3437487
|
4
|
+
data.tar.gz: 836c2b90ec9d3a107085a5a61bcafd8bc0631176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6b17d9d13e8f846458b8d1b40dbcca4284ab43842fe376fd1356ec092499915fe0b1084428c162d7b3a315d3a77e9c760f2b860a9285dd552e3cc074c0023b6
|
7
|
+
data.tar.gz: e0d15b5a1867d80830c95525b74947d65c6069bb6861664e8534622de47711a46f45231b1f92c05f239443bbc397b7ad350e0b6f63a7d6070e152558686e6db1
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ manually within a `config.vm.provider` block. So first, add the dummy
|
|
49
49
|
box using any name you want:
|
50
50
|
|
51
51
|
```
|
52
|
-
$ vagrant box add dummy https://github.com/mitchellh/vagrant-mos/raw/master/
|
52
|
+
$ vagrant box add dummy https://github.com/mitchellh/vagrant-mos/raw/master/mos_box.box
|
53
53
|
...
|
54
54
|
```
|
55
55
|
|
data/lib/vagrant-mos/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-mos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yangcs2009
|
@@ -107,15 +107,12 @@ files:
|
|
107
107
|
- README.md
|
108
108
|
- Rakefile
|
109
109
|
- Vagrantfile
|
110
|
-
- dummy.box
|
111
110
|
- example_box/README.md
|
112
111
|
- example_box/Vagrantfile
|
113
112
|
- example_box/metadata.json
|
114
113
|
- lib/vagrant-mos.rb
|
115
114
|
- lib/vagrant-mos/action.rb
|
116
115
|
- lib/vagrant-mos/action/connect_mos.rb
|
117
|
-
- lib/vagrant-mos/action/elb_deregister_instance.rb
|
118
|
-
- lib/vagrant-mos/action/elb_register_instance.rb
|
119
116
|
- lib/vagrant-mos/action/is_created.rb
|
120
117
|
- lib/vagrant-mos/action/is_stopped.rb
|
121
118
|
- lib/vagrant-mos/action/message_already_created.rb
|
@@ -135,7 +132,6 @@ files:
|
|
135
132
|
- lib/vagrant-mos/errors.rb
|
136
133
|
- lib/vagrant-mos/plugin.rb
|
137
134
|
- lib/vagrant-mos/provider.rb
|
138
|
-
- lib/vagrant-mos/util/elb.rb
|
139
135
|
- lib/vagrant-mos/util/timer.rb
|
140
136
|
- lib/vagrant-mos/version.rb
|
141
137
|
- locales/en.yml
|
data/dummy.box
DELETED
Binary file
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'vagrant-mos/util/elb'
|
2
|
-
|
3
|
-
module VagrantPlugins
|
4
|
-
module MOS
|
5
|
-
module Action
|
6
|
-
# This registers instance in ELB
|
7
|
-
class ElbDeregisterInstance
|
8
|
-
include ElasticLoadBalancer
|
9
|
-
|
10
|
-
def initialize(app, env)
|
11
|
-
@app = app
|
12
|
-
@logger = Log4r::Logger.new("vagrant_mos::action::elb_deregister_instance")
|
13
|
-
end
|
14
|
-
|
15
|
-
def call(env)
|
16
|
-
if elb_name = env[:machine].provider_config.elb
|
17
|
-
deregister_instance env, elb_name, env[:machine].id
|
18
|
-
end
|
19
|
-
@app.call(env)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'vagrant-mos/util/elb'
|
2
|
-
|
3
|
-
module VagrantPlugins
|
4
|
-
module MOS
|
5
|
-
module Action
|
6
|
-
# This registers instance in ELB
|
7
|
-
class ElbRegisterInstance
|
8
|
-
include ElasticLoadBalancer
|
9
|
-
|
10
|
-
def initialize(app, env)
|
11
|
-
@app = app
|
12
|
-
@logger = Log4r::Logger.new("vagrant_mos::action::elb_register_instance")
|
13
|
-
end
|
14
|
-
|
15
|
-
def call(env)
|
16
|
-
@app.call(env)
|
17
|
-
if elb_name = env[:machine].provider_config.elb
|
18
|
-
register_instance env, elb_name, env[:machine].id
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/lib/vagrant-mos/util/elb.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module MOS
|
3
|
-
module ElasticLoadBalancer
|
4
|
-
|
5
|
-
def register_instance(env, elb_name, instance_id)
|
6
|
-
env[:ui].info I18n.t("vagrant_mos.elb.registering", instance_id: instance_id, elb_name: elb_name), :new_line => false
|
7
|
-
elb = get_load_balancer(env[:mos_elb], elb_name)
|
8
|
-
unless elb.instances.include? instance_id
|
9
|
-
elb.register_instances([instance_id])
|
10
|
-
env[:ui].info I18n.t("vagrant_mos.elb.ok"), :prefix => false
|
11
|
-
adjust_availability_zones env, elb
|
12
|
-
else
|
13
|
-
env[:ui].info I18n.t("vagrant_mos.elb.skipped"), :prefix => false
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def deregister_instance(env, elb_name, instance_id)
|
18
|
-
env[:ui].info I18n.t("vagrant_mos.elb.deregistering", instance_id: instance_id, elb_name: elb_name), :new_line => false
|
19
|
-
elb = get_load_balancer(env[:mos_elb], elb_name)
|
20
|
-
if elb.instances.include? instance_id
|
21
|
-
elb.deregister_instances([instance_id])
|
22
|
-
env[:ui].info I18n.t("vagrant_mos.elb.ok"), :prefix => false
|
23
|
-
adjust_availability_zones env, elb
|
24
|
-
else
|
25
|
-
env[:ui].info I18n.t("vagrant_mos.elb.skipped"), :prefix => false
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def adjust_availability_zones(env, elb)
|
30
|
-
env[:ui].info I18n.t("vagrant_mos.elb.adjusting", elb_name: elb.id), :new_line => false
|
31
|
-
|
32
|
-
instances = env[:mos_compute].servers.all("instance-id" => elb.instances)
|
33
|
-
|
34
|
-
azs = if instances.empty?
|
35
|
-
["#{env[:machine].provider_config.region}a"]
|
36
|
-
else
|
37
|
-
instances.map(&:availability_zone).uniq
|
38
|
-
end
|
39
|
-
|
40
|
-
az_to_disable = elb.availability_zones - azs
|
41
|
-
az_to_enable = azs - elb.availability_zones
|
42
|
-
|
43
|
-
elb.enable_availability_zones az_to_enable unless az_to_enable.empty?
|
44
|
-
elb.disable_availability_zones az_to_disable unless az_to_disable.empty?
|
45
|
-
|
46
|
-
env[:ui].info I18n.t("vagrant_mos.elb.ok"), :prefix => false
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def get_load_balancer(mos, name)
|
52
|
-
mos.load_balancers.find { |lb| lb.id == name } or raise Errors::ElbDoesNotExistError
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|