vagrant-soa 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ddf4c189d3007118c7c28eec41cc5cec3fa3078
4
- data.tar.gz: 1383801f3598b670d6430ae266394f3956b8e1c8
3
+ metadata.gz: e48d84deea10c569b26e383ddb52ad82e5077fce
4
+ data.tar.gz: 72d979ee82cfdba577b655c785ba9733f41f1ab3
5
5
  SHA512:
6
- metadata.gz: b5f84a4bb90fc147cbdf6637f637c50ab86031ac9e893daca726954d34042dd815308a9e05f58ee94d343cf03bc2058c7b7a650d6105681b1e962357391e8429
7
- data.tar.gz: d8cbc4d7c706679d5c4ef531c1a0afa3472121c3c29135ca71d4a4988059b257abc8a6f72856f7959f751dc7f3ab36981fca7a388f158878f04327c48176b9ec
6
+ metadata.gz: 33d35e5aa666c09202d263dcee5a32ec973137bc504cb7fbd143a0ea34fc356f14ff046ee2200821a879b0528beae0c471a43cf1e83564c51322714716431700
7
+ data.tar.gz: 393826d5aa7d56910ddbfe8d6c7a162565fec2d506f18d0d0c6b34796cee280e6a51c9f2b7508cc5aca3bcb03b933728a2e534b4ac2c84f542664ad2d94dc015
data/Vagrantfile CHANGED
@@ -6,13 +6,19 @@ Vagrant.configure('2') do |config|
6
6
  config.vm.box = 'precise64'
7
7
  config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
8
8
 
9
+ local_work_dir = File.expand_path('./work')
10
+ vagrant_work_dir = '/home/vagrant/work'
11
+ config.vm.synced_folder local_work_dir, vagrant_work_dir
12
+
13
+ config.soa.local_work_dir = local_work_dir
14
+ config.soa.vagrant_work_dir = vagrant_work_dir
9
15
  config.soa.services = {
10
16
  'example_service' => {
11
- 'puppet_path' => 'services/example_service/puppet',
17
+ 'puppet_path' => 'work/services/example_service/puppet',
12
18
  'github_url' => 'git@github.com:eventbrite/vagrant-soa.git'
13
19
  },
14
20
  'local_service' => {
15
- 'local_path' => './services/local_service',
21
+ 'local_path' => 'services/local_service',
16
22
  },
17
23
  }
18
24
 
@@ -165,26 +165,27 @@ module VagrantPlugins
165
165
 
166
166
  def symlink_local_service(service, config)
167
167
  target_directory = File.join @install_dir, service
168
- # make sure the repo is checked out
169
- if File.directory? target_directory
170
- @env[:ui].info "Local Service: #{service} is already symlinked"
171
- else
172
- FileUtils.symlink File.expand_path(config['local_path']), target_directory
173
- @env[:ui].info "Symlinking local service: #{service} to #{target_directory}"
174
- end
168
+ FileUtils.symlink File.expand_path(config['local_path'], @soa.vagrant_work_dir), target_directory, :force => true
169
+ @env[:ui].info "Symlinking local service: #{service} to #{target_directory}"
175
170
  return target_directory
176
171
  end
177
172
 
178
173
  # To install a service we clone the service repo and add the puppet
179
174
  # path to @puppet_module_registry.puppet_module_paths.
180
175
  def install_service(service, config)
181
- if config.has_key? 'local_path'
176
+ if config.has_key?('local_path')
177
+ if not @soa.local_work_dir and not @soa.vagrant_work_dir
178
+ @env[:ui].error "You must specify 'config.soa.local_work_dir' and 'config.soa.vagrant_work_dir' to setup a local service"
179
+ return
180
+ end
182
181
  target_directory = symlink_local_service(service, config)
182
+ puppet_directory = File.expand_path(config['local_path'], @soa.local_work_dir)
183
183
  else
184
184
  target_directory = clone_service_repo(service, config)
185
+ puppet_directory = target_directory
185
186
  end
186
187
  puppet_path = config.fetch('puppet_path', 'puppet')
187
- full_path = File.join(target_directory, puppet_path)
188
+ full_path = File.join(puppet_directory, puppet_path)
188
189
  register_service_home_fact(service, config)
189
190
  @puppet_module_registry.register_module_path(service, full_path)
190
191
  end
@@ -3,15 +3,21 @@ module VagrantPlugins
3
3
  class Config < Vagrant.plugin(2, :config)
4
4
  attr_accessor :services
5
5
  attr_accessor :github_base
6
+ attr_accessor :local_work_dir
7
+ attr_accessor :vagrant_work_dir
6
8
 
7
9
  def initialize
8
10
  @services = UNSET_VALUE
9
11
  @github_base = UNSET_VALUE
12
+ @local_work_dir = UNSET_VALUE
13
+ @vagrant_work_dir = UNSET_VALUE
10
14
  end
11
15
 
12
16
  def finalize!
13
17
  @services = nil if @services == UNSET_VALUE
14
18
  @github_base = nil if @github_base == UNSET_VALUE
19
+ @local_work_dir = @local_work_dir == UNSET_VALUE ? nil : File.expand_path(@local_work_dir)
20
+ @vagrant_work_dir = @vagrant_work_dir == UNSET_VALUE ? nil : File.expand_path(@vagrant_work_dir)
15
21
  end
16
22
 
17
23
  def validate(machine)
@@ -28,6 +34,12 @@ module VagrantPlugins
28
34
  end
29
35
  end
30
36
 
37
+ if @local_work_dir
38
+ if not File.directory?(@local_work_dir)
39
+ errors << "Specified 'local_work_dir' does not exist: #{@local_work_dir}"
40
+ end
41
+ end
42
+
31
43
  return { 'soa' => errors }
32
44
  end
33
45
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Soa
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-soa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hahn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-10 00:00:00.000000000 Z
11
+ date: 2014-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,9 +63,9 @@ files:
63
63
  - pkg/vagrant-soa-0.2.0.gem
64
64
  - pkg/vagrant-soa-0.2.1.gem
65
65
  - pkg/vagrant-soa-0.3.0.gem
66
- - services/example_service/puppet/example_service/manifests/init.pp
67
- - services/local_service/puppet/local_service/manifests/init.pp
68
66
  - vagrant-soa.gemspec
67
+ - work/services/example_service/puppet/example_service/manifests/init.pp
68
+ - work/services/local_service/puppet/local_service/manifests/init.pp
69
69
  homepage: ''
70
70
  licenses:
71
71
  - MIT