Hi,
Sorry to respond to an old thread but I've a similar problem and figured it
would be better to the questions with the same topic together.
On Tuesday, June 4, 2013 at 1:01:32 AM UTC+1, Igor Serebryany wrote:
<snip>
Basically, I want to be able to hook my plugin after a VM has booted but
> before provisioners run. I can't figure out what hooks are available and
> existing plugins do this in a myriad ways, which I'm having trouble getting
> working. I think this is a big gap in the documentation for budding plugin
> writers such as myself.
>
<snip>
> Thanks,
> --Igor
>
Essentially I'm running into the same problem, I'd like to move some
actions to be run at the end or the boot phase or just before where the
provisioners run in a manner that works across multiple providers. Main
reason, is I want the network configuration to have completed, but the
actions associated with that tend to vary significantly between providers.
So far I have the following approaches:
1. hook.after ::Vagrant::Action::Builtin::Provision, <block>
2. action_hook(:provisioner_run) { |hook| hook.before :run_provisioner,
<block> }
On option "1" - Where you have multiple actions in order to run them after
the network is ready, they must be run on the down hook and in reverse
order. This takes some getting used to and also makes it more difficult for
someone to hook around these actions in turn.
Is it possible to wrap multiple actions with one action, where the
sub-actions are treated as a separate chain of actions? That way I can hook
the top action on the up or down part of the hook, but the sub actions will
always then be run in the same order without also needing to be switched
around. This would also lead to less surprises for other plugins looking to
hook into those actions.
On Option "2" - This triggers before each provisioner, so would need to
ensure that it's only executed once per machine when 'vagrant provision' is
called instead of once per provisioner defined. Seen something in
vagrant-proxyconf that would handle that.
Are there any better approaches? Any other higher level abstraction points
such as after providers, or any way to only run before Builtin::Provision
when it's going through the provisioners phase and skip when it's doing so
during the VM boot phase?
--
Darragh
--
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].
For more options, visit https://groups.google.com/d/optout.