rename to powershell_elevated_interactive

This commit is contained in:
Mitchell Hashimoto 2015-11-18 12:51:18 -08:00
parent 0349793213
commit e6098f6c4f
5 changed files with 9 additions and 8 deletions

View File

@ -30,7 +30,8 @@ IMPROVEMENTS:
- core: allow removal of all box versions with `--all` flag [GH-3462] - core: allow removal of all box versions with `--all` flag [GH-3462]
- command/plugin: Add `--plugin-clean-sources` flag to reset plugin install - command/plugin: Add `--plugin-clean-sources` flag to reset plugin install
sources, primarily for corp firewalls. [GH-4738] sources, primarily for corp firewalls. [GH-4738]
- communicators/winrm: Support interactive mode for elevated scripts [GH-6185] - provisioners/shell: Support interactive mode for elevated PowerShell
scripts [GH-6185]
- provisioners/ansible: add new `force_remote_user` option to control whether - provisioners/ansible: add new `force_remote_user` option to control whether
`ansible_ssh_user` parameter should be applied or not [GH-6348] `ansible_ssh_user` parameter should be applied or not [GH-6348]
- provisioners/ansible: show a warning when running from a Windows Host [GH-5292] - provisioners/ansible: show a warning when running from a Windows Host [GH-5292]

View File

@ -12,7 +12,7 @@ module VagrantPlugins
attr_accessor :keep_color attr_accessor :keep_color
attr_accessor :name attr_accessor :name
attr_accessor :powershell_args attr_accessor :powershell_args
attr_accessor :elevated_interactive attr_accessor :powershell_elevated_interactive
def initialize def initialize
@args = UNSET_VALUE @args = UNSET_VALUE
@ -24,7 +24,7 @@ module VagrantPlugins
@keep_color = UNSET_VALUE @keep_color = UNSET_VALUE
@name = UNSET_VALUE @name = UNSET_VALUE
@powershell_args = UNSET_VALUE @powershell_args = UNSET_VALUE
@elevated_interactive = UNSET_VALUE @powershell_elevated_interactive = UNSET_VALUE
end end
def finalize! def finalize!
@ -37,7 +37,7 @@ module VagrantPlugins
@keep_color = false if @keep_color == UNSET_VALUE @keep_color = false if @keep_color == UNSET_VALUE
@name = nil if @name == UNSET_VALUE @name = nil if @name == UNSET_VALUE
@powershell_args = "-ExecutionPolicy Bypass" if @powershell_args == UNSET_VALUE @powershell_args = "-ExecutionPolicy Bypass" if @powershell_args == UNSET_VALUE
@elevated_interactive = false if @elevated_interactive == UNSET_VALUE @powershell_elevated_interactive = false if @powershell_elevated_interactive == UNSET_VALUE
if @args && args_valid? if @args && args_valid?
@args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s @args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s
@ -81,7 +81,7 @@ module VagrantPlugins
errors << I18n.t("vagrant.provisioners.shell.args_bad_type") errors << I18n.t("vagrant.provisioners.shell.args_bad_type")
end end
if elevated_interactive && !privileged if powershell_elevated_interactive && !privileged
errors << I18n.t("vagrant.provisioners.shell.interactive_not_elevated") errors << I18n.t("vagrant.provisioners.shell.interactive_not_elevated")
end end

View File

@ -137,7 +137,7 @@ module VagrantPlugins
end end
# Execute it with sudo # Execute it with sudo
comm.sudo(command, { elevated: config.privileged, interactive: config.elevated_interactive }) do |type, data| comm.sudo(command, { elevated: config.privileged, interactive: config.powershell_elevated_interactive }) do |type, data|
handle_comm(type, data) handle_comm(type, data)
end end
end end

View File

@ -88,7 +88,7 @@ describe "VagrantPlugins::Shell::Config" do
it "returns an error if elevated_interactive is true but privileged is false" do it "returns an error if elevated_interactive is true but privileged is false" do
subject.path = file_that_exists subject.path = file_that_exists
subject.elevated_interactive = true subject.powershell_elevated_interactive = true
subject.privileged = false subject.privileged = false
subject.finalize! subject.finalize!

View File

@ -66,7 +66,7 @@ The remainder of the available options are optional:
* `powershell_args` (string) - Extra arguments to pass to `PowerShell` * `powershell_args` (string) - Extra arguments to pass to `PowerShell`
if you're provisioning with PowerShell on Windows. if you're provisioning with PowerShell on Windows.
* `elevated_interactive` (boolean) - Run an elevated script in interactive mode * `powershell_elevated_interactive` (boolean) - Run an elevated script in interactive mode
on Windows. By default this is "false". Must also be `privileged`. Be sure to on Windows. By default this is "false". Must also be `privileged`. Be sure to
enable auto-login for Windows as the user must be logged in for interactive enable auto-login for Windows as the user must be logged in for interactive
mode to work. mode to work.