Okay, thanks for the explanation, Brian.

On Fri, Aug 16, 2019 at 5:58 PM Brian Cain <[email protected]> wrote:

>
>
> On Fri, Aug 16, 2019 at 2:45 PM Jamie Jackson <[email protected]>
> wrote:
>
>> I have this:
>>
>>   config.trigger.after :destroy do |trigger|
>>
>>     trigger.info = "Removing provisioned directory contents:
>> #{host_provisioned_dir}/*"
>>
>>     trigger.run = {inline: "rm \"#{host_provisioned_dir}/\"* || true"}
>>
>>   end
>>
>> vagrant destroy gives this:
>>
>> ==> default: Running action triggers after destroy ...
>> ==> default: Running trigger...
>> ==> default: Removing provisioned directory contents:
>> /Users/jjackson/Sites/hud/hudx_git/vagrant_cfml/temp/provisioned/*
>>     default: Running local: Inline script
>>     default: rm
>> "/Users/jjackson/Sites/hud/hudx_git/vagrant_cfml/temp/provisioned/"* || true
>>     default: rm:
>> /Users/jjackson/Sites/hud/hudx_git/vagrant_cfml/temp/provisioned/*: No such
>> file or directory
>>     default: rm: ||: No such file or directory
>>     default: rm: true: No such file or directory
>> ==> default: Trigger run failed
>> ==> default: A script exited with an unacceptable exit code 1.
>> A script exited with an unacceptable exit code 1.
>>
>> It seems to be doing some strange and unexpected parsing of my command.
>>
>
> I know this isn't very intuitive :( I thought maybe there was an issue on
> GitHub to document this, but if you want to run bash, you need to wrap
> your run call in bash. The run option isn't bash like a shell provisioner.
> So if you did something like:
>
> trigger.run = {inline: "bash -c 'rm \"#{host_provisioned_dir}/\"* ||
> true'"}
>
> You'll get the desired effect I believe. I didn't test that, so you might
> have to mess with the nested quotes by the way. But the essential idea here
> is it needs to be wrapped in `bash -c` if you want to run a bash like your
> example
>
>>
>> Am I doing something wrong? Is it related to this?
>> https://github.com/hashicorp/vagrant/issues/10099
>>
>> Thanks,
>> Jamie
>>
>> --
>> 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/CA%2BonWPc2zYm%3D1A4HGi%3DgBr8yqh%2BFVEhZRe9TJGLNH2Q1XKcqEg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/vagrant-up/CA%2BonWPc2zYm%3D1A4HGi%3DgBr8yqh%2BFVEhZRe9TJGLNH2Q1XKcqEg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Brian Cain
>
> --
> 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/CADHESCXjwC%2BuTVpeiW8xfdmqFjKDRCVK%2BfNnisoAk0FozD2xdw%40mail.gmail.com
> <https://groups.google.com/d/msgid/vagrant-up/CADHESCXjwC%2BuTVpeiW8xfdmqFjKDRCVK%2BfNnisoAk0FozD2xdw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CA%2BonWPexRAPwfYeZ%2BNmtnBrZeTUOkGJwWrR0J0bqK%2BrP5wwZ9w%40mail.gmail.com.

Reply via email to