Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: morepanda/vagrant
base: 70a99695da
...
head fork: morepanda/vagrant
compare: 7304d5f6c1
  • 10 commits
  • 13 files changed
  • 0 commit comments
  • 5 contributors
Commits on Apr 03, 2011
@morepanda Adds flexibility to 'config.puppet_server'.
When config.puppet_server is specified as 'x.x.x.x hostname'
then vagrant appends 'x.x.x.x hostname' to '/etc/hosts' on the
guest and launches puppetd with '--server $hostname'.

When config.puppet_server is specified as 'x.x.x.x'
then vagrant appends 'x.x.x.x puppet' to '/etc/hosts' on the
guest and launches puppetd with '--server puppet'.

When config.puppet_server is anything else then no magic
takes place and puppetd is launched as usual, with
'--server $config.puppet_server'.
4fe1bd4
Commits on Apr 05, 2011
@morepanda Merge branch 'puppet-server' into fixes 0809015
Commits on Apr 20, 2011
@TimDumol TimDumol Added Arch Linux as under vagrant/hosts
Added NFS support for Arch Linux under vagrant/hosts by adding
vagrant/hosts/arch and a platform test for Arch Linux.
2c091c9
@mitchellh mitchellh Some stylistic changes regarding arch commit 0953c41
@mitchellh mitchellh Retryable can take multiple exceptions to retry on 234c47a
@mitchellh mitchellh Retry all SSH commands on Net::SSH::Disconnect 6d669d7
@ramonvanalteren ramonvanalteren Fixed character in network template
Caused networking to generate spurious warnings
b1c7239
@mitchellh mitchellh v0.7.3 b6fccbc
@mitchellh mitchellh Up version for dev e7e9dc5
Commits on Apr 30, 2011
@morepanda Merge remote-tracking branch 'upstream/master' into fixes 7304d5f
View
8 CHANGELOG.md
@@ -1,5 +1,11 @@
-## 0.7.3 (unreleased)
+## 0.7.4 (unreleased)
+
+
+## 0.7.3 (April 19, 2011)
+
+ - Retry all SSH on Net::SSH::Disconnect in case SSH is just restarting. [GH-313]
+ - Add NFS shared folder support for Arch linux. [GH-346]
- Fix issue with unknown terminal type output for sudo commands.
- Forwarded port protocol can now be set as UDP. [GH-311]
- Chef server file cache path and file backup path can be configured. [GH-310]
View
1  lib/vagrant/hosts.rb
@@ -3,5 +3,6 @@ module Hosts
autoload :Base, 'vagrant/hosts/base'
autoload :BSD, 'vagrant/hosts/bsd'
autoload :Linux, 'vagrant/hosts/linux'
+ autoload :Arch, 'vagrant/hosts/arch'
end
end
View
27 lib/vagrant/hosts/arch.rb
@@ -0,0 +1,27 @@
+module Vagrant
+ module Hosts
+ class Arch < Linux
+ def nfs_export(ip, folders)
+ output = TemplateRenderer.render('nfs/exports_linux',
+ :uuid => env.vm.uuid,
+ :ip => ip,
+ :folders => folders)
+
+ env.ui.info I18n.t("vagrant.hosts.arch.nfs_export.prepare")
+ sleep 0.5
+
+ output.split("\n").each do |line|
+ # This should only ask for administrative permission once, even
+ # though its executed in multiple subshells.
+ system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
+ end
+
+ # We run restart here instead of "update" just in case nfsd
+ # is not starting
+ system("sudo /etc/rc.d/rpcbind restart")
+ system("sudo /etc/rc.d/nfs-common restart")
+ system("sudo /etc/rc.d/nfs-server restart")
+ end
+ end
+ end
+end
View
1  lib/vagrant/hosts/base.rb
@@ -31,6 +31,7 @@ def detect
classes = {
:darwin => BSD,
:bsd => BSD,
+ :arch => Arch,
:linux => Linux
}
View
22 lib/vagrant/provisioners/puppet_server.rb
@@ -41,6 +41,28 @@ def run_puppetd_client
commands = "puppetd #{options} --server #{config.puppet_server} --certname #{cn}"
+ # If config.puppet_server matches one of the following formats:
+ #
+ # 1.2.3.4
+ # 1.2.3.4 foobar.com
+ #
+ # then we patch /etc/hosts and contact the server as 'puppet'
+ # or 'foobar.com' respectively.
+ #
+ # This avoids SSL certificate mismatches when talking
+ # to a puppetmaster that can not be resolved by the local
+ # vagrant host.
+ magic_host = /^((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})([\s]+)?([^\s]+)?)$/.match(config.puppet_server)
+ if magic_host
+ config.puppet_server = magic_host[4] || 'puppet'
+ puppet_srv_ip = magic_host[2]
+ commands = "bash -c \"mv /etc/hosts /etc/hosts.old && " \
+ "{ grep -v '#{config.puppet_server}$' /etc/hosts.old; " \
+ "echo '#{puppet_srv_ip} #{config.puppet_server}'; } " \
+ ">/etc/hosts && puppetd #{options} " \
+ "--server #{config.puppet_server} --certname #{cn}\""
+ end
+
env.ui.info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
vm.ssh.execute do |ssh|
View
2  lib/vagrant/ssh/session.rb
@@ -61,7 +61,7 @@ def sudo!(commands, options=nil, &block)
# the actual `exec!` implementation, except that this
# implementation also reports `:exit_status` to the block if given.
def exec!(command, options=nil, &block)
- retryable(:tries => 5, :on => IOError, :sleep => 0.5) do
+ retryable(:tries => 5, :on => [IOError, Net::SSH::Disconnect], :sleep => 1.0) do
metach = session.open_channel do |channel|
channel.exec(command) do |ch, success|
raise "could not execute command: #{command.inspect}" unless success
View
7 lib/vagrant/util/platform.rb
@@ -28,6 +28,13 @@ def windows?
false
end
+ def arch?
+ linux? &&
+ File.exist?('/etc/rc.conf') &&
+ File.exist?('/etc/pacman.conf') &&
+ File.exist?('/etc/rc.d/')
+ end
+
# Returns boolean noting whether this is a 64-bit CPU. This
# is not 100% accurate and there could easily be false negatives.
#
View
2  lib/vagrant/util/retryable.rb
@@ -12,7 +12,7 @@ def retryable(opts=nil)
begin
return yield
- rescue opts[:on]
+ rescue *opts[:on]
if (opts[:tries] -= 1) > 0
sleep opts[:sleep].to_f if opts[:sleep]
retry
View
2  lib/vagrant/version.rb
@@ -2,5 +2,5 @@ module Vagrant
# This will always be up to date with the current version of Vagrant,
# since it is used to generate the gemspec and is also the source of
# the version for `vagrant -v`
- VERSION = "0.7.3.dev"
+ VERSION = "0.7.4.dev"
end
View
4 templates/locales/en.yml
@@ -451,6 +451,10 @@ en:
nfs_export:
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
+ arch:
+ nfs_export:
+ prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
+
provisioners:
chef:
json: "Generating chef JSON and uploading..."
View
2  templates/network_entry_gentoo.erb
@@ -3,5 +3,3 @@
# Please do not modify any of these contents.
config_eth<%= net_options[:adapter] %>=("<%= net_options[:ip] %> netmask <%= net_options[:netmask] %>")
#VAGRANT-END
-~
-
View
54 test/vagrant/provisioners/puppet_server_test.rb
@@ -42,21 +42,53 @@ class PuppetServerProvisionerTest < Test::Unit::TestCase
@vm.ssh.stubs(:execute).yields(@ssh)
end
- should "run the puppetd client" do
- @ssh.expects(:sudo!).with("puppetd --server #{@config.puppet_server} --certname #{@cn}").once
- @action.run_puppetd_client
+ context "config.puppet_server is hostname" do
+ should "run the puppetd client" do
+ @ssh.expects(:sudo!).with("puppetd --server #{@config.puppet_server} --certname #{@cn}").once
+ @action.run_puppetd_client
+ end
+
+ should "run puppetd with given options when given as an array" do
+ @config.options = ["--modulepath", "modules", "--verbose"]
+ @ssh.expects(:sudo!).with("puppetd --modulepath modules --verbose --server #{@config.puppet_server} --certname #{@cn}").once
+ @action.run_puppetd_client
+ end
+
+ should "run puppetd with the options when given as a string" do
+ @config.options = "--modulepath modules --verbose"
+ @ssh.expects(:sudo!).with("puppetd --modulepath modules --verbose --server #{@config.puppet_server} --certname #{@cn}").once
+ @action.run_puppetd_client
+ end
end
- should "run puppetd with given options when given as an array" do
- @config.options = ["--modulepath", "modules", "--verbose"]
- @ssh.expects(:sudo!).with("puppetd --modulepath modules --verbose --server #{@config.puppet_server} --certname #{@cn}").once
- @action.run_puppetd_client
+ context "config.puppet_server is ip_address" do
+ should "run the puppetd client" do
+ @config.puppet_server = '10.10.10.10'
+
+ expected_cmd = "bash -c \"mv /etc/hosts /etc/hosts.old && " \
+ "{ grep -v 'puppet$' /etc/hosts.old; " \
+ "echo '#{@config.puppet_server} puppet'; } " \
+ ">/etc/hosts && puppetd --server puppet "\
+ "--certname #{@cn}\""
+
+ @ssh.expects(:sudo!).with(expected_cmd).once
+ @action.run_puppetd_client
+ end
end
- should "run puppetd with the options when given as a string" do
- @config.options = "--modulepath modules --verbose"
- @ssh.expects(:sudo!).with("puppetd --modulepath modules --verbose --server #{@config.puppet_server} --certname #{@cn}").once
- @action.run_puppetd_client
+ context "config.puppet_server is 'ip_address hostname'" do
+ should "run the puppetd client" do
+ @config.puppet_server = '10.10.10.10 puppetmaster.test'
+
+ expected_cmd = "bash -c \"mv /etc/hosts /etc/hosts.old && " \
+ "{ grep -v 'puppetmaster.test$' /etc/hosts.old; " \
+ "echo '10.10.10.10 puppetmaster.test'; } " \
+ ">/etc/hosts && puppetd --server "\
+ "puppetmaster.test --certname #{@cn}\""
+
+ @ssh.expects(:sudo!).with(expected_cmd).once
+ @action.run_puppetd_client
+ end
end
should "check the exit status if that is given" do
View
12 test/vagrant/util/retryable_test.rb
@@ -31,6 +31,18 @@ class RetryableUtilTest < Test::Unit::TestCase
}
end
+ should "retry on multiple exceptions given" do
+ proc = mock("proc")
+ proc.expects(:call).twice
+
+ assert_raises(StandardError) {
+ @klass.retryable(:tries => 2, :on => [StandardError, RuntimeError]) do
+ proc.call
+ raise StandardError
+ end
+ }
+ end
+
should "return the value of the block" do
result = @klass.retryable { 7 }
assert_equal 7, result

No commit comments for this range

Something went wrong with that request. Please try again.