On Sep 10, 2011, at 9:26 PM, Nigel Kersten wrote:

> On Sat, Sep 10, 2011 at 5:36 PM, Jon Forrest <nob...@gmail.com> wrote:
> 
>> We use puppet to distribute named zone files, like many
>> of you do. We use git to maintain these files, which are
>> then pulled by the puppet master machine. These zone files are
>> actually puppet template .erb files.
>> 
>> The other day, I made a mistake which resulted in some zone
>> files with syntax errors in them. Puppet faithfully distributed
>> the erroneous zone files to the name servers, which killed them.
>> 
>> To prevent this from happening again, I want to be able to
>> somehow expand the template files and run named-checkzone
>> as part of a git pre-commit hook. I want this expansion to
>> occur without making a normal puppet run so that the bad
>> files won't get distributed.
>> 
>> Can anybody point me to a technique for doing this?
>> 
> 
> 
> git cat-file blob :0:$indexfile | erb -x -T - | ruby -c 2> $error_msg >
> /dev/null ;
> 
> from:
> 
> http://projects.puppetlabs.com/projects/1/wiki/Puppet_Version_Control
> 
> should get you going.
> 


Maybe I'm missing something here, but I think Jon was asking something a bit 
different -- he doesn't want to check the validity of the erb template (i.e. 
ruby syntax check) but syntax check the named zone file generated by the 
template. 

So the tricky bit is how to get the variables out of the puppet manifests that 
the erb template needs to generate the output file that 'would' be generated by 
a new puppet run for this node -- without the actual puppet run (as he asks at 
the end of the email).

My first thought is that the only accurate way to do this is by doing a full 
puppet run, as any part of the node's manifest could effect the variables used 
in the zone file template. You should be able to get away with a --noop run so 
the changes won't actually be applied (because noop does generate files from 
templates, but you would need to have a way to capture the newly generated zone 
file on the client host and run the named-checkzone there.

Cheers,

Jonathan
-------------------------------------------------------------------------------
Jonathan Stanton         jonat...@spreadconcepts.com
Spread Group Messaging  www.spread.org
Spread Concepts LLC     www.spreadconcepts.com
-------------------------------------------------------------------------------




> 
> 
> 
>> 
>> Cordially,
>> Jon Forrest
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to puppet-users+unsubscribe@**
>> googlegroups.com <puppet-users%2bunsubscr...@googlegroups.com>.
>> For more options, visit this group at http://groups.google.com/**
>> group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
>> .
>> 
>> 
> 
> 
> -- 
> Nigel Kersten
> Product Manager, Puppet Labs
> 
> *Join us for **PuppetConf *
> <http://www.bit.ly/puppetconfsig>
> Sept 22/23 Portland, Oregon, USA.
> *
> *
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to