Closed uchagani closed 9 years ago
can you please explain the reasoning for: https://github.com/emyl/vagrant-triggers/blob/master/spec/vagrant-triggers/dsl_spec.rb#L80
Please, could you provide an example of what you're trying?
Thanks.
Vagrant.configure("2") do |config|
config.vm.define "admin" do |admin|
admin.vm.box = "MyBaseBox"
admin.vm.provider "vmware_workstation" do |vm|
vm.name = admin.vm.hostname
end
admin.trigger.before :up, :stdout => true do
run "SET ROLE=Admin"
end
end
config.vm.define "client" do |client|
client.vm.box = "MyBaseBox"
client.vm.provider "vmware_workstation" do |vm|
vm.name = client.vm.hostname
end
client.trigger.before :up, :stdout => true do
run "SET ROLE=Client"
end
end
end
Bringing machine 'admin' up with 'vmware_workstation' provider...
Bringing machine 'client' up with 'vmware_workstation' provider...
==> admin: Running triggers before up...
==> admin: Executing command "SET ROLE=Admin"...
The executable "SET" Vagrant is trying to trigger
was not found. If you know it is not in the PATH, please
specify its absolute path using the :append_to_path option.
SET ROLE=Admin
works just fine when executed from the command line but doesn't when ran through the trigger
Here the problem is that SET
is an internal MS-DOS command, and so it can't be found as executable.
Depending on your use case, maybe you could work around the issue by using either SETX, Powershell's Set-Variable, or a more specific plugin like vagrant-env.
I tried set-variable and got the same result. On Nov 27, 2014 9:46 AM, "Emiliano Ticci" notifications@github.com wrote:
Here the problem is that SET is an internal MS-DOS command, and so it can't be found as executable.
Depending on your use case, maybe you could work around the issue by using either SETX http://ss64.com/nt/setx.html, Powershell's Set-Variable http://ss64.com/ps/set-variable.html, or a more specific plugin like vagrant-env https://github.com/gosuri/vagrant-env.
— Reply to this email directly or view it on GitHub https://github.com/emyl/vagrant-triggers/issues/33#issuecomment-64798346 .
I'm trying to set environment variables through the trigger but nothing I've tried works: