@ #10460 | vagrant rsync should restart when rsync find chown command error
This commit is contained in:
parent
aa6908cc00
commit
480e992ea1
|
@ -668,6 +668,10 @@ module Vagrant
|
|||
error_key(:push_strategy_not_provided)
|
||||
end
|
||||
|
||||
class RsyncChownCommandError < VagrantError
|
||||
error_key(:rsync_chown_command_error)
|
||||
end
|
||||
|
||||
class RSyncError < VagrantError
|
||||
error_key(:rsync_error)
|
||||
end
|
||||
|
|
|
@ -217,6 +217,10 @@ module VagrantPlugins
|
|||
# halt is happening. Just notify the user but don't fail out.
|
||||
opts[:machine].ui.error(I18n.t(
|
||||
"vagrant.rsync_communicator_not_ready_callback"))
|
||||
rescue Vagrant::Errors::RsyncChownCommandError
|
||||
# Error executing rsync chown command
|
||||
opts[:machine].ui.error(I18n.t(
|
||||
"vagrant.rsync_chown_command_error"))
|
||||
rescue Vagrant::Errors::RSyncError => e
|
||||
# Error executing rsync, so show an error
|
||||
opts[:machine].ui.error(I18n.t(
|
||||
|
|
|
@ -23,7 +23,13 @@ module VagrantPlugins
|
|||
if opts.key?(:chown) && !opts[:chown]
|
||||
return
|
||||
end
|
||||
machine.communicate.sudo(build_rsync_chown(opts))
|
||||
|
||||
error_opts = {
|
||||
error_class: Vagrant::Errors::RsyncChownCommandError,
|
||||
error_key: :rsync_chown_command_error
|
||||
}
|
||||
|
||||
machine.communicate.sudo(build_rsync_chown(opts), error_opts)
|
||||
end
|
||||
|
||||
def build_rsync_chown(opts)
|
||||
|
@ -38,7 +44,7 @@ module VagrantPlugins
|
|||
"find #{guest_path} #{exclusions}" \
|
||||
"'!' -type l -a " \
|
||||
"'(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -exec " \
|
||||
"chown #{opts[:owner]}:#{opts[:group]} '{}' + || :"
|
||||
"chown #{opts[:owner]}:#{opts[:group]} '{}' +"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -235,6 +235,10 @@ en:
|
|||
repeats, then please fix the issue:
|
||||
|
||||
%{message}
|
||||
rsync_chown_command_error: |-
|
||||
There was an error while executing find and chown command, when file missing.
|
||||
This may not be critical since rsync chown command sometimes fails, but if this message
|
||||
repeats, then please fix the issue.
|
||||
rsync_communicator_not_ready: |-
|
||||
The machine is reporting that it is not ready for rsync to
|
||||
communicate with it. Verify that this machine is properly running.
|
||||
|
|
Loading…
Reference in New Issue