Vagrant config in Vagrantfile

26 views
Skip to first unread message

Prénom Nom

unread,
Jun 29, 2020, 7:42:38 AM6/29/20
to Vagrant
Hello everybody,
i'm trying to play with Vagrantfile triggers, and i wonder if there are some ways to get current vagrant config, such as "cwd" or "dotfile_path".
Perhaps something based on Vagrant::Environment, juste like he "@env" variable available in plugins commands.

Thx :)

sop...@hashicorp.com

unread,
Jun 29, 2020, 12:25:01 PM6/29/20
to Vagrant
Hey there,
I believe you can accomplish this using the ruby option. For example:

```
config.trigger.after :all do |trigger|
   trigger.info = "Trigger trigger"
   trigger.ruby do |env, machine|
     puts env.cwd
   end
end
```

Prénom Nom

unread,
Jun 29, 2020, 4:42:13 PM6/29/20
to Vagrant
Oh god, it's working  !!! :explody_parrot:

Thanks a lot <3
Reply all
Reply to author
Forward
0 new messages