vagrantup 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -1
- data/Gemfile +0 -14
- data/LICENSE +1 -1
- data/bin/vagrant +47 -20
- data/config/default.rb +6 -14
- data/lib/vagrant/action/box/destroy.rb +7 -3
- data/lib/vagrant/action/box/download.rb +8 -8
- data/lib/vagrant/action/box/package.rb +2 -2
- data/lib/vagrant/action/box/unpackage.rb +13 -7
- data/lib/vagrant/action/box/verify.rb +5 -5
- data/lib/vagrant/action/builder.rb +23 -19
- data/lib/vagrant/action/builtin.rb +117 -79
- data/lib/vagrant/action/env/set.rb +7 -4
- data/lib/vagrant/action/environment.rb +3 -41
- data/lib/vagrant/action/general/package.rb +14 -29
- data/lib/vagrant/action/general/validate.rb +2 -2
- data/lib/vagrant/action/runner.rb +53 -0
- data/lib/vagrant/action/vm/boot.rb +9 -9
- data/lib/vagrant/action/vm/check_accessible.rb +2 -2
- data/lib/vagrant/action/vm/check_box.rb +10 -12
- data/lib/vagrant/action/vm/check_guest_additions.rb +8 -8
- data/lib/vagrant/action/vm/check_port_collisions.rb +85 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +4 -4
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +3 -11
- data/lib/vagrant/action/vm/clear_network_interfaces.rb +31 -0
- data/lib/vagrant/action/vm/clear_shared_folders.rb +2 -11
- data/lib/vagrant/action/vm/customize.rb +19 -9
- data/lib/vagrant/action/vm/destroy.rb +4 -4
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +2 -12
- data/lib/vagrant/action/vm/discard_state.rb +4 -4
- data/lib/vagrant/action/vm/export.rb +13 -8
- data/lib/vagrant/action/vm/forward_ports.rb +55 -102
- data/lib/vagrant/action/vm/halt.rb +9 -6
- data/lib/vagrant/action/vm/host_name.rb +4 -4
- data/lib/vagrant/action/vm/import.rb +19 -10
- data/lib/vagrant/action/vm/match_mac_address.rb +4 -9
- data/lib/vagrant/action/vm/network.rb +300 -94
- data/lib/vagrant/action/vm/nfs.rb +41 -26
- data/lib/vagrant/action/vm/package.rb +1 -1
- data/lib/vagrant/action/vm/package_vagrantfile.rb +5 -2
- data/lib/vagrant/action/vm/provision.rb +42 -13
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +2 -2
- data/lib/vagrant/action/vm/{clear_nfs_exports.rb → prune_nfs_exports.rb} +7 -7
- data/lib/vagrant/action/vm/resume.rb +4 -4
- data/lib/vagrant/action/vm/setup_package_files.rb +54 -0
- data/lib/vagrant/action/vm/share_folders.rb +63 -39
- data/lib/vagrant/action/vm/suspend.rb +4 -4
- data/lib/vagrant/action/warden.rb +13 -6
- data/lib/vagrant/action.rb +45 -123
- data/lib/vagrant/box.rb +9 -55
- data/lib/vagrant/box_collection.rb +22 -17
- data/lib/vagrant/cli.rb +62 -47
- data/lib/vagrant/command/base.rb +135 -90
- data/lib/vagrant/command/box.rb +46 -21
- data/lib/vagrant/command/box_add.rb +33 -0
- data/lib/vagrant/command/box_list.rb +25 -0
- data/lib/vagrant/command/box_remove.rb +23 -0
- data/lib/vagrant/command/box_repackage.rb +23 -0
- data/lib/vagrant/command/destroy.rb +16 -5
- data/lib/vagrant/command/halt.rb +25 -7
- data/lib/vagrant/command/init.rb +30 -7
- data/lib/vagrant/command/package.rb +49 -18
- data/lib/vagrant/command/provision.rb +22 -9
- data/lib/vagrant/command/reload.rb +18 -5
- data/lib/vagrant/command/resume.rb +18 -5
- data/lib/vagrant/command/ssh.rb +69 -31
- data/lib/vagrant/command/ssh_config.rb +37 -22
- data/lib/vagrant/command/status.rb +22 -20
- data/lib/vagrant/command/suspend.rb +18 -5
- data/lib/vagrant/command/up.rb +41 -8
- data/lib/vagrant/command.rb +18 -20
- data/lib/vagrant/communication/base.rb +56 -0
- data/lib/vagrant/communication/ssh.rb +200 -0
- data/lib/vagrant/communication.rb +7 -0
- data/lib/vagrant/config/base.rb +18 -26
- data/lib/vagrant/config/container.rb +37 -0
- data/lib/vagrant/config/error_recorder.rb +1 -1
- data/lib/vagrant/config/loader.rb +125 -0
- data/lib/vagrant/config/nfs.rb +1 -3
- data/lib/vagrant/config/package.rb +1 -3
- data/lib/vagrant/config/ssh.rb +31 -16
- data/lib/vagrant/config/top.rb +36 -25
- data/lib/vagrant/config/vagrant.rb +2 -5
- data/lib/vagrant/config/vm/provisioner.rb +16 -20
- data/lib/vagrant/config/vm/sub_vm.rb +1 -1
- data/lib/vagrant/config/vm.rb +115 -56
- data/lib/vagrant/config.rb +29 -103
- data/lib/vagrant/data_store.rb +23 -15
- data/lib/vagrant/downloaders/base.rb +7 -5
- data/lib/vagrant/downloaders/file.rb +4 -4
- data/lib/vagrant/downloaders/http.rb +4 -5
- data/lib/vagrant/driver/virtualbox.rb +121 -0
- data/lib/vagrant/driver/virtualbox_4_0.rb +411 -0
- data/lib/vagrant/driver/virtualbox_4_1.rb +411 -0
- data/lib/vagrant/driver/virtualbox_base.rb +284 -0
- data/lib/vagrant/driver.rb +7 -0
- data/lib/vagrant/environment.rb +221 -240
- data/lib/vagrant/errors.rb +74 -25
- data/lib/vagrant/guest/arch.rb +48 -0
- data/lib/vagrant/{systems → guest}/base.rb +30 -18
- data/lib/vagrant/guest/debian.rb +61 -0
- data/lib/vagrant/{systems → guest}/freebsd.rb +11 -18
- data/lib/vagrant/guest/gentoo.rb +32 -0
- data/lib/vagrant/{systems → guest}/linux/config.rb +2 -4
- data/lib/vagrant/guest/linux/error.rb +9 -0
- data/lib/vagrant/guest/linux.rb +78 -0
- data/lib/vagrant/guest/redhat.rb +66 -0
- data/lib/vagrant/guest/solaris.rb +114 -0
- data/lib/vagrant/{systems → guest}/suse.rb +2 -2
- data/lib/vagrant/guest/ubuntu.rb +23 -0
- data/lib/vagrant/guest.rb +16 -0
- data/lib/vagrant/hosts/arch.rb +7 -3
- data/lib/vagrant/hosts/base.rb +36 -46
- data/lib/vagrant/hosts/bsd.rb +53 -16
- data/lib/vagrant/hosts/fedora.rb +14 -0
- data/lib/vagrant/hosts/freebsd.rb +6 -36
- data/lib/vagrant/hosts/linux.rb +45 -20
- data/lib/vagrant/hosts/windows.rb +16 -0
- data/lib/vagrant/hosts.rb +23 -6
- data/lib/vagrant/provisioners/base.rb +11 -34
- data/lib/vagrant/provisioners/chef.rb +30 -26
- data/lib/vagrant/provisioners/chef_client.rb +37 -23
- data/lib/vagrant/provisioners/chef_solo.rb +61 -16
- data/lib/vagrant/provisioners/puppet.rb +70 -38
- data/lib/vagrant/provisioners/puppet_server.rb +12 -13
- data/lib/vagrant/provisioners/shell.rb +24 -24
- data/lib/vagrant/provisioners.rb +10 -7
- data/lib/vagrant/registry.rb +49 -0
- data/lib/vagrant/ssh.rb +82 -153
- data/lib/vagrant/ui.rb +118 -50
- data/lib/vagrant/util/busy.rb +1 -1
- data/lib/vagrant/util/file_mode.rb +12 -0
- data/lib/vagrant/util/network_ip.rb +28 -0
- data/lib/vagrant/util/platform.rb +1 -0
- data/lib/vagrant/util/subprocess.rb +227 -0
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +111 -97
- data/lib/vagrant.rb +132 -5
- data/tasks/acceptance.rake +3 -3
- data/tasks/test.rake +7 -2
- data/templates/commands/init/Vagrantfile.erb +11 -4
- data/templates/{ssh_config.erb → commands/ssh_config/config.erb} +0 -0
- data/templates/guests/arch/network_dhcp.erb +7 -0
- data/templates/guests/arch/network_static.erb +7 -0
- data/templates/guests/debian/network_dhcp.erb +6 -0
- data/templates/guests/debian/network_static.erb +7 -0
- data/templates/guests/gentoo/network_dhcp.erb +4 -0
- data/templates/guests/gentoo/network_static.erb +4 -0
- data/templates/guests/redhat/network_dhcp.erb +6 -0
- data/templates/guests/redhat/network_static.erb +7 -0
- data/templates/locales/en.yml +241 -122
- data/templates/{chef_server_client.erb → provisioners/chef_client/client.erb} +0 -0
- data/templates/{chef_solo_solo.erb → provisioners/chef_solo/solo.erb} +0 -0
- data/test/acceptance/base.rb +10 -10
- data/test/acceptance/box_test.rb +28 -6
- data/test/acceptance/destroy_test.rb +1 -1
- data/test/acceptance/halt_test.rb +4 -4
- data/test/acceptance/init_test.rb +3 -3
- data/test/acceptance/networking/host_only_test.rb +37 -0
- data/test/acceptance/networking/port_forward_test.rb +125 -0
- data/test/acceptance/package_test.rb +46 -0
- data/test/acceptance/provisioning/basic_test.rb +61 -0
- data/test/acceptance/provisioning/chef_solo_test.rb +37 -0
- data/test/acceptance/provisioning/shell_test.rb +53 -0
- data/test/acceptance/resume_test.rb +1 -1
- data/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
- data/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
- data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/ssh_test.rb +7 -2
- data/test/acceptance/support/config.rb +1 -1
- data/test/acceptance/support/isolated_environment.rb +41 -150
- data/test/acceptance/support/matchers/match_output.rb +1 -1
- data/test/acceptance/support/matchers/succeed.rb +14 -0
- data/test/acceptance/support/network_tests.rb +29 -0
- data/test/acceptance/support/output.rb +9 -1
- data/test/acceptance/support/shared/base_context.rb +16 -9
- data/test/acceptance/support/shared/command_examples.rb +4 -4
- data/test/acceptance/suspend_test.rb +1 -1
- data/test/acceptance/up_basic_test.rb +26 -7
- data/test/acceptance/up_with_box_url.rb +1 -1
- data/test/acceptance/vagrant_test.rb +1 -1
- data/test/acceptance/version_test.rb +0 -5
- data/test/support/isolated_environment.rb +46 -0
- data/test/{acceptance/support → support}/tempdir.rb +0 -0
- data/test/unit/base.rb +21 -0
- data/test/unit/support/isolated_environment.rb +39 -0
- data/test/unit/support/shared/base_context.rb +30 -0
- data/test/unit/vagrant/action/builder_test.rb +126 -177
- data/test/unit/vagrant/action/environment_test.rb +10 -21
- data/test/unit/vagrant/action/runner_test.rb +65 -0
- data/test/unit/vagrant/action/warden_test.rb +64 -97
- data/test/unit/vagrant/box_collection_test.rb +44 -33
- data/test/unit/vagrant/box_test.rb +25 -65
- data/test/unit/vagrant/command/base_test.rb +141 -14
- data/test/unit/vagrant/config/base_test.rb +16 -43
- data/test/unit/vagrant/config/loader_test.rb +79 -0
- data/test/unit/vagrant/config/top_test.rb +69 -0
- data/test/unit/vagrant/config/vm_test.rb +62 -47
- data/test/unit/vagrant/config_test.rb +16 -151
- data/test/unit/vagrant/data_store_test.rb +43 -61
- data/test/unit/vagrant/downloaders/base_test.rb +12 -22
- data/test/unit/vagrant/downloaders/file_test.rb +58 -31
- data/test/unit/vagrant/downloaders/http_test.rb +12 -86
- data/test/unit/vagrant/environment_test.rb +107 -536
- data/test/unit/vagrant/hosts_test.rb +36 -0
- data/test/unit/vagrant/registry_test.rb +56 -0
- data/test/unit/vagrant/util/file_checksum_test.rb +23 -0
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +23 -24
- data/test/unit/vagrant/util/network_ip_test.rb +17 -0
- data/test/unit/vagrant/util/retryable_test.rb +90 -34
- data/test/unit/vagrant_test.rb +27 -0
- data/test/{unit → unit_legacy}/locales/en.yml +0 -0
- data/test/{unit → unit_legacy}/test_helper.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/download_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/unpackage_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/verify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/env/set_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/validate_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/boot_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_accessible_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_box_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_guest_additions_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clean_machine_folder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_nfs_exports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_shared_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/customize_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/discard_state_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/export_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/halt_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/host_name_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/import_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/match_mac_address_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/modify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/network_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_vagrantfile_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provision_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provisioner_cleanup_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/resume_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/share_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/suspend_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action_test.rb +0 -0
- data/test/unit_legacy/vagrant/box_collection_test.rb +45 -0
- data/test/unit_legacy/vagrant/box_test.rb +74 -0
- data/test/{unit → unit_legacy}/vagrant/cli_test.rb +0 -0
- data/test/unit_legacy/vagrant/command/base_test.rb +23 -0
- data/test/{unit → unit_legacy}/vagrant/command/group_base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/init_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/package_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/base_test.rb +52 -0
- data/test/{unit → unit_legacy}/vagrant/config/error_recorder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vagrant_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vm/provisioner_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/vm_test.rb +47 -0
- data/test/unit_legacy/vagrant/config_test.rb +148 -0
- data/test/unit_legacy/vagrant/downloaders/http_test.rb +93 -0
- data/test/unit_legacy/vagrant/environment_test.rb +539 -0
- data/test/{unit → unit_legacy}/vagrant/errors_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/bsd_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/plugin_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_client_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_solo_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_server_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/shell_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh/session_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/busy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/counter_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/platform_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/stacked_proc_runner_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/template_renderer_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/vm_test.rb +0 -0
- data/vagrant.gemspec +7 -9
- metadata +183 -179
- data/keys/vagrant.ppk +0 -26
- data/lib/vagrant/action/box.rb +0 -11
- data/lib/vagrant/action/env.rb +0 -7
- data/lib/vagrant/action/general.rb +0 -8
- data/lib/vagrant/action/vm/forward_ports_helpers.rb +0 -28
- data/lib/vagrant/action/vm/modify.rb +0 -37
- data/lib/vagrant/action/vm/nfs_helpers.rb +0 -11
- data/lib/vagrant/action/vm.rb +0 -34
- data/lib/vagrant/command/group_base.rb +0 -107
- data/lib/vagrant/command/helpers.rb +0 -33
- data/lib/vagrant/command/named_base.rb +0 -14
- data/lib/vagrant/command/upgrade_to_060.rb +0 -45
- data/lib/vagrant/command/version.rb +0 -13
- data/lib/vagrant/ssh/session.rb +0 -136
- data/lib/vagrant/systems/arch.rb +0 -34
- data/lib/vagrant/systems/debian.rb +0 -36
- data/lib/vagrant/systems/gentoo.rb +0 -27
- data/lib/vagrant/systems/linux/error.rb +0 -9
- data/lib/vagrant/systems/linux.rb +0 -82
- data/lib/vagrant/systems/redhat.rb +0 -48
- data/lib/vagrant/systems/solaris.rb +0 -113
- data/lib/vagrant/systems/ubuntu.rb +0 -17
- data/lib/vagrant/systems.rb +0 -13
- data/templates/network_entry_arch.erb +0 -9
- data/templates/network_entry_debian.erb +0 -8
- data/templates/network_entry_gentoo.erb +0 -5
- data/templates/network_entry_redhat.erb +0 -9
- data/test/unit/vagrant/ui_test.rb +0 -29
@@ -1,52 +1,29 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Provisioners
|
3
3
|
# The base class for a "provisioner." A provisioner is responsible for
|
4
|
-
# provisioning a Vagrant system.
|
5
|
-
#
|
6
|
-
#
|
4
|
+
# provisioning a Vagrant system.
|
5
|
+
#
|
6
|
+
# This has been abstracted out so it is easy to provide support for
|
7
|
+
# multiple solutions.
|
7
8
|
class Base
|
8
9
|
include Vagrant::Util
|
9
10
|
|
10
|
-
# The environment which provisioner is running in. This is
|
11
|
-
#
|
12
|
-
attr_reader :
|
11
|
+
# The environment which provisioner is running in. This is the
|
12
|
+
# action environment, not a Vagrant::Environment.
|
13
|
+
attr_reader :env
|
13
14
|
|
14
15
|
# The configuration for this provisioner. This will be an instance of
|
15
16
|
# the `Config` class which is part of the provisioner.
|
16
17
|
attr_reader :config
|
17
18
|
|
18
|
-
# Registers a provisioner with a given shortcut. This allows that provisioner
|
19
|
-
# to be referenced with the shortcut.
|
20
|
-
#
|
21
|
-
# @param [Symbol] shortcut
|
22
|
-
def self.register(shortcut)
|
23
|
-
registered[shortcut] = self
|
24
|
-
end
|
25
|
-
|
26
|
-
# Returns the provisioner associated with the given shortcut.
|
27
|
-
def self.registered
|
28
|
-
@@registered ||= {}
|
29
|
-
end
|
30
|
-
|
31
19
|
def initialize(env, config)
|
32
|
-
@
|
20
|
+
@env = env
|
33
21
|
@config = config
|
34
22
|
end
|
35
23
|
|
36
|
-
#
|
37
|
-
#
|
38
|
-
|
39
|
-
# @return [Vagrant::Environment]
|
40
|
-
def env
|
41
|
-
action_env.env
|
42
|
-
end
|
43
|
-
|
44
|
-
# Returns the VM which this provisioner is working on.
|
45
|
-
#
|
46
|
-
# @return [Vagrant::VM]
|
47
|
-
def vm
|
48
|
-
env.vm
|
49
|
-
end
|
24
|
+
# This method is expected to return a class that is used for configuration
|
25
|
+
# for the provisioner.
|
26
|
+
def self.config_class; end
|
50
27
|
|
51
28
|
# This is the method called to "prepare" the provisioner. This is called
|
52
29
|
# before any actions are run by the action runner (see {Vagrant::Actions::Runner}).
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
1
3
|
module Vagrant
|
2
4
|
module Provisioners
|
3
5
|
# This class is a base class where the common functionality shared between
|
@@ -17,11 +19,12 @@ module Vagrant
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def verify_binary(binary)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
# Checks for the existence of chef binary and error if it
|
23
|
+
# doesn't exist.
|
24
|
+
env[:vm].channel.sudo("which #{binary}",
|
25
|
+
:error_class => ChefError,
|
26
|
+
:error_key => :chef_not_detected,
|
27
|
+
:binary => binary)
|
25
28
|
end
|
26
29
|
|
27
30
|
# Returns the path to the Chef binary, taking into account the
|
@@ -32,10 +35,8 @@ module Vagrant
|
|
32
35
|
end
|
33
36
|
|
34
37
|
def chown_provisioning_folder
|
35
|
-
vm.
|
36
|
-
|
37
|
-
ssh.sudo!("chown #{env.config.ssh.username} #{config.provisioning_path}")
|
38
|
-
end
|
38
|
+
env[:vm].channel.sudo("mkdir -p #{config.provisioning_path}")
|
39
|
+
env[:vm].channel.sudo("chown #{env[:vm].config.ssh.username} #{config.provisioning_path}")
|
39
40
|
end
|
40
41
|
|
41
42
|
def setup_config(template, filename, template_vars)
|
@@ -50,17 +51,23 @@ module Vagrant
|
|
50
51
|
:no_proxy => config.no_proxy
|
51
52
|
}.merge(template_vars))
|
52
53
|
|
53
|
-
|
54
|
+
# Create a temporary file to store the data so we
|
55
|
+
# can upload it
|
56
|
+
temp = Tempfile.new("vagrant")
|
57
|
+
temp.write(config_file)
|
58
|
+
temp.close
|
59
|
+
|
60
|
+
env[:vm].channel.upload(temp.path, File.join(config.provisioning_path, filename))
|
54
61
|
end
|
55
62
|
|
56
63
|
def setup_json
|
57
|
-
env
|
64
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.json")
|
58
65
|
|
59
66
|
# Set up our configuration that is passed to the attributes by default
|
60
|
-
data = { :config => env.
|
67
|
+
data = { :config => env[:global_config].to_hash }
|
61
68
|
|
62
69
|
# Add our default share directory if it exists
|
63
|
-
default_share = env.config.vm.shared_folders["v-root"]
|
70
|
+
default_share = env[:vm].config.vm.shared_folders["v-root"]
|
64
71
|
data[:directory] = default_share[:guestpath] if default_share
|
65
72
|
|
66
73
|
# And wrap it under the "vagrant" namespace
|
@@ -72,7 +79,13 @@ module Vagrant
|
|
72
79
|
|
73
80
|
json = data.to_json
|
74
81
|
|
75
|
-
|
82
|
+
# Create a temporary file to store the data so we
|
83
|
+
# can upload it
|
84
|
+
temp = Tempfile.new("vagrant")
|
85
|
+
temp.write(json)
|
86
|
+
temp.close
|
87
|
+
|
88
|
+
env[:vm].channel.upload(temp.path, File.join(config.provisioning_path, "dna.json"))
|
76
89
|
end
|
77
90
|
end
|
78
91
|
|
@@ -99,22 +112,13 @@ module Vagrant
|
|
99
112
|
attr_accessor :no_proxy
|
100
113
|
attr_accessor :binary_path
|
101
114
|
attr_accessor :binary_env
|
115
|
+
attr_accessor :attempts
|
102
116
|
attr_writer :run_list
|
103
117
|
|
104
118
|
def initialize
|
105
|
-
@
|
106
|
-
@log_level = :info
|
119
|
+
@attempts = 1
|
107
120
|
@json = {}
|
108
|
-
@
|
109
|
-
@http_proxy_user = nil
|
110
|
-
@http_proxy_pass = nil
|
111
|
-
@https_proxy = nil
|
112
|
-
@https_proxy_user = nil
|
113
|
-
@https_proxy_pass = nil
|
114
|
-
@no_proxy = nil
|
115
|
-
@binary_path = nil
|
116
|
-
@binary_env = nil
|
117
|
-
@run_list = nil
|
121
|
+
@log_level = :info
|
118
122
|
end
|
119
123
|
|
120
124
|
# This returns the json that is merged with the defaults and the
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
|
3
|
+
require 'vagrant/provisioners/chef'
|
4
|
+
|
3
5
|
module Vagrant
|
4
6
|
module Provisioners
|
5
7
|
# This class implements provisioning via chef-client, allowing provisioning
|
6
8
|
# with a chef server.
|
7
9
|
class ChefClient < Chef
|
8
|
-
register :chef_client
|
9
|
-
|
10
10
|
class Config < Chef::Config
|
11
11
|
attr_accessor :chef_server_url
|
12
12
|
attr_accessor :validation_key_path
|
@@ -25,11 +25,10 @@ module Vagrant
|
|
25
25
|
@client_key_path = "/etc/chef/client.pem"
|
26
26
|
@file_cache_path = "/srv/chef/file_store"
|
27
27
|
@file_backup_path = "/srv/chef/cache"
|
28
|
-
@encrypted_data_bag_secret_key_path = nil
|
29
28
|
@encrypted_data_bag_secret = "/tmp/encrypted_data_bag_secret"
|
30
29
|
end
|
31
30
|
|
32
|
-
def validate(errors)
|
31
|
+
def validate(env, errors)
|
33
32
|
super
|
34
33
|
|
35
34
|
errors.add(I18n.t("vagrant.config.chef.server_url_empty")) if !chef_server_url || chef_server_url.strip == ""
|
@@ -38,6 +37,10 @@ module Vagrant
|
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
40
|
+
def self.config_class
|
41
|
+
Config
|
42
|
+
end
|
43
|
+
|
41
44
|
def prepare
|
42
45
|
raise ChefError, :server_validation_key_required if config.validation_key_path.nil?
|
43
46
|
raise ChefError, :server_validation_key_doesnt_exist if !File.file?(validation_key_path)
|
@@ -56,26 +59,25 @@ module Vagrant
|
|
56
59
|
end
|
57
60
|
|
58
61
|
def create_client_key_folder
|
59
|
-
env
|
62
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.client_key_folder")
|
60
63
|
path = Pathname.new(config.client_key_path)
|
61
64
|
|
62
|
-
vm.
|
63
|
-
ssh.sudo!("mkdir -p #{path.dirname}")
|
64
|
-
end
|
65
|
+
env[:vm].channel.sudo("mkdir -p #{path.dirname}")
|
65
66
|
end
|
66
67
|
|
67
68
|
def upload_validation_key
|
68
|
-
env
|
69
|
-
vm.
|
69
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.upload_validation_key")
|
70
|
+
env[:vm].channel.upload(validation_key_path, guest_validation_key_path)
|
70
71
|
end
|
71
72
|
|
72
73
|
def upload_encrypted_data_bag_secret
|
73
|
-
env
|
74
|
-
vm.
|
74
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.upload_encrypted_data_bag_secret_key")
|
75
|
+
env[:vm].channel.upload(encrypted_data_bag_secret_key_path,
|
76
|
+
config.encrypted_data_bag_secret)
|
75
77
|
end
|
76
78
|
|
77
79
|
def setup_server_config
|
78
|
-
setup_config("
|
80
|
+
setup_config("provisioners/chef_client/client", "client.rb", {
|
79
81
|
:node_name => config.node_name,
|
80
82
|
:chef_server_url => config.chef_server_url,
|
81
83
|
:validation_client_name => config.validation_client_name,
|
@@ -92,24 +94,36 @@ module Vagrant
|
|
92
94
|
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
93
95
|
command = "#{command_env}#{chef_binary_path("chef-client")} -c #{config.provisioning_path}/client.rb -j #{config.provisioning_path}/dna.json"
|
94
96
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
else
|
101
|
-
env.ui.info("#{data}: #{type}")
|
102
|
-
end
|
97
|
+
config.attempts.times do |attempt|
|
98
|
+
if attempt == 0
|
99
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.running_client")
|
100
|
+
else
|
101
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.running_client_again")
|
103
102
|
end
|
103
|
+
|
104
|
+
exit_status = env[:vm].channel.sudo(command) do |type, data|
|
105
|
+
# Output the data with the proper color based on the stream.
|
106
|
+
color = type == :stdout ? :green : :red
|
107
|
+
|
108
|
+
# Note: Be sure to chomp the data to avoid the newlines that the
|
109
|
+
# Chef outputs.
|
110
|
+
env[:ui].info(data.chomp, :color => color, :prefix => false)
|
111
|
+
end
|
112
|
+
|
113
|
+
# There is no need to run Chef again if it converges
|
114
|
+
return if exit_status == 0
|
104
115
|
end
|
116
|
+
|
117
|
+
# If we reached this point then Chef never converged! Error.
|
118
|
+
raise ChefError, :no_convergence
|
105
119
|
end
|
106
120
|
|
107
121
|
def validation_key_path
|
108
|
-
File.expand_path(config.validation_key_path, env
|
122
|
+
File.expand_path(config.validation_key_path, env[:root_path])
|
109
123
|
end
|
110
124
|
|
111
125
|
def encrypted_data_bag_secret_key_path
|
112
|
-
File.expand_path(config.encrypted_data_bag_secret_key_path, env
|
126
|
+
File.expand_path(config.encrypted_data_bag_secret_key_path, env[:root_path])
|
113
127
|
end
|
114
128
|
|
115
129
|
def guest_validation_key_path
|
@@ -1,9 +1,11 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
require 'vagrant/provisioners/chef'
|
4
|
+
|
1
5
|
module Vagrant
|
2
6
|
module Provisioners
|
3
7
|
# This class implements provisioning via chef-solo.
|
4
8
|
class ChefSolo < Chef
|
5
|
-
register :chef_solo
|
6
|
-
|
7
9
|
extend Util::Counter
|
8
10
|
include Util::Counter
|
9
11
|
|
@@ -18,12 +20,10 @@ module Vagrant
|
|
18
20
|
super
|
19
21
|
|
20
22
|
@cookbooks_path = ["cookbooks", [:vm, "cookbooks"]]
|
21
|
-
@roles_path = nil
|
22
|
-
@data_bags_path = nil
|
23
23
|
@nfs = false
|
24
24
|
end
|
25
25
|
|
26
|
-
def validate(errors)
|
26
|
+
def validate(env, errors)
|
27
27
|
super
|
28
28
|
|
29
29
|
errors.add(I18n.t("vagrant.config.chef.cookbooks_path_empty")) if !cookbooks_path || [cookbooks_path].flatten.empty?
|
@@ -35,6 +35,15 @@ module Vagrant
|
|
35
35
|
attr_reader :role_folders
|
36
36
|
attr_reader :data_bags_folders
|
37
37
|
|
38
|
+
def self.config_class
|
39
|
+
Config
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(env, config)
|
43
|
+
super
|
44
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::chef_solo")
|
45
|
+
end
|
46
|
+
|
38
47
|
def prepare
|
39
48
|
@cookbook_folders = expanded_folders(config.cookbooks_path, "cookbooks")
|
40
49
|
@role_folders = expanded_folders(config.roles_path, "roles")
|
@@ -46,6 +55,19 @@ module Vagrant
|
|
46
55
|
end
|
47
56
|
|
48
57
|
def provision!
|
58
|
+
# Verify that the proper shared folders exist.
|
59
|
+
check = []
|
60
|
+
[@cookbook_folders, @role_folders, @data_bags_folders].each do |folders|
|
61
|
+
folders.each do |type, local_path, remote_path|
|
62
|
+
# We only care about checking folders that have a local path, meaning
|
63
|
+
# they were shared from the local machine, rather than assumed to
|
64
|
+
# exist on the VM.
|
65
|
+
check << remote_path if local_path
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
verify_shared_folders(check)
|
70
|
+
|
49
71
|
verify_binary(chef_binary_path("chef-solo"))
|
50
72
|
chown_provisioning_folder
|
51
73
|
setup_json
|
@@ -68,7 +90,7 @@ module Vagrant
|
|
68
90
|
# Create the local/remote path based on whether this is a host
|
69
91
|
# or VM path.
|
70
92
|
local_path = nil
|
71
|
-
local_path = File.expand_path(path, env
|
93
|
+
local_path = File.expand_path(path, env[:root_path]) if type == :host
|
72
94
|
remote_path = nil
|
73
95
|
if type == :host
|
74
96
|
# Path exists on the host, setup the remote path
|
@@ -98,7 +120,7 @@ module Vagrant
|
|
98
120
|
def share_folders(prefix, folders)
|
99
121
|
folders.each do |type, local_path, remote_path|
|
100
122
|
if type == :host
|
101
|
-
env.config.vm.share_folder("v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}",
|
123
|
+
env[:vm].config.vm.share_folder("v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}",
|
102
124
|
remote_path, local_path, :nfs => config.nfs)
|
103
125
|
end
|
104
126
|
end
|
@@ -109,7 +131,7 @@ module Vagrant
|
|
109
131
|
roles_path = guest_paths(@role_folders).first
|
110
132
|
data_bags_path = guest_paths(@data_bags_folders).first
|
111
133
|
|
112
|
-
setup_config("
|
134
|
+
setup_config("provisioners/chef_solo/solo", "solo.rb", {
|
113
135
|
:node_name => config.node_name,
|
114
136
|
:provisioning_path => config.provisioning_path,
|
115
137
|
:cookbooks_path => cookbooks_path,
|
@@ -123,18 +145,41 @@ module Vagrant
|
|
123
145
|
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
124
146
|
command = "#{command_env}#{chef_binary_path("chef-solo")} -c #{config.provisioning_path}/solo.rb -j #{config.provisioning_path}/dna.json"
|
125
147
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
148
|
+
config.attempts.times do |attempt|
|
149
|
+
if attempt == 0
|
150
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.running_solo")
|
151
|
+
else
|
152
|
+
env[:ui].info I18n.t("vagrant.provisioners.chef.running_solo_again")
|
153
|
+
end
|
154
|
+
|
155
|
+
exit_status = env[:vm].channel.sudo(command, :error_check => false) do |type, data|
|
156
|
+
# Output the data with the proper color based on the stream.
|
157
|
+
color = type == :stdout ? :green : :red
|
158
|
+
|
159
|
+
# Note: Be sure to chomp the data to avoid the newlines that the
|
160
|
+
# Chef outputs.
|
161
|
+
env[:ui].info(data.chomp, :color => color, :prefix => false)
|
134
162
|
end
|
163
|
+
|
164
|
+
# There is no need to run Chef again if it converges
|
165
|
+
return if exit_status == 0
|
135
166
|
end
|
167
|
+
|
168
|
+
# If we reached this point then Chef never converged! Error.
|
169
|
+
raise ChefError, :no_convergence
|
136
170
|
end
|
137
171
|
|
172
|
+
def verify_shared_folders(folders)
|
173
|
+
folders.each do |folder|
|
174
|
+
@logger.debug("Checking for shared folder: #{folder}")
|
175
|
+
if !env[:vm].channel.test("test -d #{folder}")
|
176
|
+
raise ChefError, :missing_shared_folders
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
protected
|
182
|
+
|
138
183
|
# Extracts only the remote paths from a list of folders
|
139
184
|
def guest_paths(folders)
|
140
185
|
folders.map { |parts| parts[2] }
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
1
3
|
module Vagrant
|
2
4
|
module Provisioners
|
3
5
|
class PuppetError < Vagrant::Errors::VagrantError
|
@@ -5,8 +7,6 @@ module Vagrant
|
|
5
7
|
end
|
6
8
|
|
7
9
|
class Puppet < Base
|
8
|
-
register :puppet
|
9
|
-
|
10
10
|
class Config < Vagrant::Config::Base
|
11
11
|
attr_accessor :manifest_file
|
12
12
|
attr_accessor :manifests_path
|
@@ -15,28 +15,21 @@ module Vagrant
|
|
15
15
|
attr_accessor :options
|
16
16
|
|
17
17
|
def initialize
|
18
|
-
@manifest_file =
|
18
|
+
@manifest_file = "default.pp"
|
19
19
|
@manifests_path = "manifests"
|
20
|
-
@module_path = nil
|
21
20
|
@pp_path = "/tmp/vagrant-puppet"
|
22
21
|
@options = []
|
23
22
|
end
|
24
23
|
|
25
24
|
# Returns the manifests path expanded relative to the root path of the
|
26
25
|
# environment.
|
27
|
-
def expanded_manifests_path
|
28
|
-
Pathname.new(manifests_path).expand_path(
|
29
|
-
end
|
30
|
-
|
31
|
-
# Returns the manifest file if set otherwise returns the box name pp file
|
32
|
-
# which may or may not exist.
|
33
|
-
def computed_manifest_file
|
34
|
-
manifest_file || "#{top.vm.box}.pp"
|
26
|
+
def expanded_manifests_path(root_path)
|
27
|
+
Pathname.new(manifests_path).expand_path(root_path)
|
35
28
|
end
|
36
29
|
|
37
30
|
# Returns the module paths as an array of paths expanded relative to the
|
38
31
|
# root path.
|
39
|
-
def expanded_module_paths
|
32
|
+
def expanded_module_paths(root_path)
|
40
33
|
return [] if !module_path
|
41
34
|
|
42
35
|
# Get all the paths and expand them relative to the root path, returning
|
@@ -44,24 +37,29 @@ module Vagrant
|
|
44
37
|
paths = module_path
|
45
38
|
paths = [paths] if !paths.is_a?(Array)
|
46
39
|
paths.map do |path|
|
47
|
-
Pathname.new(path).expand_path(
|
40
|
+
Pathname.new(path).expand_path(root_path)
|
48
41
|
end
|
49
42
|
end
|
50
43
|
|
51
|
-
def validate(errors)
|
52
|
-
|
44
|
+
def validate(env, errors)
|
45
|
+
# Calculate the manifests and module paths based on env
|
46
|
+
this_expanded_manifests_path = expanded_manifests_path(env.root_path)
|
47
|
+
this_expanded_module_paths = expanded_module_paths(env.root_path)
|
53
48
|
|
54
49
|
# Manifests path/file validation
|
55
|
-
if !
|
56
|
-
errors.add(I18n.t("vagrant.provisioners.puppet.manifests_path_missing",
|
50
|
+
if !this_expanded_manifests_path.directory?
|
51
|
+
errors.add(I18n.t("vagrant.provisioners.puppet.manifests_path_missing",
|
52
|
+
:path => this_expanded_manifests_path))
|
57
53
|
else
|
58
|
-
|
59
|
-
|
54
|
+
expanded_manifest_file = this_expanded_manifests_path.join(manifest_file)
|
55
|
+
if !expanded_manifest_file.file?
|
56
|
+
errors.add(I18n.t("vagrant.provisioners.puppet.manifest_missing",
|
57
|
+
:manifest => expanded_manifest_file.to_s))
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
63
61
|
# Module paths validation
|
64
|
-
|
62
|
+
this_expanded_module_paths.each do |path|
|
65
63
|
if !path.directory?
|
66
64
|
errors.add(I18n.t("vagrant.provisioners.puppet.module_path_missing", :path => path))
|
67
65
|
end
|
@@ -69,19 +67,43 @@ module Vagrant
|
|
69
67
|
end
|
70
68
|
end
|
71
69
|
|
70
|
+
def self.config_class
|
71
|
+
Config
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize(env, config)
|
75
|
+
super
|
76
|
+
|
77
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::puppet")
|
78
|
+
end
|
79
|
+
|
72
80
|
def prepare
|
81
|
+
# Calculate the paths we're going to use based on the environment
|
82
|
+
@expanded_manifests_path = config.expanded_manifests_path(env[:root_path])
|
83
|
+
@expanded_module_paths = config.expanded_module_paths(env[:root_path])
|
84
|
+
@manifest_file = File.join(manifests_guest_path, config.manifest_file)
|
85
|
+
|
73
86
|
set_module_paths
|
74
87
|
share_manifests
|
75
88
|
share_module_paths
|
76
89
|
end
|
77
90
|
|
78
91
|
def provision!
|
92
|
+
# Check that the shared folders are properly shared
|
93
|
+
check = [manifests_guest_path]
|
94
|
+
@module_paths.each do |host_path, guest_path|
|
95
|
+
check << guest_path
|
96
|
+
end
|
97
|
+
|
98
|
+
verify_shared_folders(check)
|
99
|
+
|
100
|
+
# Verify Puppet is installed and run it
|
79
101
|
verify_binary("puppet")
|
80
102
|
run_puppet_client
|
81
103
|
end
|
82
104
|
|
83
105
|
def share_manifests
|
84
|
-
env.config.vm.share_folder("manifests", manifests_guest_path,
|
106
|
+
env[:vm].config.vm.share_folder("manifests", manifests_guest_path, @expanded_manifests_path)
|
85
107
|
end
|
86
108
|
|
87
109
|
def share_module_paths
|
@@ -89,14 +111,14 @@ module Vagrant
|
|
89
111
|
@module_paths.each do |from, to|
|
90
112
|
# Sorry for the cryptic key here, but VirtualBox has a strange limit on
|
91
113
|
# maximum size for it and its something small (around 10)
|
92
|
-
env.config.vm.share_folder("v-pp-m#{count}", to, from)
|
114
|
+
env[:vm].config.vm.share_folder("v-pp-m#{count}", to, from)
|
93
115
|
count += 1
|
94
116
|
end
|
95
117
|
end
|
96
118
|
|
97
119
|
def set_module_paths
|
98
120
|
@module_paths = {}
|
99
|
-
|
121
|
+
@expanded_module_paths.each_with_index do |path, i|
|
100
122
|
@module_paths[path] = File.join(config.pp_path, "modules-#{i}")
|
101
123
|
end
|
102
124
|
end
|
@@ -106,32 +128,42 @@ module Vagrant
|
|
106
128
|
end
|
107
129
|
|
108
130
|
def verify_binary(binary)
|
109
|
-
vm.
|
110
|
-
|
111
|
-
|
131
|
+
env[:vm].channel.sudo("which #{binary}",
|
132
|
+
:error_class => PuppetError,
|
133
|
+
:error_key => :puppet_not_detected,
|
134
|
+
:binary => binary)
|
112
135
|
end
|
113
136
|
|
114
137
|
def run_puppet_client
|
115
138
|
options = [config.options].flatten
|
116
139
|
options << "--modulepath '#{@module_paths.values.join(':')}'" if !@module_paths.empty?
|
117
|
-
options <<
|
140
|
+
options << @manifest_file
|
118
141
|
options = options.join(" ")
|
119
142
|
|
120
|
-
|
121
|
-
"puppet apply #{options}"]
|
143
|
+
command = "cd #{manifests_guest_path} && puppet apply #{options}"
|
122
144
|
|
123
|
-
env
|
145
|
+
env[:ui].info I18n.t("vagrant.provisioners.puppet.running_puppet",
|
146
|
+
:manifest => @manifest_file)
|
124
147
|
|
125
|
-
vm.
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
148
|
+
env[:vm].channel.sudo(command) do |type, data|
|
149
|
+
# Output the data with the proper color based on the stream.
|
150
|
+
color = type == :stdout ? :green : :red
|
151
|
+
|
152
|
+
# Note: Be sure to chomp the data to avoid the newlines that the
|
153
|
+
# Chef outputs.
|
154
|
+
env[:ui].info(data.chomp, :color => color, :prefix => false)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def verify_shared_folders(folders)
|
159
|
+
folders.each do |folder|
|
160
|
+
@logger.debug("Checking for shared folder: #{folder}")
|
161
|
+
if !env[:vm].channel.test("test -d #{folder}")
|
162
|
+
raise PuppetError, :missing_shared_folders
|
132
163
|
end
|
133
164
|
end
|
134
165
|
end
|
135
166
|
end
|
136
167
|
end
|
137
168
|
end
|
169
|
+
|