Allow non privileged user vagrant to run a shell provision
This commit is contained in:
parent
987b3008fe
commit
4a6e7c756b
|
@ -5,9 +5,11 @@ module VagrantPlugins
|
|||
attr_accessor :path
|
||||
attr_accessor :upload_path
|
||||
attr_accessor :args
|
||||
attr_accessor :privileged
|
||||
|
||||
def initialize
|
||||
@upload_path = "/tmp/vagrant-shell"
|
||||
@privileged = true
|
||||
end
|
||||
|
||||
def validate(machine)
|
||||
|
|
|
@ -14,8 +14,7 @@ module VagrantPlugins
|
|||
@machine.communicate.tap do |comm|
|
||||
comm.upload(path.to_s, config.upload_path)
|
||||
|
||||
# Execute it with sudo
|
||||
comm.sudo(command) do |type, data|
|
||||
comm.execute(command, {:sudo => config.privileged}) do |type, data|
|
||||
if [:stderr, :stdout].include?(type)
|
||||
# Output the data with the proper color based on the stream.
|
||||
color = type == :stdout ? :green : :red
|
||||
|
|
Loading…
Reference in New Issue