Fix hardcoding of active state.

This commit queries the environment for active machines instead of
relying on a certain machine state. This fixes support for other Vagrant
providers.