Finding current vagrant operation from inside Vagrantfile?

192 views Asked by At

I'm looking for a way to find the current "vagrant" sub-command (e.g. "up", "provision") from inside the Vagrantfile.

I know about being able to fetch ARGV (e.g. getting the vagrant command line arguments inside the Vagrantfile), but a simple lookup for "up" and "provision" in ARGV could accidentally pick up plugin sub-command arguments.

Is there a way to tell from inside the Vagrantfile which command Vagrant is intending to execute?

The motivation is to avoid executing time-consuming operations which are required for "provision" and "up" but redundant for other sub-commands (e.g. fetching information from AWS).

0

There are 0 answers