Darren S.
2018-10-18 16:20:12 UTC
Vagrant 2.1.5
macOS 10.13.6
My Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.define "server" do |server|
server.vm.box = "ubuntu/xenial64"
server.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 4096
end
server.trigger.before :up do |trigger|
trigger.info = "Checking for user-supplied hostname prior to
continuing"
trigger.ruby do |env,machine|
hostname = ENV["SERVER_HOSTNAME"]
unless hostname
trigger.warning = '[!] Before installing the server, set a unique
' \
<< 'hostname in the SERVER_HOSTNAME environment variable.'
trigger.abort = true
end
server.vm.hostname = hostname
end
end
end
end
Errors out when attempting to run with the trigger as currently configured:
$ vagrant up
Bringing machine 'server' up with 'virtualbox' provider...
==> server: Running triggers before up ...
==> server: Running trigger...
==> server: Checking for user-supplied hostname prior to continuing
There are errors in the configuration of this machine. Please fix
the following errors and try again:
trigger:
* The following settings shouldn't exist: ruby
Seems clear that I didn't specify something correctly, but I'm trying to
follow the documentation under https://www.vagrantup.com/docs/triggers/ as
closely as possible.
One more question too, is it required by the statement:
trigger.ruby do |env,machine|
... that a host/node be explicitly defined prior to use as I've done, or
will it still work fine with the implicit "default" node? Docs
at https://www.vagrantup.com/docs/triggers/configuration.html
and https://www.vagrantup.com/docs/triggers/usage.html#ruby-option show it
done on an explicit host but it's not clear if that's a requirement.
- Darren
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/5b05a738-3fb7-4d0b-9593-92a66ead492d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
macOS 10.13.6
My Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.define "server" do |server|
server.vm.box = "ubuntu/xenial64"
server.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 4096
end
server.trigger.before :up do |trigger|
trigger.info = "Checking for user-supplied hostname prior to
continuing"
trigger.ruby do |env,machine|
hostname = ENV["SERVER_HOSTNAME"]
unless hostname
trigger.warning = '[!] Before installing the server, set a unique
' \
<< 'hostname in the SERVER_HOSTNAME environment variable.'
trigger.abort = true
end
server.vm.hostname = hostname
end
end
end
end
Errors out when attempting to run with the trigger as currently configured:
$ vagrant up
Bringing machine 'server' up with 'virtualbox' provider...
==> server: Running triggers before up ...
==> server: Running trigger...
==> server: Checking for user-supplied hostname prior to continuing
There are errors in the configuration of this machine. Please fix
the following errors and try again:
trigger:
* The following settings shouldn't exist: ruby
Seems clear that I didn't specify something correctly, but I'm trying to
follow the documentation under https://www.vagrantup.com/docs/triggers/ as
closely as possible.
One more question too, is it required by the statement:
trigger.ruby do |env,machine|
... that a host/node be explicitly defined prior to use as I've done, or
will it still work fine with the implicit "default" node? Docs
at https://www.vagrantup.com/docs/triggers/configuration.html
and https://www.vagrantup.com/docs/triggers/usage.html#ruby-option show it
done on an explicit host but it's not clear if that's a requirement.
- Darren
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/5b05a738-3fb7-4d0b-9593-92a66ead492d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.