Skip to content

Instantly share code, notes, and snippets.

Created November 22, 2016 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/29b349807851490999a78ebfbe15e232 to your computer and use it in GitHub Desktop.
Save anonymous/29b349807851490999a78ebfbe15e232 to your computer and use it in GitHub Desktop.
# machine_config.triggers.inspect
[#<OpenStruct trigger="up", momentum="before", type="run", command="ssh-config-upsert rm my c:\\Users\\steph\\.ssh\\config">, #<OpenStruct trigger="up", momentum="after", type="run", command="ssh-config-upsert add c:\\Users\\steph\\.ssh\\config \"vagrant ssh-config my\"">, #<OpenStruct trigger="up", momentum="before", type="run_remote", command="/vagrant/vagrant-triggers/vagrant-before-up">, #<OpenStruct trigger="halt", momentum="before", type="run", command="ssh-config-upsert rm my c:\\Users\\steph\\.ssh\\config c:\\Users\\steph\\.ssh\\config">, #<OpenStruct trigger="halt", momentum="before", type="run_remote", command="/vagrant/vagrant-triggers/vagrant-before-halt">, #<OpenStruct trigger="suspend", momentum="before", type="run", command="ssh-config-upsert rm my c:\\Users\\steph\\.ssh\\config">, #<OpenStruct trigger="suspend", momentum="before", type="run_remote", command="/vagrant/vagrant-triggers/vagrant-before-suspend">, #<OpenStruct trigger="destroy", momentum="before", type="run_remote", command="/vagrant/vagrant-triggers/vagrant-before-destroy">, #<OpenStruct trigger="destroy", momentum="before", type="run", command="ssh-config-upsert rm my c:\\Users\\steph\\.ssh\\config">, #<OpenStruct trigger="reload", momentum="before", type="run", command="ssh-config-upsert rm my c:\\Users\\steph\\.ssh\\config">, #<OpenStruct trigger="reload", momentum="before", type="run_remote", command="/vagrant/vagrant-triggers/vagrant-before-reload">, #<OpenStruct trigger="reload", momentum="after", type="run", command="ssh-config-upsert add c:\\Users\\steph\\.ssh\\config \"vagrant ssh-config my\"">, #<OpenStruct trigger="reload", momentum="after", type="run_remote", command="/vagrant/vagrant-triggers/vagrant-after-reload">]
# vagrantfile code :
if machine_config.triggers then
machine_config.triggers.each do |trigger|
momentum = trigger.momentum
momentum_sym = momentum.to_sym
trigger_type = trigger.trigger
type = trigger.type
command = trigger.command
# puts trigger.inspect
config.trigger[momentum].public_send(trigger_type, :vm => [machine_config.name]) do
run command if type == "run"
run_remote command if type == "run_remote"
end
end
end
# error :
triggers:
* The following settings shouldn't exist: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment