Detect machine state in a Vagrantfile for triggers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Detect machine state in a Vagrantfile for triggers

Iain Hallam
I've just posted a question over at Serverfault: https://serverfault.com/questions/865699/detect-machine-state-in-a-vagrantfile-for-triggers

I'm aiming to use some Ruby in a Vagrantfile to see what state the machine is in to decide which steps are needed in a trigger.before :destroy action.

Not being a Ruby programmer, I'm having some difficulty working out what code I'll need to use to access the state of the machine (or machines) in the Vagrantfile; can anyone help, please?

Thanks,

Iain.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/4bb2b973-966a-481d-a2c1-4ec10f43229a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Detect machine state in a Vagrantfile for triggers

Alvaro Miranda Aguilera
hello 

there is a plugin called vagrant triggers


have you seen it?

On Fri, Jul 28, 2017 at 4:04 PM, Iain Hallam <[hidden email]> wrote:
I've just posted a question over at Serverfault: https://serverfault.com/questions/865699/detect-machine-state-in-a-vagrantfile-for-triggers

I'm aiming to use some Ruby in a Vagrantfile to see what state the machine is in to decide which steps are needed in a trigger.before :destroy action.

Not being a Ruby programmer, I'm having some difficulty working out what code I'll need to use to access the state of the machine (or machines) in the Vagrantfile; can anyone help, please?

Thanks,

Iain.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/4bb2b973-966a-481d-a2c1-4ec10f43229a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezYqccf_8f4rpv%3DrBc_XYB3oVu8biQh%3D3nTfagsG3KuFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Detect machine state in a Vagrantfile for triggers

Iain Hallam
On Friday, 28 July 2017 17:52:25 UTC+1, Alvaro Miranda Aguilera wrote:
there is a plugin called vagrant triggers

<a href="https://github.com/emyl/vagrant-triggers" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Femyl%2Fvagrant-triggers\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNECoHPkMFo3SS5qjvy517C_I17gEQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Femyl%2Fvagrant-triggers\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNECoHPkMFo3SS5qjvy517C_I17gEQ&#39;;return true;">https://github.com/emyl/vagrant-triggers

have you seen it?

That's exactly what I'm using. The triggers are working fine, but I want to be able to vary my actions based on whether the VM is running or not.

Thanks,

Iain. 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/dc25ab17-8411-42ad-bc17-49e74e559376%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.