Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
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


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.