Merge pull request #5607 from purpleidea/feat/named-shell
Add :name attribute to shell provisioner.
This commit is contained in:
commit
afc02ed681
|
@ -10,6 +10,7 @@ module VagrantPlugins
|
|||
attr_accessor :privileged
|
||||
attr_accessor :binary
|
||||
attr_accessor :keep_color
|
||||
attr_accessor :name
|
||||
attr_accessor :powershell_args
|
||||
|
||||
def initialize
|
||||
|
@ -20,6 +21,7 @@ module VagrantPlugins
|
|||
@privileged = UNSET_VALUE
|
||||
@binary = UNSET_VALUE
|
||||
@keep_color = UNSET_VALUE
|
||||
@name = UNSET_VALUE
|
||||
@powershell_args = UNSET_VALUE
|
||||
end
|
||||
|
||||
|
@ -31,11 +33,15 @@ module VagrantPlugins
|
|||
@privileged = true if @privileged == UNSET_VALUE
|
||||
@binary = false if @binary == UNSET_VALUE
|
||||
@keep_color = false if @keep_color == UNSET_VALUE
|
||||
@name = nil if @name == UNSET_VALUE
|
||||
@powershell_args = "-ExecutionPolicy Bypass" if @powershell_args == UNSET_VALUE
|
||||
|
||||
if @args && args_valid?
|
||||
@args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s
|
||||
end
|
||||
if not(@name.nil?) and not(@name.is_a?(String))
|
||||
@name = nil
|
||||
end
|
||||
end
|
||||
|
||||
def validate(machine)
|
||||
|
|
|
@ -65,7 +65,10 @@ module VagrantPlugins
|
|||
|
||||
comm.upload(path.to_s, config.upload_path)
|
||||
|
||||
if config.path
|
||||
if not(config.name.nil?)
|
||||
@machine.ui.detail(I18n.t("vagrant.provisioners.shell.running",
|
||||
script: "Name: #{config.name}"))
|
||||
elsif config.path
|
||||
@machine.ui.detail(I18n.t("vagrant.provisioners.shell.running",
|
||||
script: path.to_s))
|
||||
else
|
||||
|
@ -122,7 +125,10 @@ module VagrantPlugins
|
|||
command = "powershell #{shell_args.to_s} -file #{command}" if
|
||||
File.extname(exec_path).downcase == '.ps1'
|
||||
|
||||
if config.path
|
||||
if not(config.name.nil?)
|
||||
@machine.ui.detail(I18n.t("vagrant.provisioners.shell.running",
|
||||
script: "Name: #{config.name}"))
|
||||
elsif config.path
|
||||
@machine.ui.detail(I18n.t("vagrant.provisioners.shell.runningas",
|
||||
local: config.path.to_s, remote: exec_path))
|
||||
else
|
||||
|
|
|
@ -59,6 +59,9 @@ The remainder of the available options are optional:
|
|||
true, Vagrant will not do this, allowing the native colors from the script
|
||||
to be outputted.
|
||||
|
||||
* `name` (string) - This value will be displayed in the output so that
|
||||
identification by the user is easier when many shell provisioners are present.
|
||||
|
||||
* `powershell_args` (string) - Extra arguments to pass to `PowerShell`
|
||||
if you're provisioning with PowerShell on Windows.
|
||||
|
||||
|
|
Loading…
Reference in New Issue