vagrant-mongodb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/lib/vagrant-mongodb/config.rb +16 -5
- data/lib/vagrant-mongodb/version.rb +1 -1
- data/locales/en.yml +3 -0
- data/test/Vagrantfile +2 -0
- data/test/test.sh +0 -3
- metadata +2 -2
data/Gemfile
CHANGED
@@ -5,18 +5,29 @@ module VagrantPlugins
|
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@replsets = []
|
8
|
+
@translator = Helpers::Translator.new('config')
|
8
9
|
end
|
9
10
|
|
10
|
-
#
|
11
|
+
# override default merge behavior
|
11
12
|
# TODO look into merge strategy
|
12
13
|
def merge(other)
|
13
14
|
return self
|
14
15
|
end
|
15
16
|
|
16
17
|
def validate(machine)
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
errors = []
|
19
|
+
@replsets.each do |rs|
|
20
|
+
if rs.members.size < 3
|
21
|
+
errors << @translator.t('replset_size', { :name => rs.name })
|
22
|
+
end
|
23
|
+
rs.members.each do |m|
|
24
|
+
if !machine.env.machine_names.find { |name| name == m[:host] }
|
25
|
+
errors << @translator.t('unknown_member', { :member => m[:host] })
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
{ 'MongoDb' => errors }
|
20
31
|
end
|
21
32
|
|
22
33
|
def replset(name, &block)
|
@@ -40,7 +51,7 @@ module VagrantPlugins
|
|
40
51
|
def member(name, options = {})
|
41
52
|
member = @members.find { |m| m[:host] == name.to_sym }
|
42
53
|
if member
|
43
|
-
member.merge(options)
|
54
|
+
member.merge!(options)
|
44
55
|
else
|
45
56
|
@members << options.merge({ :_id => @members.size, :host => name.to_sym })
|
46
57
|
end
|
data/locales/en.yml
CHANGED
@@ -2,6 +2,9 @@ en:
|
|
2
2
|
vagrant_mongodb:
|
3
3
|
errors:
|
4
4
|
initiate: "Failed to initiate replica set"
|
5
|
+
config:
|
6
|
+
replset_size: "'%{name}' replica set requires a minimum of 3 members"
|
7
|
+
unknown_member: "'%{member}' member is not defined"
|
5
8
|
actions:
|
6
9
|
replset_initiate:
|
7
10
|
initiate: "Initiating replica set '%{name}'"
|
data/test/Vagrantfile
CHANGED
data/test/test.sh
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-mongodb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Vagrant plugin that manages a MongoDb replicaset
|
15
15
|
email:
|