jantman / vagrant-r10k

UNSUPPORTED - SEEKING MAINTAINER - Vagrant middleware plugin to retrieve puppet modules using r10k.
MIT License
35 stars 12 forks source link

Separate config validation from provisioning #9

Closed jantman closed 9 years ago

jantman commented 9 years ago

I've recently gotten reports ( #7, #8 ) of r10k doing the module provisioning 2-3 times and this being a problem. For starters, investigate whether we can reliably separate config validation from provisioning, or whether there was a reason we're doing both all the time. The current behavior is that the r10k deploy actually runs twice; once during config validation and again during provisioning. This is pretty clearly because we're running the same code during both hooks - see lines 20-23 specifically line 22.

jantman commented 9 years ago

As an example, see https://github.com/berkshelf/vagrant-berkshelf/blob/master/lib/vagrant-berkshelf/plugin.rb and https://github.com/berkshelf/vagrant-berkshelf/blob/master/lib/vagrant-berkshelf/config.rb and https://github.com/berkshelf/vagrant-berkshelf/blob/master/lib/vagrant-berkshelf/action/base.rb#L17

jantman commented 9 years ago

So I think the plan is:

  1. add whatever additional checks we can to the config validation
  2. figure out some way to separate our config validation (including Puppetfile validation; #15) from the actual provisioning. Hook the first part after ConfigValidate, and the second part before Provision.

I think the key here is splitting the modulegetter logic between two classes, one for config validate and the other for provision. Provision would call the config validate one first.

jantman commented 9 years ago

Fixed with #23