commands/init: error if can't write Vagrantfile [GH-2660]
This commit is contained in:
parent
ae4cd33266
commit
da91572ce7
|
@ -17,6 +17,7 @@ BUG FIXES:
|
|||
a login shell (regression). [GH-2636]
|
||||
- core: specifying `-t` or `-T` to `vagrant ssh -c` as extra args
|
||||
will properly enable/disable a TTY for OpenSSH. [GH-2618]
|
||||
- commands/init: Error if can't write Vagrantfile to directory. [GH-2660]
|
||||
- guests/debian: fix `use_dhcp_assigned_default_route` to work properly.
|
||||
[GH-2648]
|
||||
- guests/debian,ubuntu: fix change\_host\_name for FQDNs with trailing
|
||||
|
|
|
@ -564,6 +564,10 @@ module Vagrant
|
|||
error_key(:vagrantfile_syntax_error)
|
||||
end
|
||||
|
||||
class VagrantfileWriteError < VagrantError
|
||||
error_key(:vagrantfile_write_error)
|
||||
end
|
||||
|
||||
class VagrantVersionBad < VagrantError
|
||||
error_key(:vagrant_version_bad)
|
||||
end
|
||||
|
|
|
@ -38,8 +38,12 @@ module VagrantPlugins
|
|||
|
||||
if save_path
|
||||
# Write out the contents
|
||||
save_path.open("w+") do |f|
|
||||
f.write(contents)
|
||||
begin
|
||||
save_path.open("w+") do |f|
|
||||
f.write(contents)
|
||||
end
|
||||
rescue Errno::EACCES
|
||||
raise Vagrant::Errors::VagrantfileWriteError
|
||||
end
|
||||
|
||||
@env.ui.info(I18n.t("vagrant.commands.init.success"), prefix: false)
|
||||
|
|
|
@ -676,6 +676,11 @@ en:
|
|||
message is reproduced below for convenience:
|
||||
|
||||
%{file}
|
||||
vagrantfile_write_error: |-
|
||||
The user that is running Vagrant doesn't have the proper permissions
|
||||
to write a Vagrantfile to the specified location. Please ensure that
|
||||
you call `vagrant init` in a location where the proper permissions
|
||||
are in place to create a Vagrantfile.
|
||||
vagrant_version_bad: |-
|
||||
This Vagrant environment has specified that it requires the Vagrant
|
||||
version to satisfy the following version requirements:
|
||||
|
|
Loading…
Reference in New Issue