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 CHANGED
@@ -1,3 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git', :tag => 'v1.1.5'
3
4
  gemspec
@@ -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
- # Override default merge behavior
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
- # TODO check that member names have a matching vm definition
18
- # TODO check that each replica set has 3+ members
19
- # TODO warn if replica set has even number of members
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
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module MongoDb
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
@@ -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}'"
@@ -1,6 +1,8 @@
1
1
  # -*- mode: ruby -*-
2
2
  # vi: set ft=ruby :
3
3
 
4
+ Vagrant.require_plugin('vagrant-mongodb')
5
+
4
6
  Vagrant.configure('2') do |config|
5
7
  config.vm.box = 'precise64'
6
8
  config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
@@ -1,6 +1,3 @@
1
- gem build *.gemspec
2
- vagrant plugin install vagrant-mongodb
3
-
4
1
  cd test
5
2
 
6
3
  vagrant up
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.2
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-01 00:00:00.000000000 Z
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: