I understand the spirit of your suggestion, but a Vagrantfile is Ruby, not
a bash script.

I need to be able to do this from within a Vagrantfile.  I should test
this, but can I check the exit code of Vagrant provisioners within the
Vagrantfile?

On Fri, Aug 12, 2016 at 6:06 AM, Alvaro Miranda Aguilera <[email protected]>
wrote:

> Since thats not any normal provisioner, you can just use a shell script
> that does that
>
> #!/bin/bash
>
> COUNT=0
>
> while ${count} -lt 3 ]; then
>   do
>       let COUNT=${COUNT}+1
>      <magic goes here>
>      if [ $? -eq 0 ] ; then
>        break
>      fi
>  done
>
> Something like that, not sure if the code is correct, but should give you
> an idea.
>
> Alvaro.
>
> On Fri, Aug 12, 2016 at 11:11 AM, Dan Dunckel <[email protected]>
> wrote:
>
>> Hey Alvaro,
>>
>> I've been using Puppet manifests, which should be idempotent.
>>
>> Nonetheless, there are times when things outside of our control cause
>> Puppet actions to fail, resulting in the provisioner failing.
>>
>> Ideally, I'd like to have a workflow like this:
>>
>>    - Vagrant up is started
>>    - A VM is built
>>    - A provisioner is run (configuring it to retry a maximum of 3 times)
>>       - First execution returns a non-zero exit code
>>       - Retry provisioner #1
>>       - Execution returns an exit code of 0
>>    - Another provisioner is run
>>    - Etc.
>>
>> Let me know if anything needs clarification or feedback.
>>
>> Thanks
>>
>> On Fri, Aug 12, 2016 at 12:38 AM, Alvaro Miranda Aguilera <
>> [email protected]> wrote:
>>
>>> you should make your scripts idempotent, that is they wont break if they
>>> are run twice
>>>
>>> then you can run vagrant provision to force a new run of the provision
>>> steps.
>>>
>>> is that what you are after?
>>>
>>> thanks
>>> Alvaro
>>>
>>> On Thu, Aug 11, 2016 at 7:53 PM, <[email protected]> wrote:
>>>
>>>> Is it possible to make Vagrant retry a failed provisioner?
>>>>
>>>> --
>>>> 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 [email protected].
>>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>>> gid/vagrant-up/5739d3f9-04ac-4f73-a798-11f9d7350ea0%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/vagrant-up/5739d3f9-04ac-4f73-a798-11f9d7350ea0%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Alvaro
>>> (+31)103400555
>>>
>>> --
>>> 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 a topic in the
>>> Google Groups "Vagrant" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/vagrant-up/9xAc1dj5iZI/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/vagrant-up/CAHqq0ezDigzwZSN_HXpqzp4_Rb_zSLVqdoSuPfZ6btNa
>>> u%2B8siQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezDigzwZSN_HXpqzp4_Rb_zSLVqdoSuPfZ6btNau%2B8siQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Sincerely,
>> Dan Dunckel
>> C:  760 703 9616
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/vagrant-up/CAG8LxfesmB5dVu0bt4ApjdvFtC8w%2B1fxk_H-fU%
>> 2BiaoT0ir3AuQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/vagrant-up/CAG8LxfesmB5dVu0bt4ApjdvFtC8w%2B1fxk_H-fU%2BiaoT0ir3AuQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Alvaro
> (+31)103400555
>
> --
> 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 a topic in the
> Google Groups "Vagrant" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/vagrant-up/9xAc1dj5iZI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/vagrant-up/CAHqq0ewAK37s9ocr7RNVEAWjo10nd
> 7pTO3r0_Xp3k95PT238Cg%40mail.gmail.com
> <https://groups.google.com/d/msgid/vagrant-up/CAHqq0ewAK37s9ocr7RNVEAWjo10nd7pTO3r0_Xp3k95PT238Cg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Sincerely,
Dan Dunckel
C:  760 703 9616

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CAG8LxfdnDdejVTmvjt7xLc_z8QpW8pWvkq6C8LYdaQ%2B0nkJLAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to