From 4a6e7c756b82eec39717e3665f1d5b3e9af118cb Mon Sep 17 00:00:00 2001 From: "Francisco R. Santos" Date: Mon, 11 Feb 2013 19:42:36 +0100 Subject: [PATCH] Allow non privileged user vagrant to run a shell provision --- plugins/provisioners/shell/config.rb | 2 ++ plugins/provisioners/shell/provisioner.rb | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/provisioners/shell/config.rb b/plugins/provisioners/shell/config.rb index 6c9e4d223..e5a855287 100644 --- a/plugins/provisioners/shell/config.rb +++ b/plugins/provisioners/shell/config.rb @@ -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) diff --git a/plugins/provisioners/shell/provisioner.rb b/plugins/provisioners/shell/provisioner.rb index 42cbdb3fa..dd2be8658 100644 --- a/plugins/provisioners/shell/provisioner.rb +++ b/plugins/provisioners/shell/provisioner.rb @@ -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