Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have my cfengine (2 and 3) files in a git repository fronted by gitolite.

Users of this repo have a pre-commit hook that will perform syntax/promise checks on the files as needed. This works fine.

To protect against someone not having the pre-commit hook, I would like to add a hook in the bare repository on the gitolite server. I know I need to use a pre-receive or update.secondary hook. Beyond that, I'm stumped.

I've found a number of sites with instructions on doing this with PHP fies, but those can be checked individually, but to my (admittedly limited) understanding of cfengine I need all the cfengine files before I can check them.

Short of having the hook clone the repo, how do I go about doing this?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Indeed, at the moment you need to have all your CFEngine files available to check them, since you will get a failure if, for example, some needed file is not present or if no bundlesequence is defined, regardless of whether the file syntax is correct.

Given this, I think you would need to clone the repo in the server. Once the repo is cloned, you could have your hook just update it, to reduce performance impact.

share|improve this answer
1  
And to note, you should use the update hook, not the pre-receive. The update will run for each individual branch, which is what you want. –  Andrew M. Mar 3 '12 at 1:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.