Create data dir only after the machine passes all checks

This commit is contained in:
Mikhail Zholobov 2015-02-12 14:32:16 +02:00
parent 319175b7f1
commit c4565b3c99
2 changed files with 4 additions and 2 deletions

View File

@ -604,10 +604,8 @@ module Vagrant
@logger.info("Uncached load of machine.") @logger.info("Uncached load of machine.")
# Determine the machine data directory and pass it to the machine. # Determine the machine data directory and pass it to the machine.
# XXX: Permissions error here.
machine_data_path = @local_data_path.join( machine_data_path = @local_data_path.join(
"machines/#{name}/#{provider}") "machines/#{name}/#{provider}")
FileUtils.mkdir_p(machine_data_path)
# Create the machine and cache it for future calls. This will also # Create the machine and cache it for future calls. This will also
# return the machine from this method. # return the machine from this method.

View File

@ -70,6 +70,10 @@ module Vagrant
# Get the provider configuration from the final loaded configuration # Get the provider configuration from the final loaded configuration
provider_config = config.vm.get_provider_config(provider) provider_config = config.vm.get_provider_config(provider)
# Create machine data directory if it doesn't exist
# XXX: Permissions error here.
FileUtils.mkdir_p(data_path)
# Create the machine and cache it for future calls. This will also # Create the machine and cache it for future calls. This will also
# return the machine from this method. # return the machine from this method.
return Machine.new(name, provider, provider_cls, provider_config, return Machine.new(name, provider, provider_cls, provider_config,