vagrantup 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e775ed74e4bd2eebb4fbdc54beb67fee6444e15
4
- data.tar.gz: 0b904bc2ac9657ab99bc22cda65bc792bed11146
3
+ metadata.gz: 0c6ea40d6614cd3c0f728b972374c5d95f3d40c0
4
+ data.tar.gz: b6998aadd6a3f73ad05a8294242c3161d7f134d5
5
5
  SHA512:
6
- metadata.gz: e3470fbb21d44021ad01756245efe09f7583e440e70290ee82ee712714adc78a2191cb7686f8a5e95a77d133aaea6ed3becd832b5b5dc2271625164f55704c6c
7
- data.tar.gz: f11fd6bdc251ed86a588650f53daa25c54f2057cfbb331d637199a6426ba85cd4a98985751ed9104dd9412e4ac07a4560abba9f08c7cc1c2cf27e9e2918dbec9
6
+ metadata.gz: 57cc0f3b319828925c595b8a69aecec6a705c149e0a77fa2a496133a68b62a0e65632c99abd1c0fd6bf3e6595ed34e478ccca723dcffc6b1c204f9573caf68ab
7
+ data.tar.gz: bf877dbab9f8ca69b3dc5044e151ce680f62ba642324eb1080317cce7f18b1128936ad5fe4444ff4f4f7bfa5072078fd646af6ed5776cbf587711510fda4952e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.7.5 (May 16, 2011)
2
+
3
+ - `config.ssh.port` can be specified and takes highest precedence if specified.
4
+ Otherwise, Vagrant will still attempt to auto-detect the port. [GH-363]
5
+ - Get rid of RubyGems deprecations introduced with RubyGems 1.8.x
6
+ - Search in pre-release gems for plugins as well as release gems.
7
+ - Support for Chef-solo `data_bags_path` [GH-362]
8
+ - Can specify path to Chef binary using `binary_path` [GH-342]
9
+ - Can specify additional environment data for Chef using `binary_env` [GH-342]
10
+
1
11
  ## 0.7.4 (May 12, 2011)
2
12
 
3
13
  - Chef environments support (for Chef 0.10) [GH-358]
@@ -12,9 +12,11 @@ module Vagrant
12
12
  attr_accessor :forward_agent
13
13
  attr_accessor :forward_x11
14
14
  attr_accessor :sudo_shell
15
+ attr_accessor :port
15
16
 
16
17
  def initialize
17
18
  @sudo_shell = "bash"
19
+ @port = nil
18
20
  end
19
21
 
20
22
  def private_key_path
@@ -21,18 +21,31 @@ module Vagrant
21
21
  # load path. This file is loaded to kick off the load sequence
22
22
  # for that plugin.
23
23
  def self.load!
24
+ # RubyGems 1.8.0 deprecated `source_index`. Gem::Specification is the
25
+ # new replacement. For now, we support both, but special-case 1.8.x
26
+ # so that we avoid deprecation messages.
27
+ index = Gem::VERSION >= "1.8.0" ? Gem::Specification : Gem.source_index
28
+
24
29
  # Stupid hack since Rails 2.3.x overrides Gem.source_index with their
25
30
  # own incomplete replacement which causes issues.
26
- index = Gem.source_index
27
31
  index = [index.installed_source_index, index.vendor_source_index] if defined?(Rails::VendorGemSourceIndex) && index.is_a?(Rails::VendorGemSourceIndex)
28
32
 
29
33
  # Look for a vagrant_init.rb in all the gems, but only the
30
34
  # latest version of the gems.
31
35
  [index].flatten.each do |source|
36
+ # In 1.6.0, added the option of including prerelease gems, which is
37
+ # useful for developers.
38
+ specs = Gem::VERSION >= "1.6.0" ? source.latest_specs(true) : source.latest_specs
39
+
32
40
  source.latest_specs.each do |spec|
33
- file = Gem.searcher.matching_files(spec, "vagrant_init.rb").first
34
- next if !file
41
+ file = nil
42
+ if Gem::VERSION >= "1.8.0"
43
+ file = spec.matches_for_glob("**/vagrant_init.rb").first
44
+ else
45
+ file = Gem.searcher.matching_files(spec, "vagrant_init.rb").first
46
+ end
35
47
 
48
+ next if !file
36
49
  @@plugins << new(spec, file)
37
50
  end
38
51
  end
@@ -16,6 +16,13 @@ module Vagrant
16
16
  end
17
17
  end
18
18
 
19
+ # Returns the path to the Chef binary, taking into account the
20
+ # `binary_path` configuration option.
21
+ def chef_binary_path(binary)
22
+ return binary if !config.binary_path
23
+ return File.join(config.binary_path, binary)
24
+ end
25
+
19
26
  def chown_provisioning_folder
20
27
  vm.ssh.execute do |ssh|
21
28
  ssh.sudo!("mkdir -p #{config.provisioning_path}")
@@ -81,6 +88,8 @@ module Vagrant
81
88
  attr_accessor :https_proxy_user
82
89
  attr_accessor :https_proxy_pass
83
90
  attr_accessor :no_proxy
91
+ attr_accessor :binary_path
92
+ attr_accessor :binary_env
84
93
 
85
94
  def initialize
86
95
  @provisioning_path = "/tmp/vagrant-chef"
@@ -93,6 +102,8 @@ module Vagrant
93
102
  @https_proxy_user = nil
94
103
  @https_proxy_pass = nil
95
104
  @no_proxy = nil
105
+ @binary_path = nil
106
+ @binary_env = nil
96
107
  end
97
108
 
98
109
  # Returns the run list for the provisioning
@@ -41,7 +41,7 @@ module Vagrant
41
41
  end
42
42
 
43
43
  def provision!
44
- verify_binary("chef-client")
44
+ verify_binary(chef_binary_path("chef-client"))
45
45
  chown_provisioning_folder
46
46
  create_client_key_folder
47
47
  upload_validation_key
@@ -78,8 +78,9 @@ module Vagrant
78
78
  end
79
79
 
80
80
  def run_chef_client
81
+ command_env = config.binary_env ? "#{config.binary_env} " : ""
81
82
  commands = ["cd #{config.provisioning_path}",
82
- "chef-client -c client.rb -j dna.json"]
83
+ "#{command_env}#{chef_binary_path("chef-client")} -c client.rb -j dna.json"]
83
84
 
84
85
  env.ui.info I18n.t("vagrant.provisioners.chef.running_client")
85
86
  vm.ssh.execute do |ssh|
@@ -7,6 +7,7 @@ module Vagrant
7
7
  class Config < Chef::Config
8
8
  attr_accessor :cookbooks_path
9
9
  attr_accessor :roles_path
10
+ attr_accessor :data_bags_path
10
11
  attr_accessor :recipe_url
11
12
 
12
13
  def initialize
@@ -14,6 +15,7 @@ module Vagrant
14
15
 
15
16
  @cookbooks_path = ["cookbooks", [:vm, "cookbooks"]]
16
17
  @roles_path = []
18
+ @data_bags_path = []
17
19
  end
18
20
 
19
21
  def validate(errors)
@@ -27,10 +29,11 @@ module Vagrant
27
29
  def prepare
28
30
  share_cookbook_folders
29
31
  share_role_folders
32
+ share_data_bags_folders
30
33
  end
31
34
 
32
35
  def provision!
33
- verify_binary("chef-solo")
36
+ verify_binary(chef_binary_path("chef-solo"))
34
37
  chown_provisioning_folder
35
38
  setup_json
36
39
  setup_solo_config
@@ -49,6 +52,12 @@ module Vagrant
49
52
  end
50
53
  end
51
54
 
55
+ def share_data_bags_folders
56
+ host_data_bag_paths.each_with_index do |data_bag, i|
57
+ env.config.vm.share_folder("v-csdb-#{i}", data_bag_path(i), data_bag)
58
+ end
59
+ end
60
+
52
61
  def setup_solo_config
53
62
  setup_config("chef_solo_solo", "solo.rb", {
54
63
  :node_name => config.node_name,
@@ -56,11 +65,13 @@ module Vagrant
56
65
  :cookbooks_path => cookbooks_path,
57
66
  :recipe_url => config.recipe_url,
58
67
  :roles_path => roles_path,
68
+ :data_bags_path => data_bags_path,
59
69
  })
60
70
  end
61
71
 
62
72
  def run_chef_solo
63
- commands = ["cd #{config.provisioning_path}", "chef-solo -c solo.rb -j dna.json"]
73
+ command_env = config.binary_env ? "#{config.binary_env} " : ""
74
+ commands = ["cd #{config.provisioning_path}", "#{command_env}#{chef_binary_path("chef-solo")} -c solo.rb -j dna.json"]
64
75
 
65
76
  env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
66
77
  vm.ssh.execute do |ssh|
@@ -122,6 +133,10 @@ module Vagrant
122
133
  host_folder_paths(config.roles_path)
123
134
  end
124
135
 
136
+ def host_data_bag_paths
137
+ host_folder_paths(config.data_bags_path)
138
+ end
139
+
125
140
  def cookbook_path(i)
126
141
  folder_path("cookbooks", i)
127
142
  end
@@ -130,6 +145,10 @@ module Vagrant
130
145
  folder_path("roles", i)
131
146
  end
132
147
 
148
+ def data_bag_path(i)
149
+ folder_path("data_bags", i)
150
+ end
151
+
133
152
  def cookbooks_path
134
153
  folders_path(config.cookbooks_path, "cookbooks").to_json
135
154
  end
@@ -137,6 +156,10 @@ module Vagrant
137
156
  def roles_path
138
157
  folders_path(config.roles_path, "roles").to_json
139
158
  end
159
+
160
+ def data_bags_path
161
+ folders_path(config.data_bags_path, "data_bags").to_json
162
+ end
140
163
  end
141
164
  end
142
165
  end
data/lib/vagrant/ssh.rb CHANGED
@@ -154,6 +154,9 @@ module Vagrant
154
154
  pnum = opts[:port]
155
155
  return pnum if pnum
156
156
 
157
+ # Check if a port was specified in the config
158
+ return env.config.ssh.port if env.config.ssh.port
159
+
157
160
  # Check if we have an SSH forwarded port
158
161
  pnum = nil
159
162
  env.vm.vm.network_adapters.each do |na|
@@ -2,5 +2,5 @@ module Vagrant
2
2
  # This will always be up to date with the current version of Vagrant,
3
3
  # since it is used to generate the gemspec and is also the source of
4
4
  # the version for `vagrant -v`
5
- VERSION = "0.7.4"
5
+ VERSION = "0.7.5"
6
6
  end
@@ -6,6 +6,10 @@ cookbook_path <%= cookbooks_path %>
6
6
  role_path <%= roles_path %>
7
7
  log_level <%= log_level.inspect %>
8
8
 
9
+ <% if data_bags_path %>
10
+ data_bag_path <%= data_bags_path %>
11
+ <% end %>
12
+
9
13
  <% if recipe_url -%>
10
14
  recipe_url "<%= recipe_url %>"
11
15
  <% end -%>
@@ -42,6 +42,11 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
42
42
  @action.expects(:share_role_folders).once
43
43
  @action.prepare
44
44
  end
45
+
46
+ should "share data bag folders" do
47
+ @action.expects(:share_data_bags_folders).once
48
+ @action.prepare
49
+ end
45
50
  end
46
51
 
47
52
  context "provisioning" do
@@ -86,6 +91,22 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
86
91
  @action.share_role_folders
87
92
  end
88
93
  end
94
+
95
+ context "sharing data bag folders" do
96
+ setup do
97
+ @host_data_bag_paths = ["foo", "bar"]
98
+ @action.stubs(:host_data_bag_paths).returns(@host_data_bag_paths)
99
+ end
100
+
101
+ should "share each data bag folder" do
102
+ share_seq = sequence("share_seq")
103
+ @host_data_bag_paths.each_with_index do |data_bag, i|
104
+ @env.config.vm.expects(:share_folder).with("v-csdb-#{i}", @action.data_bag_path(i), data_bag).in_sequence(share_seq)
105
+ end
106
+
107
+ @action.share_data_bags_folders
108
+ end
109
+ end
89
110
 
90
111
  context "host folder paths" do
91
112
  should "ignore VM paths" do
@@ -124,6 +145,15 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
124
145
  assert_equal result, @action.host_role_paths
125
146
  end
126
147
  end
148
+
149
+ context "host data bags paths" do
150
+ should "get folders path for configured data bag path" do
151
+ result = mock("result")
152
+ @config.stubs(:data_bags_path).returns("foo")
153
+ @action.expects(:host_folder_paths).with(@config.data_bags_path).returns(result)
154
+ assert_equal result, @action.host_data_bag_paths
155
+ end
156
+ end
127
157
 
128
158
  context "folder path" do
129
159
  should "return a proper path to a single folder" do
@@ -179,6 +209,19 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
179
209
  end
180
210
  end
181
211
 
212
+ context "data bags path" do
213
+ should "return a proper path to a single data bag" do
214
+ expected = File.join(@config.provisioning_path, "data_bags-5")
215
+ assert_equal expected, @action.data_bag_path(5)
216
+ end
217
+
218
+ should "properly call folders path and return result" do
219
+ result = [:a, :b, :c]
220
+ @action.expects(:folders_path).with(@config.data_bags_path, "data_bags").once.returns(result)
221
+ assert_equal result.to_json, @action.data_bags_path
222
+ end
223
+ end
224
+
182
225
  context "generating and uploading chef solo configuration file" do
183
226
  setup do
184
227
  @vm.ssh.stubs(:upload!)
@@ -192,7 +235,8 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
192
235
  :provisioning_path => @config.provisioning_path,
193
236
  :cookbooks_path => @action.cookbooks_path,
194
237
  :recipe_url => @config.recipe_url,
195
- :roles_path => @action.roles_path
238
+ :roles_path => @action.roles_path,
239
+ :data_bags_path => @action.data_bags_path
196
240
  })
197
241
 
198
242
  @action.setup_solo_config
@@ -78,6 +78,18 @@ class ChefProvisionerTest < Test::Unit::TestCase
78
78
  end
79
79
  end
80
80
 
81
+ context "chef binary path" do
82
+ should "return just the binary if no binary path is set" do
83
+ @config.binary_path = nil
84
+ assert_equal "foo", @action.chef_binary_path("foo")
85
+ end
86
+
87
+ should "return the joined binary path and binary if set" do
88
+ @config.binary_path = "/foo"
89
+ assert_equal File.join(@config.binary_path, "bar"), @action.chef_binary_path("bar")
90
+ end
91
+ end
92
+
81
93
  context "permissions on provisioning folder" do
82
94
  should "create and chown the folder to the ssh user" do
83
95
  ssh_seq = sequence("ssh_seq")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrantup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto