vagrant-lxc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +29 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/.vimrc +1 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +89 -0
- data/Guardfile +34 -0
- data/LICENSE.txt +22 -0
- data/README.md +209 -0
- data/Rakefile +5 -0
- data/bin/vagrant-lxc +9 -0
- data/boxes/quantal64/download-ubuntu +103 -0
- data/boxes/quantal64/lxc-template +567 -0
- data/boxes/quantal64/metadata.json +9 -0
- data/development/Vagrantfile.1.0 +35 -0
- data/development/Vagrantfile.1.1 +55 -0
- data/development/lxc-configs/lxc-dev-box +37 -0
- data/development/lxc-configs/vbox +37 -0
- data/development/shell-provisioning/upgrade-kernel +14 -0
- data/development/site.pp +125 -0
- data/example/Vagrantfile +42 -0
- data/example/puppet/manifests/site.pp +5 -0
- data/example/puppet/modules/hello_world/manifests/init.pp +3 -0
- data/lib/vagrant-lxc.rb +6 -0
- data/lib/vagrant-lxc/action.rb +188 -0
- data/lib/vagrant-lxc/action/base_action.rb +11 -0
- data/lib/vagrant-lxc/action/boot.rb +55 -0
- data/lib/vagrant-lxc/action/check_created.rb +17 -0
- data/lib/vagrant-lxc/action/check_running.rb +17 -0
- data/lib/vagrant-lxc/action/create.rb +14 -0
- data/lib/vagrant-lxc/action/created.rb +16 -0
- data/lib/vagrant-lxc/action/destroy.rb +14 -0
- data/lib/vagrant-lxc/action/forced_halt.rb +22 -0
- data/lib/vagrant-lxc/action/handle_box_metadata.rb +47 -0
- data/lib/vagrant-lxc/action/is_running.rb +15 -0
- data/lib/vagrant-lxc/action/network.rb +21 -0
- data/lib/vagrant-lxc/action/share_folders.rb +65 -0
- data/lib/vagrant-lxc/config.rb +14 -0
- data/lib/vagrant-lxc/container.rb +170 -0
- data/lib/vagrant-lxc/container/cli.rb +124 -0
- data/lib/vagrant-lxc/errors.rb +12 -0
- data/lib/vagrant-lxc/machine_state.rb +25 -0
- data/lib/vagrant-lxc/plugin.rb +23 -0
- data/lib/vagrant-lxc/provider.rb +74 -0
- data/lib/vagrant-lxc/version.rb +5 -0
- data/lib/vendored_vagrant.rb +9 -0
- data/locales/en.yml +17 -0
- data/spec/fixtures/sample-arp-output +4 -0
- data/spec/fixtures/sample-config +47 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/support/unit_example_group.rb +28 -0
- data/spec/unit/action/handle_box_metadata_spec.rb +44 -0
- data/spec/unit/container/cli_spec.rb +148 -0
- data/spec/unit/container_spec.rb +151 -0
- data/spec/unit/machine_state_spec.rb +39 -0
- data/spec/unit_helper.rb +9 -0
- data/tasks/boxes.rake +17 -0
- data/tasks/spec.rake +30 -0
- data/vagrant-lxc.gemspec +32 -0
- data/vendor/.gitkeep +0 -0
- data/vendor/vagrant/.gitignore +31 -0
- data/vendor/vagrant/.travis.yml +7 -0
- data/vendor/vagrant/.yardopts +1 -0
- data/vendor/vagrant/CHANGELOG.md +803 -0
- data/vendor/vagrant/Gemfile +3 -0
- data/vendor/vagrant/LICENSE +21 -0
- data/vendor/vagrant/README.md +89 -0
- data/vendor/vagrant/Rakefile +18 -0
- data/vendor/vagrant/bin/vagrant +84 -0
- data/vendor/vagrant/config/default.rb +35 -0
- data/vendor/vagrant/contrib/README.md +12 -0
- data/vendor/vagrant/contrib/bash/completion.sh +3 -0
- data/vendor/vagrant/contrib/emacs/vagrant.el +8 -0
- data/vendor/vagrant/contrib/vim/vagrantfile.vim +9 -0
- data/vendor/vagrant/keys/README.md +17 -0
- data/vendor/vagrant/keys/vagrant +27 -0
- data/vendor/vagrant/keys/vagrant.pub +1 -0
- data/vendor/vagrant/lib/vagrant.rb +251 -0
- data/vendor/vagrant/lib/vagrant/action.rb +42 -0
- data/vendor/vagrant/lib/vagrant/action/builder.rb +154 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/box_add.rb +79 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/call.rb +67 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/config_validate.rb +30 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/confirm.rb +38 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/env_set.rb +24 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/graceful_halt.rb +73 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/handle_box_url.rb +43 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +117 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/lock.rb +57 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/nfs.rb +117 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/provision.rb +70 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/set_hostname.rb +27 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/ssh_exec.rb +42 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/ssh_run.rb +43 -0
- data/vendor/vagrant/lib/vagrant/action/general/package.rb +102 -0
- data/vendor/vagrant/lib/vagrant/action/hook.rb +103 -0
- data/vendor/vagrant/lib/vagrant/action/runner.rb +69 -0
- data/vendor/vagrant/lib/vagrant/action/warden.rb +103 -0
- data/vendor/vagrant/lib/vagrant/box.rb +93 -0
- data/vendor/vagrant/lib/vagrant/box_collection.rb +315 -0
- data/vendor/vagrant/lib/vagrant/cli.rb +82 -0
- data/vendor/vagrant/lib/vagrant/config.rb +63 -0
- data/vendor/vagrant/lib/vagrant/config/container.rb +37 -0
- data/vendor/vagrant/lib/vagrant/config/loader.rb +222 -0
- data/vendor/vagrant/lib/vagrant/config/v1.rb +9 -0
- data/vendor/vagrant/lib/vagrant/config/v1/dummy_config.rb +13 -0
- data/vendor/vagrant/lib/vagrant/config/v1/loader.rb +105 -0
- data/vendor/vagrant/lib/vagrant/config/v1/root.rb +60 -0
- data/vendor/vagrant/lib/vagrant/config/v2.rb +9 -0
- data/vendor/vagrant/lib/vagrant/config/v2/dummy_config.rb +13 -0
- data/vendor/vagrant/lib/vagrant/config/v2/loader.rb +141 -0
- data/vendor/vagrant/lib/vagrant/config/v2/root.rb +105 -0
- data/vendor/vagrant/lib/vagrant/config/v2/util.rb +21 -0
- data/vendor/vagrant/lib/vagrant/config/version_base.rb +80 -0
- data/vendor/vagrant/lib/vagrant/downloaders.rb +7 -0
- data/vendor/vagrant/lib/vagrant/downloaders/base.rb +22 -0
- data/vendor/vagrant/lib/vagrant/downloaders/file.rb +28 -0
- data/vendor/vagrant/lib/vagrant/downloaders/http.rb +116 -0
- data/vendor/vagrant/lib/vagrant/environment.rb +729 -0
- data/vendor/vagrant/lib/vagrant/errors.rb +486 -0
- data/vendor/vagrant/lib/vagrant/hosts.rb +28 -0
- data/vendor/vagrant/lib/vagrant/machine.rb +325 -0
- data/vendor/vagrant/lib/vagrant/machine_state.rb +45 -0
- data/vendor/vagrant/lib/vagrant/plugin.rb +6 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1.rb +19 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/command.rb +169 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/communicator.rb +98 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/config.rb +112 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/errors.rb +15 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/guest.rb +92 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/host.rb +66 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/manager.rb +131 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/plugin.rb +229 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/provider.rb +68 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/provisioner.rb +50 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2.rb +22 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/command.rb +234 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/communicator.rb +98 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/components.rb +29 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/config.rb +101 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/errors.rb +15 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/guest.rb +92 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/host.rb +66 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/manager.rb +158 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/plugin.rb +217 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/provider.rb +69 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/provisioner.rb +47 -0
- data/vendor/vagrant/lib/vagrant/registry.rb +78 -0
- data/vendor/vagrant/lib/vagrant/ssh.rb +132 -0
- data/vendor/vagrant/lib/vagrant/test_helpers.rb +154 -0
- data/vendor/vagrant/lib/vagrant/ui.rb +170 -0
- data/vendor/vagrant/lib/vagrant/util.rb +12 -0
- data/vendor/vagrant/lib/vagrant/util/ansi_escape_code_remover.rb +34 -0
- data/vendor/vagrant/lib/vagrant/util/busy.rb +59 -0
- data/vendor/vagrant/lib/vagrant/util/counter.rb +24 -0
- data/vendor/vagrant/lib/vagrant/util/file_checksum.rb +38 -0
- data/vendor/vagrant/lib/vagrant/util/file_mode.rb +12 -0
- data/vendor/vagrant/lib/vagrant/util/hash_with_indifferent_access.rb +63 -0
- data/vendor/vagrant/lib/vagrant/util/is_port_open.rb +38 -0
- data/vendor/vagrant/lib/vagrant/util/line_ending_helpers.rb +14 -0
- data/vendor/vagrant/lib/vagrant/util/network_ip.rb +28 -0
- data/vendor/vagrant/lib/vagrant/util/platform.rb +68 -0
- data/vendor/vagrant/lib/vagrant/util/retryable.rb +31 -0
- data/vendor/vagrant/lib/vagrant/util/safe_exec.rb +36 -0
- data/vendor/vagrant/lib/vagrant/util/safe_puts.rb +31 -0
- data/vendor/vagrant/lib/vagrant/util/scoped_hash_override.rb +45 -0
- data/vendor/vagrant/lib/vagrant/util/ssh.rb +126 -0
- data/vendor/vagrant/lib/vagrant/util/stacked_proc_runner.rb +35 -0
- data/vendor/vagrant/lib/vagrant/util/string_block_editor.rb +75 -0
- data/vendor/vagrant/lib/vagrant/util/subprocess.rb +270 -0
- data/vendor/vagrant/lib/vagrant/util/template_renderer.rb +83 -0
- data/vendor/vagrant/lib/vagrant/util/which.rb +43 -0
- data/vendor/vagrant/lib/vagrant/version.rb +6 -0
- data/vendor/vagrant/plugins/README.md +5 -0
- data/vendor/vagrant/plugins/commands/box/command/add.rb +52 -0
- data/vendor/vagrant/plugins/commands/box/command/list.rb +41 -0
- data/vendor/vagrant/plugins/commands/box/command/remove.rb +37 -0
- data/vendor/vagrant/plugins/commands/box/command/repackage.rb +43 -0
- data/vendor/vagrant/plugins/commands/box/command/root.rb +75 -0
- data/vendor/vagrant/plugins/commands/box/plugin.rb +15 -0
- data/vendor/vagrant/plugins/commands/destroy/command.rb +31 -0
- data/vendor/vagrant/plugins/commands/destroy/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/halt/command.rb +33 -0
- data/vendor/vagrant/plugins/commands/halt/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/init/command.rb +40 -0
- data/vendor/vagrant/plugins/commands/init/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/package/command.rb +78 -0
- data/vendor/vagrant/plugins/commands/package/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/plugin/action.rb +52 -0
- data/vendor/vagrant/plugins/commands/plugin/action/bundler_check.rb +25 -0
- data/vendor/vagrant/plugins/commands/plugin/action/install_gem.rb +70 -0
- data/vendor/vagrant/plugins/commands/plugin/action/license_plugin.rb +54 -0
- data/vendor/vagrant/plugins/commands/plugin/action/list_plugins.rb +54 -0
- data/vendor/vagrant/plugins/commands/plugin/action/prune_gems.rb +149 -0
- data/vendor/vagrant/plugins/commands/plugin/action/uninstall_plugin.rb +23 -0
- data/vendor/vagrant/plugins/commands/plugin/command/base.rb +22 -0
- data/vendor/vagrant/plugins/commands/plugin/command/install.rb +39 -0
- data/vendor/vagrant/plugins/commands/plugin/command/license.rb +31 -0
- data/vendor/vagrant/plugins/commands/plugin/command/list.rb +28 -0
- data/vendor/vagrant/plugins/commands/plugin/command/root.rb +75 -0
- data/vendor/vagrant/plugins/commands/plugin/command/uninstall.rb +28 -0
- data/vendor/vagrant/plugins/commands/plugin/gem_helper.rb +74 -0
- data/vendor/vagrant/plugins/commands/plugin/plugin.rb +22 -0
- data/vendor/vagrant/plugins/commands/plugin/state_file.rb +57 -0
- data/vendor/vagrant/plugins/commands/provision/command.rb +34 -0
- data/vendor/vagrant/plugins/commands/provision/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/reload/command.rb +37 -0
- data/vendor/vagrant/plugins/commands/reload/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/resume/command.rb +25 -0
- data/vendor/vagrant/plugins/commands/resume/plugin.rb +17 -0
- data/vendor/vagrant/plugins/commands/ssh/command.rb +66 -0
- data/vendor/vagrant/plugins/commands/ssh/plugin.rb +17 -0
- data/vendor/vagrant/plugins/commands/ssh_config/command.rb +49 -0
- data/vendor/vagrant/plugins/commands/ssh_config/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/status/command.rb +39 -0
- data/vendor/vagrant/plugins/commands/status/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/suspend/command.rb +25 -0
- data/vendor/vagrant/plugins/commands/suspend/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/up/command.rb +45 -0
- data/vendor/vagrant/plugins/commands/up/plugin.rb +17 -0
- data/vendor/vagrant/plugins/commands/up/start_mixins.rb +26 -0
- data/vendor/vagrant/plugins/communicators/ssh/communicator.rb +317 -0
- data/vendor/vagrant/plugins/communicators/ssh/plugin.rb +19 -0
- data/vendor/vagrant/plugins/guests/arch/guest.rb +41 -0
- data/vendor/vagrant/plugins/guests/arch/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/debian/guest.rb +72 -0
- data/vendor/vagrant/plugins/guests/debian/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/fedora/guest.rb +71 -0
- data/vendor/vagrant/plugins/guests/fedora/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/freebsd/config.rb +13 -0
- data/vendor/vagrant/plugins/guests/freebsd/guest.rb +70 -0
- data/vendor/vagrant/plugins/guests/freebsd/plugin.rb +20 -0
- data/vendor/vagrant/plugins/guests/gentoo/guest.rb +51 -0
- data/vendor/vagrant/plugins/guests/gentoo/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/linux/config.rb +13 -0
- data/vendor/vagrant/plugins/guests/linux/guest.rb +118 -0
- data/vendor/vagrant/plugins/guests/linux/plugin.rb +20 -0
- data/vendor/vagrant/plugins/guests/openbsd/guest.rb +13 -0
- data/vendor/vagrant/plugins/guests/openbsd/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/redhat/guest.rb +74 -0
- data/vendor/vagrant/plugins/guests/redhat/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/solaris/config.rb +18 -0
- data/vendor/vagrant/plugins/guests/solaris/guest.rb +73 -0
- data/vendor/vagrant/plugins/guests/solaris/plugin.rb +20 -0
- data/vendor/vagrant/plugins/guests/suse/guest.rb +24 -0
- data/vendor/vagrant/plugins/guests/suse/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/ubuntu/guest.rb +44 -0
- data/vendor/vagrant/plugins/guests/ubuntu/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/arch/host.rb +68 -0
- data/vendor/vagrant/plugins/hosts/arch/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/bsd/host.rb +102 -0
- data/vendor/vagrant/plugins/hosts/bsd/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/fedora/host.rb +51 -0
- data/vendor/vagrant/plugins/hosts/fedora/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/freebsd/host.rb +43 -0
- data/vendor/vagrant/plugins/hosts/freebsd/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/gentoo/host.rb +24 -0
- data/vendor/vagrant/plugins/hosts/gentoo/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/linux/host.rb +95 -0
- data/vendor/vagrant/plugins/hosts/linux/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/opensuse/host.rb +34 -0
- data/vendor/vagrant/plugins/hosts/opensuse/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/windows/host.rb +17 -0
- data/vendor/vagrant/plugins/hosts/windows/plugin.rb +15 -0
- data/vendor/vagrant/plugins/kernel_v1/config/nfs.rb +20 -0
- data/vendor/vagrant/plugins/kernel_v1/config/package.rb +17 -0
- data/vendor/vagrant/plugins/kernel_v1/config/ssh.rb +46 -0
- data/vendor/vagrant/plugins/kernel_v1/config/vagrant.rb +31 -0
- data/vendor/vagrant/plugins/kernel_v1/config/vm.rb +184 -0
- data/vendor/vagrant/plugins/kernel_v1/plugin.rb +44 -0
- data/vendor/vagrant/plugins/kernel_v2/config/nfs.rb +10 -0
- data/vendor/vagrant/plugins/kernel_v2/config/package.rb +9 -0
- data/vendor/vagrant/plugins/kernel_v2/config/ssh.rb +35 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vagrant.rb +9 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vm.rb +314 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vm_provisioner.rb +40 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vm_subvm.rb +30 -0
- data/vendor/vagrant/plugins/kernel_v2/plugin.rb +44 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action.rb +308 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/boot.rb +49 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_accessible.rb +23 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_created.rb +21 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_guest_additions.rb +45 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_running.rb +21 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_virtualbox.rb +22 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clean_machine_folder.rb +43 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clear_forwarded_ports.rb +18 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clear_network_interfaces.rb +31 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clear_shared_folders.rb +17 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/created.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/customize.rb +36 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/destroy.rb +19 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/destroy_confirm.rb +17 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb +16 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/discard_state.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/export.rb +57 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/forced_halt.rb +25 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/forward_ports.rb +79 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/import.rb +51 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/is_paused.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/is_running.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/is_saved.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/match_mac_address.rb +21 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/message_not_created.rb +16 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/message_not_running.rb +16 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/message_will_not_destroy.rb +17 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/network.rb +366 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/package.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/package_vagrantfile.rb +33 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb +35 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +51 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/prune_nfs_exports.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/resume.rb +25 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/sane_defaults.rb +87 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/set_name.rb +40 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/setup_package_files.rb +51 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/share_folders.rb +113 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/suspend.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/config.rb +82 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/base.rb +344 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/meta.rb +141 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/version_4_0.rb +481 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/version_4_1.rb +481 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/version_4_2.rb +471 -0
- data/vendor/vagrant/plugins/providers/virtualbox/model/forwarded_port.rb +58 -0
- data/vendor/vagrant/plugins/providers/virtualbox/plugin.rb +42 -0
- data/vendor/vagrant/plugins/providers/virtualbox/provider.rb +92 -0
- data/vendor/vagrant/plugins/providers/virtualbox/util/compile_forwarded_ports.rb +31 -0
- data/vendor/vagrant/plugins/provisioners/chef/config/base.rb +65 -0
- data/vendor/vagrant/plugins/provisioners/chef/config/chef_client.rb +39 -0
- data/vendor/vagrant/plugins/provisioners/chef/config/chef_solo.rb +87 -0
- data/vendor/vagrant/plugins/provisioners/chef/plugin.rb +33 -0
- data/vendor/vagrant/plugins/provisioners/chef/provisioner/base.rb +91 -0
- data/vendor/vagrant/plugins/provisioners/chef/provisioner/chef_client.rb +103 -0
- data/vendor/vagrant/plugins/provisioners/chef/provisioner/chef_solo.rb +182 -0
- data/vendor/vagrant/plugins/provisioners/puppet/config/puppet.rb +70 -0
- data/vendor/vagrant/plugins/provisioners/puppet/config/puppet_server.rb +16 -0
- data/vendor/vagrant/plugins/provisioners/puppet/plugin.rb +33 -0
- data/vendor/vagrant/plugins/provisioners/puppet/provisioner/puppet.rb +110 -0
- data/vendor/vagrant/plugins/provisioners/puppet/provisioner/puppet_server.rb +67 -0
- data/vendor/vagrant/plugins/provisioners/shell/config.rb +46 -0
- data/vendor/vagrant/plugins/provisioners/shell/plugin.rb +23 -0
- data/vendor/vagrant/plugins/provisioners/shell/provisioner.rb +66 -0
- data/vendor/vagrant/tasks/acceptance.rake +113 -0
- data/vendor/vagrant/tasks/bundler.rake +3 -0
- data/vendor/vagrant/tasks/test.rake +20 -0
- data/vendor/vagrant/templates/commands/init/Vagrantfile.erb +111 -0
- data/vendor/vagrant/templates/commands/ssh_config/config.erb +16 -0
- data/vendor/vagrant/templates/config/messages.erb +14 -0
- data/vendor/vagrant/templates/config/validation_failed.erb +7 -0
- data/vendor/vagrant/templates/guests/arch/network_dhcp.erb +4 -0
- data/vendor/vagrant/templates/guests/arch/network_static.erb +6 -0
- data/vendor/vagrant/templates/guests/debian/network_dhcp.erb +11 -0
- data/vendor/vagrant/templates/guests/debian/network_static.erb +7 -0
- data/vendor/vagrant/templates/guests/fedora/network_dhcp.erb +6 -0
- data/vendor/vagrant/templates/guests/fedora/network_static.erb +13 -0
- data/vendor/vagrant/templates/guests/freebsd/network_dhcp.erb +3 -0
- data/vendor/vagrant/templates/guests/freebsd/network_static.erb +3 -0
- data/vendor/vagrant/templates/guests/gentoo/network_dhcp.erb +4 -0
- data/vendor/vagrant/templates/guests/gentoo/network_static.erb +4 -0
- data/vendor/vagrant/templates/guests/redhat/network_dhcp.erb +6 -0
- data/vendor/vagrant/templates/guests/redhat/network_static.erb +7 -0
- data/vendor/vagrant/templates/locales/en.yml +993 -0
- data/vendor/vagrant/templates/nfs/exports.erb +5 -0
- data/vendor/vagrant/templates/nfs/exports_freebsd.erb +5 -0
- data/vendor/vagrant/templates/nfs/exports_linux.erb +5 -0
- data/vendor/vagrant/templates/package_Vagrantfile.erb +11 -0
- data/vendor/vagrant/templates/provisioners/chef_client/client.erb +32 -0
- data/vendor/vagrant/templates/provisioners/chef_solo/solo.erb +25 -0
- data/vendor/vagrant/templates/rgloader.rb +9 -0
- data/vendor/vagrant/test/acceptance/base.rb +48 -0
- data/vendor/vagrant/test/acceptance/box_test.rb +99 -0
- data/vendor/vagrant/test/acceptance/destroy_test.rb +37 -0
- data/vendor/vagrant/test/acceptance/halt_test.rb +72 -0
- data/vendor/vagrant/test/acceptance/init_test.rb +33 -0
- data/vendor/vagrant/test/acceptance/networking/host_only_test.rb +37 -0
- data/vendor/vagrant/test/acceptance/networking/port_forward_test.rb +125 -0
- data/vendor/vagrant/test/acceptance/package_test.rb +46 -0
- data/vendor/vagrant/test/acceptance/provisioning/basic_test.rb +61 -0
- data/vendor/vagrant/test/acceptance/provisioning/chef_solo_test.rb +37 -0
- data/vendor/vagrant/test/acceptance/provisioning/shell_test.rb +53 -0
- data/vendor/vagrant/test/acceptance/resume_test.rb +17 -0
- data/vendor/vagrant/test/acceptance/shared_folders_test.rb +84 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
- data/vendor/vagrant/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
- data/vendor/vagrant/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
- data/vendor/vagrant/test/acceptance/ssh_test.rb +46 -0
- data/vendor/vagrant/test/acceptance/support/config.rb +42 -0
- data/vendor/vagrant/test/acceptance/support/isolated_environment.rb +118 -0
- data/vendor/vagrant/test/acceptance/support/matchers/have_color.rb +9 -0
- data/vendor/vagrant/test/acceptance/support/matchers/match_output.rb +14 -0
- data/vendor/vagrant/test/acceptance/support/matchers/succeed.rb +14 -0
- data/vendor/vagrant/test/acceptance/support/network_tests.rb +29 -0
- data/vendor/vagrant/test/acceptance/support/output.rb +95 -0
- data/vendor/vagrant/test/acceptance/support/shared/base_context.rb +72 -0
- data/vendor/vagrant/test/acceptance/support/shared/command_examples.rb +33 -0
- data/vendor/vagrant/test/acceptance/support/virtualbox.rb +36 -0
- data/vendor/vagrant/test/acceptance/suspend_test.rb +56 -0
- data/vendor/vagrant/test/acceptance/up_basic_test.rb +33 -0
- data/vendor/vagrant/test/acceptance/up_with_box_url.rb +40 -0
- data/vendor/vagrant/test/acceptance/vagrant_test.rb +47 -0
- data/vendor/vagrant/test/acceptance/version_test.rb +15 -0
- data/vendor/vagrant/test/config/acceptance_boxes.yml +7 -0
- data/vendor/vagrant/test/support/isolated_environment.rb +46 -0
- data/vendor/vagrant/test/support/tempdir.rb +43 -0
- data/vendor/vagrant/test/unit/base.rb +27 -0
- data/vendor/vagrant/test/unit/support/dummy_provider.rb +16 -0
- data/vendor/vagrant/test/unit/support/isolated_environment.rb +177 -0
- data/vendor/vagrant/test/unit/support/shared/base_context.rb +104 -0
- data/vendor/vagrant/test/unit/vagrant/action/builder_test.rb +196 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/call_test.rb +145 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/confirm_test.rb +36 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/env_set_test.rb +20 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/graceful_halt_test.rb +61 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/lock_test.rb +98 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/ssh_exec_test.rb +57 -0
- data/vendor/vagrant/test/unit/vagrant/action/hook_test.rb +101 -0
- data/vendor/vagrant/test/unit/vagrant/action/runner_test.rb +71 -0
- data/vendor/vagrant/test/unit/vagrant/action/warden_test.rb +92 -0
- data/vendor/vagrant/test/unit/vagrant/box_collection_test.rb +224 -0
- data/vendor/vagrant/test/unit/vagrant/box_test.rb +109 -0
- data/vendor/vagrant/test/unit/vagrant/cli_test.rb +27 -0
- data/vendor/vagrant/test/unit/vagrant/config/loader_test.rb +184 -0
- data/vendor/vagrant/test/unit/vagrant/config/v1/dummy_config_test.rb +24 -0
- data/vendor/vagrant/test/unit/vagrant/config/v1/loader_test.rb +145 -0
- data/vendor/vagrant/test/unit/vagrant/config/v1/root_test.rb +40 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/dummy_config_test.rb +24 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/loader_test.rb +151 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/root_test.rb +97 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/util_test.rb +21 -0
- data/vendor/vagrant/test/unit/vagrant/config_test.rb +66 -0
- data/vendor/vagrant/test/unit/vagrant/downloaders/base_test.rb +14 -0
- data/vendor/vagrant/test/unit/vagrant/downloaders/file_test.rb +87 -0
- data/vendor/vagrant/test/unit/vagrant/downloaders/http_test.rb +23 -0
- data/vendor/vagrant/test/unit/vagrant/environment_test.rb +571 -0
- data/vendor/vagrant/test/unit/vagrant/hosts_test.rb +37 -0
- data/vendor/vagrant/test/unit/vagrant/machine_state_test.rb +26 -0
- data/vendor/vagrant/test/unit/vagrant/machine_test.rb +418 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/command_test.rb +143 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/communicator_test.rb +9 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/config_test.rb +50 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/host_test.rb +5 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/manager_test.rb +114 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/plugin_test.rb +267 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/provider_test.rb +18 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/command_test.rb +238 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/communicator_test.rb +9 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/components_test.rb +17 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/config_test.rb +60 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/host_test.rb +5 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/manager_test.rb +157 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/plugin_test.rb +287 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/provider_test.rb +18 -0
- data/vendor/vagrant/test/unit/vagrant/registry_test.rb +128 -0
- data/vendor/vagrant/test/unit/vagrant/util/ansi_escape_code_remover_test.rb +16 -0
- data/vendor/vagrant/test/unit/vagrant/util/file_checksum_test.rb +23 -0
- data/vendor/vagrant/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +38 -0
- data/vendor/vagrant/test/unit/vagrant/util/is_port_open_test.rb +53 -0
- data/vendor/vagrant/test/unit/vagrant/util/line_endings_helper_test.rb +16 -0
- data/vendor/vagrant/test/unit/vagrant/util/network_ip_test.rb +17 -0
- data/vendor/vagrant/test/unit/vagrant/util/retryable_test.rb +106 -0
- data/vendor/vagrant/test/unit/vagrant/util/scoped_hash_override_test.rb +48 -0
- data/vendor/vagrant/test/unit/vagrant/util/ssh_test.rb +30 -0
- data/vendor/vagrant/test/unit/vagrant/util/string_block_editor_test.rb +98 -0
- data/vendor/vagrant/test/unit/vagrant/util/which_test.rb +43 -0
- data/vendor/vagrant/test/unit/vagrant_test.rb +56 -0
- data/vendor/vagrant/vagrant.gemspec +69 -0
- metadata +642 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
require "vagrant/util/counter"
|
4
|
+
require "vagrant/util/template_renderer"
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module Chef
|
8
|
+
module Provisioner
|
9
|
+
# This class is a base class where the common functionality shared between
|
10
|
+
# chef-solo and chef-client provisioning are stored. This is **not an actual
|
11
|
+
# provisioner**. Instead, {ChefSolo} or {ChefServer} should be used.
|
12
|
+
class Base < Vagrant.plugin("2", :provisioner)
|
13
|
+
class ChefError < Vagrant::Errors::VagrantError
|
14
|
+
error_namespace("vagrant.provisioners.chef")
|
15
|
+
end
|
16
|
+
|
17
|
+
include Vagrant::Util::Counter
|
18
|
+
|
19
|
+
def initialize(machine, config)
|
20
|
+
super
|
21
|
+
|
22
|
+
config.provisioning_path ||= "/tmp/vagrant-chef-#{get_and_update_counter(:provisioning_path)}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def verify_binary(binary)
|
26
|
+
# Checks for the existence of chef binary and error if it
|
27
|
+
# doesn't exist.
|
28
|
+
@machine.communicate.sudo(
|
29
|
+
"which #{binary}",
|
30
|
+
:error_class => ChefError,
|
31
|
+
:error_key => :chef_not_detected,
|
32
|
+
:binary => binary)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns the path to the Chef binary, taking into account the
|
36
|
+
# `binary_path` configuration option.
|
37
|
+
def chef_binary_path(binary)
|
38
|
+
return binary if !@config.binary_path
|
39
|
+
return File.join(@config.binary_path, binary)
|
40
|
+
end
|
41
|
+
|
42
|
+
def chown_provisioning_folder
|
43
|
+
@machine.communicate.tap do |comm|
|
44
|
+
comm.sudo("mkdir -p #{@config.provisioning_path}")
|
45
|
+
comm.sudo("chown #{@machine.config.ssh.username} #{@config.provisioning_path}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def setup_config(template, filename, template_vars)
|
50
|
+
config_file = Vagrant::Util::TemplateRenderer.render(template, {
|
51
|
+
:log_level => @config.log_level.to_sym,
|
52
|
+
:http_proxy => @config.http_proxy,
|
53
|
+
:http_proxy_user => @config.http_proxy_user,
|
54
|
+
:http_proxy_pass => @config.http_proxy_pass,
|
55
|
+
:https_proxy => @config.https_proxy,
|
56
|
+
:https_proxy_user => @config.https_proxy_user,
|
57
|
+
:https_proxy_pass => @config.https_proxy_pass,
|
58
|
+
:no_proxy => @config.no_proxy
|
59
|
+
}.merge(template_vars))
|
60
|
+
|
61
|
+
# Create a temporary file to store the data so we
|
62
|
+
# can upload it
|
63
|
+
temp = Tempfile.new("vagrant")
|
64
|
+
temp.write(config_file)
|
65
|
+
temp.close
|
66
|
+
|
67
|
+
remote_file = File.join(config.provisioning_path, filename)
|
68
|
+
@machine.communicate.tap do |comm|
|
69
|
+
comm.sudo("rm #{remote_file}", :error_check => false)
|
70
|
+
comm.upload(temp.path, remote_file)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def setup_json
|
75
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.json")
|
76
|
+
|
77
|
+
# Get the JSON that we're going to expose to Chef
|
78
|
+
json = JSON.pretty_generate(@config.merged_json)
|
79
|
+
|
80
|
+
# Create a temporary file to store the data so we
|
81
|
+
# can upload it
|
82
|
+
temp = Tempfile.new("vagrant")
|
83
|
+
temp.write(json)
|
84
|
+
temp.close
|
85
|
+
|
86
|
+
@machine.communicate.upload(temp.path, File.join(@config.provisioning_path, "dna.json"))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
require File.expand_path("../base", __FILE__)
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module Chef
|
7
|
+
module Provisioner
|
8
|
+
# This class implements provisioning via chef-client, allowing provisioning
|
9
|
+
# with a chef server.
|
10
|
+
class ChefClient < Base
|
11
|
+
def configure(root_config)
|
12
|
+
raise ChefError, :server_validation_key_required if @config.validation_key_path.nil?
|
13
|
+
raise ChefError, :server_validation_key_doesnt_exist if !File.file?(validation_key_path)
|
14
|
+
raise ChefError, :server_url_required if @config.chef_server_url.nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
def provision
|
18
|
+
verify_binary(chef_binary_path("chef-client"))
|
19
|
+
chown_provisioning_folder
|
20
|
+
create_client_key_folder
|
21
|
+
upload_validation_key
|
22
|
+
upload_encrypted_data_bag_secret if @config.encrypted_data_bag_secret_key_path
|
23
|
+
setup_json
|
24
|
+
setup_server_config
|
25
|
+
run_chef_client
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_client_key_folder
|
29
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.client_key_folder")
|
30
|
+
path = Pathname.new(@config.client_key_path)
|
31
|
+
|
32
|
+
@machine.communicate.sudo("mkdir -p #{path.dirname}")
|
33
|
+
end
|
34
|
+
|
35
|
+
def upload_validation_key
|
36
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.upload_validation_key")
|
37
|
+
@machine.communicate.upload(validation_key_path, guest_validation_key_path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def upload_encrypted_data_bag_secret
|
41
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.upload_encrypted_data_bag_secret_key")
|
42
|
+
@machine.communicate.upload(encrypted_data_bag_secret_key_path,
|
43
|
+
@config.encrypted_data_bag_secret)
|
44
|
+
end
|
45
|
+
|
46
|
+
def setup_server_config
|
47
|
+
setup_config("provisioners/chef_client/client", "client.rb", {
|
48
|
+
:node_name => @config.node_name,
|
49
|
+
:chef_server_url => @config.chef_server_url,
|
50
|
+
:validation_client_name => @config.validation_client_name,
|
51
|
+
:validation_key => guest_validation_key_path,
|
52
|
+
:client_key => @config.client_key_path,
|
53
|
+
:file_cache_path => @config.file_cache_path,
|
54
|
+
:file_backup_path => @config.file_backup_path,
|
55
|
+
:environment => @config.environment,
|
56
|
+
:encrypted_data_bag_secret => @config.encrypted_data_bag_secret
|
57
|
+
})
|
58
|
+
end
|
59
|
+
|
60
|
+
def run_chef_client
|
61
|
+
command_env = @config.binary_env ? "#{@config.binary_env} " : ""
|
62
|
+
command_args = @config.arguments ? " #{@config.arguments}" : ""
|
63
|
+
command = "#{command_env}#{chef_binary_path("chef-client")} -c #{@config.provisioning_path}/client.rb -j #{@config.provisioning_path}/dna.json #{command_args}"
|
64
|
+
|
65
|
+
@config.attempts.times do |attempt|
|
66
|
+
if attempt == 0
|
67
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
68
|
+
else
|
69
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_client_again")
|
70
|
+
end
|
71
|
+
|
72
|
+
exit_status = @machine.communicate.sudo(command, :error_check => false) do |type, data|
|
73
|
+
# Output the data with the proper color based on the stream.
|
74
|
+
color = type == :stdout ? :green : :red
|
75
|
+
|
76
|
+
# Note: Be sure to chomp the data to avoid the newlines that the
|
77
|
+
# Chef outputs.
|
78
|
+
@machine.env.ui.info(data.chomp, :color => color, :prefix => false)
|
79
|
+
end
|
80
|
+
|
81
|
+
# There is no need to run Chef again if it converges
|
82
|
+
return if exit_status == 0
|
83
|
+
end
|
84
|
+
|
85
|
+
# If we reached this point then Chef never converged! Error.
|
86
|
+
raise ChefError, :no_convergence
|
87
|
+
end
|
88
|
+
|
89
|
+
def validation_key_path
|
90
|
+
File.expand_path(@config.validation_key_path, @machine.env.root_path)
|
91
|
+
end
|
92
|
+
|
93
|
+
def encrypted_data_bag_secret_key_path
|
94
|
+
File.expand_path(@config.encrypted_data_bag_secret_key_path, @machine.env.root_path)
|
95
|
+
end
|
96
|
+
|
97
|
+
def guest_validation_key_path
|
98
|
+
File.join(@config.provisioning_path, "validation.pem")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
require "vagrant/util/counter"
|
4
|
+
|
5
|
+
require File.expand_path("../base", __FILE__)
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module Chef
|
9
|
+
module Provisioner
|
10
|
+
# This class implements provisioning via chef-solo.
|
11
|
+
class ChefSolo < Base
|
12
|
+
extend Vagrant::Util::Counter
|
13
|
+
include Vagrant::Util::Counter
|
14
|
+
|
15
|
+
attr_reader :cookbook_folders
|
16
|
+
attr_reader :role_folders
|
17
|
+
attr_reader :data_bags_folders
|
18
|
+
|
19
|
+
def initialize(machine, config)
|
20
|
+
super
|
21
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::chef_solo")
|
22
|
+
end
|
23
|
+
|
24
|
+
def configure(root_config)
|
25
|
+
@cookbook_folders = expanded_folders(@config.cookbooks_path, "cookbooks")
|
26
|
+
@role_folders = expanded_folders(@config.roles_path, "roles")
|
27
|
+
@data_bags_folders = expanded_folders(@config.data_bags_path, "data_bags")
|
28
|
+
|
29
|
+
share_folders(root_config, "csc", @cookbook_folders)
|
30
|
+
share_folders(root_config, "csr", @role_folders)
|
31
|
+
share_folders(root_config, "csdb", @data_bags_folders)
|
32
|
+
end
|
33
|
+
|
34
|
+
def provision
|
35
|
+
# Verify that the proper shared folders exist.
|
36
|
+
check = []
|
37
|
+
[@cookbook_folders, @role_folders, @data_bags_folders].each do |folders|
|
38
|
+
folders.each do |type, local_path, remote_path|
|
39
|
+
# We only care about checking folders that have a local path, meaning
|
40
|
+
# they were shared from the local machine, rather than assumed to
|
41
|
+
# exist on the VM.
|
42
|
+
check << remote_path if local_path
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
verify_shared_folders(check)
|
47
|
+
|
48
|
+
verify_binary(chef_binary_path("chef-solo"))
|
49
|
+
chown_provisioning_folder
|
50
|
+
upload_encrypted_data_bag_secret if @config.encrypted_data_bag_secret_key_path
|
51
|
+
setup_json
|
52
|
+
setup_solo_config
|
53
|
+
run_chef_solo
|
54
|
+
end
|
55
|
+
|
56
|
+
# Converts paths to a list of properly expanded paths with types.
|
57
|
+
def expanded_folders(paths, appended_folder=nil)
|
58
|
+
# Convert the path to an array if it is a string or just a single
|
59
|
+
# path element which contains the folder location (:host or :vm)
|
60
|
+
paths = [paths] if paths.is_a?(String) || paths.first.is_a?(Symbol)
|
61
|
+
|
62
|
+
results = []
|
63
|
+
paths.each do |type, path|
|
64
|
+
# Create the local/remote path based on whether this is a host
|
65
|
+
# or VM path.
|
66
|
+
local_path = nil
|
67
|
+
remote_path = nil
|
68
|
+
if type == :host
|
69
|
+
# Get the expanded path that the host path points to
|
70
|
+
local_path = File.expand_path(path, @machine.env.root_path)
|
71
|
+
|
72
|
+
# Path exists on the host, setup the remote path
|
73
|
+
remote_path = "#{@config.provisioning_path}/chef-solo-#{get_and_update_counter(:cookbooks_path)}"
|
74
|
+
else
|
75
|
+
# Path already exists on the virtual machine. Expand it
|
76
|
+
# relative to where we're provisioning.
|
77
|
+
remote_path = File.expand_path(path, @config.provisioning_path)
|
78
|
+
|
79
|
+
# Remove drive letter if running on a windows host. This is a bit
|
80
|
+
# of a hack but is the most portable way I can think of at the moment
|
81
|
+
# to achieve this. Otherwise, Vagrant attempts to share at some crazy
|
82
|
+
# path like /home/vagrant/c:/foo/bar
|
83
|
+
remote_path = remote_path.gsub(/^[a-zA-Z]:/, "")
|
84
|
+
end
|
85
|
+
|
86
|
+
# If we have specified a folder name to append then append it
|
87
|
+
remote_path += "/#{appended_folder}" if appended_folder
|
88
|
+
|
89
|
+
# Append the result
|
90
|
+
results << [type, local_path, remote_path]
|
91
|
+
end
|
92
|
+
|
93
|
+
results
|
94
|
+
end
|
95
|
+
|
96
|
+
# Shares the given folders with the given prefix. The folders should
|
97
|
+
# be of the structure resulting from the `expanded_folders` function.
|
98
|
+
def share_folders(root_config, prefix, folders)
|
99
|
+
folders.each do |type, local_path, remote_path|
|
100
|
+
if type == :host
|
101
|
+
root_config.vm.synced_folder(
|
102
|
+
local_path, remote_path,
|
103
|
+
:id => "v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}",
|
104
|
+
:nfs => @config.nfs)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def upload_encrypted_data_bag_secret
|
110
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.upload_encrypted_data_bag_secret_key")
|
111
|
+
@machine.communicate.upload(encrypted_data_bag_secret_key_path,
|
112
|
+
@config.encrypted_data_bag_secret)
|
113
|
+
end
|
114
|
+
|
115
|
+
def setup_solo_config
|
116
|
+
cookbooks_path = guest_paths(@cookbook_folders)
|
117
|
+
roles_path = guest_paths(@role_folders).first
|
118
|
+
data_bags_path = guest_paths(@data_bags_folders).first
|
119
|
+
|
120
|
+
setup_config("provisioners/chef_solo/solo", "solo.rb", {
|
121
|
+
:node_name => @config.node_name,
|
122
|
+
:provisioning_path => @config.provisioning_path,
|
123
|
+
:cookbooks_path => cookbooks_path,
|
124
|
+
:recipe_url => @config.recipe_url,
|
125
|
+
:roles_path => roles_path,
|
126
|
+
:data_bags_path => data_bags_path,
|
127
|
+
:encrypted_data_bag_secret => @config.encrypted_data_bag_secret,
|
128
|
+
})
|
129
|
+
end
|
130
|
+
|
131
|
+
def run_chef_solo
|
132
|
+
command_env = @config.binary_env ? "#{@config.binary_env} " : ""
|
133
|
+
command_args = @config.arguments ? " #{@config.arguments}" : ""
|
134
|
+
command = "#{command_env}#{chef_binary_path("chef-solo")} -c #{@config.provisioning_path}/solo.rb -j #{@config.provisioning_path}/dna.json #{command_args}"
|
135
|
+
|
136
|
+
@config.attempts.times do |attempt|
|
137
|
+
if attempt == 0
|
138
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
139
|
+
else
|
140
|
+
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
|
141
|
+
end
|
142
|
+
|
143
|
+
exit_status = @machine.communicate.sudo(command, :error_check => false) do |type, data|
|
144
|
+
# Output the data with the proper color based on the stream.
|
145
|
+
color = type == :stdout ? :green : :red
|
146
|
+
|
147
|
+
# Note: Be sure to chomp the data to avoid the newlines that the
|
148
|
+
# Chef outputs.
|
149
|
+
@machine.env.ui.info(data.chomp, :color => color, :prefix => false)
|
150
|
+
end
|
151
|
+
|
152
|
+
# There is no need to run Chef again if it converges
|
153
|
+
return if exit_status == 0
|
154
|
+
end
|
155
|
+
|
156
|
+
# If we reached this point then Chef never converged! Error.
|
157
|
+
raise ChefError, :no_convergence
|
158
|
+
end
|
159
|
+
|
160
|
+
def verify_shared_folders(folders)
|
161
|
+
folders.each do |folder|
|
162
|
+
@logger.debug("Checking for shared folder: #{folder}")
|
163
|
+
if !@machine.communicate.test("test -d #{folder}")
|
164
|
+
raise ChefError, :missing_shared_folders
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def encrypted_data_bag_secret_key_path
|
170
|
+
File.expand_path(@config.encrypted_data_bag_secret_key_path, @machine.env.root_path)
|
171
|
+
end
|
172
|
+
|
173
|
+
protected
|
174
|
+
|
175
|
+
# Extracts only the remote paths from a list of folders
|
176
|
+
def guest_paths(folders)
|
177
|
+
folders.map { |parts| parts[2] }
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Puppet
|
3
|
+
module Config
|
4
|
+
class Puppet < Vagrant.plugin("2", :config)
|
5
|
+
attr_accessor :manifest_file
|
6
|
+
attr_accessor :manifests_path
|
7
|
+
attr_accessor :module_path
|
8
|
+
attr_accessor :pp_path
|
9
|
+
attr_accessor :options
|
10
|
+
attr_accessor :facter
|
11
|
+
|
12
|
+
def manifest_file; @manifest_file || "default.pp"; end
|
13
|
+
def manifests_path; @manifests_path || "manifests"; end
|
14
|
+
def pp_path; @pp_path || "/tmp/vagrant-puppet"; end
|
15
|
+
def options; @options ||= []; end
|
16
|
+
def facter; @facter ||= {}; end
|
17
|
+
|
18
|
+
# Returns the manifests path expanded relative to the root path of the
|
19
|
+
# environment.
|
20
|
+
def expanded_manifests_path(root_path)
|
21
|
+
Pathname.new(manifests_path).expand_path(root_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns the module paths as an array of paths expanded relative to the
|
25
|
+
# root path.
|
26
|
+
def expanded_module_paths(root_path)
|
27
|
+
return [] if !module_path
|
28
|
+
|
29
|
+
# Get all the paths and expand them relative to the root path, returning
|
30
|
+
# the array of expanded paths
|
31
|
+
paths = module_path
|
32
|
+
paths = [paths] if !paths.is_a?(Array)
|
33
|
+
paths.map do |path|
|
34
|
+
Pathname.new(path).expand_path(root_path)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def validate(machine)
|
39
|
+
errors = []
|
40
|
+
|
41
|
+
# Calculate the manifests and module paths based on env
|
42
|
+
this_expanded_manifests_path = expanded_manifests_path(machine.env.root_path)
|
43
|
+
this_expanded_module_paths = expanded_module_paths(machine.env.root_path)
|
44
|
+
|
45
|
+
# Manifests path/file validation
|
46
|
+
if !this_expanded_manifests_path.directory?
|
47
|
+
errors << I18n.t("vagrant.provisioners.puppet.manifests_path_missing",
|
48
|
+
:path => this_expanded_manifests_path)
|
49
|
+
else
|
50
|
+
expanded_manifest_file = this_expanded_manifests_path.join(manifest_file)
|
51
|
+
if !expanded_manifest_file.file?
|
52
|
+
errors << I18n.t("vagrant.provisioners.puppet.manifest_missing",
|
53
|
+
:manifest => expanded_manifest_file.to_s)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Module paths validation
|
58
|
+
this_expanded_module_paths.each do |path|
|
59
|
+
if !path.directory?
|
60
|
+
errors << I18n.t("vagrant.provisioners.puppet.module_path_missing",
|
61
|
+
:path => path)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
{ "puppet provisioner" => errors }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|