christopher floess <[email protected]> writes:
>> We work on this by keeping the puppet configuration in Subversion. We then
>> have a Makefile at the top level which runs a puppet syntax check on any
>> modified file before a commit.
>
> Uh, would you mind divulging to someone with a little less experience, how
> this syntax check works? I can read make, if you just want to post the
> contents of it.
Requires GNU Make, and possibly bash as the default shell:
check := pp erb rb
check_pp = puppet --confdir=/tmp --vardir=/tmp --parseonly --ignoreimport \
--color=false --modulepath=./modules $< && echo "$< syntax OK"
check_erb = echo -n "$<: " && erb -x -T '-' $< | ruby -c
check_rb = echo -n "$<: " && ruby -c $<
define check_conflicts
if /bin/egrep -q -x -e '^(<<<<<<<|=======|>>>>>>>)' '$<'; then echo "ERROR:
conflict marker found in $@"; /bin/false; else :; fi
endef
all: pull test
push: all
@echo "Committing your changes to the upstream server..."
@svn commit
to_test := $(foreach ext,$(check),$(shell find * -name "*.$(ext)" -printf
'.check/%p\n' | sort))
test: $(to_test)
.check/%: ext=$(subst .,,$(suffix $(<F)))
.check/%: %
@mkdir -p $(dir $@)
@$(check_conflicts)
@$(or $(check_$(ext)),$(error syntax rule check_$(ext) is not defined))
@touch $@
> Thanks in advance,
Don't thank me until you see the code. ;)
Daniel
Also, this is edited to excise support for git, and remove extraneous bits and
some other extension-based syntax checks for non-puppet bits we use.
--
✣ Daniel Pittman ✉ [email protected] ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.