Prompt for `reload` if shared folders aren't setup for Chef [GH-253]
This commit is contained in:
parent
638881614a
commit
cb6020869f
|
@ -50,6 +50,8 @@
|
|||
`sudo` installed Vagrant installations work. [GH-580]
|
||||
- Provisioner stdout/stderr is now color coded based on stdout/stderr.
|
||||
stdout is green, stderr is red. [GH-595]
|
||||
- Chef solo now prompts users to run a `reload` if shared folders
|
||||
are not found on the VM. [GH-253]
|
||||
- "--no-provision" once again works for certain commands. [GH-591]
|
||||
- Resuming a VM from a saved state will show an error message if there
|
||||
would be port collisions. [GH-602]
|
||||
|
|
|
@ -7,7 +7,8 @@ module Vagrant
|
|||
def initialize(app, env)
|
||||
@logger = Log4r::Logger.new("vagrant::action::vm::provision")
|
||||
@app = app
|
||||
@env["provision.enabled"] = true if !env.has_key?("provision.enabled")
|
||||
|
||||
env["provision.enabled"] = true if !env.has_key?("provision.enabled")
|
||||
end
|
||||
|
||||
def call(env)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require "log4r"
|
||||
|
||||
require 'vagrant/provisioners/chef'
|
||||
|
||||
module Vagrant
|
||||
|
@ -39,6 +41,11 @@ module Vagrant
|
|||
Config
|
||||
end
|
||||
|
||||
def initialize(env, config)
|
||||
super
|
||||
@logger = Log4r::Logger.new("vagrant::provisioners::chef_solo")
|
||||
end
|
||||
|
||||
def prepare
|
||||
@cookbook_folders = expanded_folders(config.cookbooks_path, "cookbooks")
|
||||
@role_folders = expanded_folders(config.roles_path, "roles")
|
||||
|
@ -50,6 +57,19 @@ module Vagrant
|
|||
end
|
||||
|
||||
def provision!
|
||||
# Verify that the proper shared folders exist.
|
||||
check = []
|
||||
[@cookbook_folders, @role_folders, @data_bags_folders].each do |folders|
|
||||
folders.each do |type, local_path, remote_path|
|
||||
# We only care about checking folders that have a local path, meaning
|
||||
# they were shared from the local machine, rather than assumed to
|
||||
# exist on the VM.
|
||||
check << remote_path if local_path
|
||||
end
|
||||
end
|
||||
|
||||
verify_shared_folders(check)
|
||||
|
||||
verify_binary(chef_binary_path("chef-solo"))
|
||||
chown_provisioning_folder
|
||||
setup_json
|
||||
|
@ -138,6 +158,17 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
|
||||
def verify_shared_folders(folders)
|
||||
folders.each do |folder|
|
||||
@logger.debug("Checking for shared folder: #{folder}")
|
||||
if !env[:vm].channel.test("test -d #{folder}")
|
||||
raise ChefError, :missing_shared_folders
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# Extracts only the remote paths from a list of folders
|
||||
def guest_paths(folders)
|
||||
folders.map { |parts| parts[2] }
|
||||
|
|
|
@ -564,7 +564,14 @@ en:
|
|||
upload_encrypted_data_bag_secret_key: "Uploading chef encrypted data bag secret key..."
|
||||
running_client: "Running chef-client..."
|
||||
running_solo: "Running chef-solo..."
|
||||
invalid_provisioner: "Vagrant::Provisioners::Chef is not a valid provisioner! Use ChefSolo or ChefClient instead."
|
||||
invalid_provisioner: |-
|
||||
Vagrant::Provisioners::Chef is not a valid provisioner! Use
|
||||
ChefSolo or ChefClient instead.
|
||||
missing_shared_folders: |-
|
||||
Shared folders that Chef requires are missing on the virtual machine.
|
||||
This is usually due to configuration changing after already booting the
|
||||
machine. The fix is to run a `vagrant reload` so that the proper shared
|
||||
folders will prepared and mounted on the VM.
|
||||
not_detected: |-
|
||||
The `%{binary}` binary appears to not be in the PATH of the guest. This
|
||||
could be because the PATH is not properly setup or perhaps chef is not
|
||||
|
|
Loading…
Reference in New Issue