config: add dynamic generation of relaxng schema for config validation
PATCH 1/1 config: add dynamic generation of relaxng schema for config validation
Add new tool ccs_update_schema
Modify ccs_config_validate to call ccs_update_schema
This feature requires resource-agents 3.9.2 and fence-agents 3.1.5 and xsltproc available on the installed system.
Resolves: rhbz#680930
Signed-off-by Fabio M. Di Nitto <[email protected]>
--- config/tools/man/Makefile | 1 + config/tools/man/ccs_config_validate.8 | 4 + config/tools/man/ccs_update_schema.8 | 29 + config/tools/xml/Makefile | 19 +- config/tools/xml/ccs_config_validate.in | 25 +- config/tools/xml/ccs_update_schema.in | 311 +++ config/tools/xml/cluster.rng.in | 4309 ------------------------------- config/tools/xml/cluster.rng.in.head | 1049 ++++++++ config/tools/xml/cluster.rng.in.tail | 1 + make/install.mk | 8 + make/uninstall.mk | 6 + 11 files changed, 1447 insertions(+), 4315 deletions(-) create mode 100644 config/tools/man/ccs_update_schema.8 create mode 100644 config/tools/xml/ccs_update_schema.in delete mode 100644 config/tools/xml/cluster.rng.in create mode 100644 config/tools/xml/cluster.rng.in.head create mode 100644 config/tools/xml/cluster.rng.in.tail
config/tools/man/Makefile +1 -0
@@ -1,6 +1,7 @@ MANTARGET= \ ccs_config_dump.8 \ ccs_config_validate.8 \ + ccs_update_schema.8 \ ccs_tool.8 \ confdb2ldif.8
config/tools/man/ccs_config_validate.8 +4 -0
@@ -24,6 +24,10 @@ Validate an alternate config file without preloading it with default values. Validate an alternate config file with preloading of default values (recommended option). .SS "Advanced options:" .TP +\fB\-u\fR +Do not update relaxng schema (see ccs_update_schema.8) +.HP +.TP \fB\-r\fR Force validation of runtime config .HP
config/tools/man/ccs_update_schema.8 new file +29 -0
@@ -0,0 +1,29 @@ +.TH "ccs_update_schema" "8" "" "" "" +.SH "NAME" +ccs_update_schema \- Tool to generate cluster relaxng schema for cluster config validation. + +.SH "SYNOPSIS" +.B ccs_update_schema +[\fIOPTION\fR].. + +.SH "DESCRIPTION" + +\fBccs_update_schema\fP is part of the Cluster Configuration System (CCS). +It is used to update the cluster relaxng schema that validates cluster.conf. + +.SH "OPTIONS" +.TP +\fB\-h\fP +Help. Print out the usage. +.TP +\fB\-V\fP +Print the version information. +.TP +\fB\-v\fP +Be verbose. Mostly for debugging purposes. +.TP +\fB\-f\fP +Ignore local stored cache and regenerate a fresh schema. + +.SH "SEE ALSO" +ccs_config_validate(8), cluster.conf(5)
config/tools/xml/Makefile +14 -5
@@ -2,12 +2,14 @@ include ../../../make/defines.mk TARGET1 = ccs_config_dump TARGET2 = ccs_config_validate -TARGET3 = cluster.rng +TARGET3 = ccs_update_schema +TARGET4 = cluster.rng -SBINDIRT = $(TARGET1) $(TARGET2) -SHAREDIRT = $(TARGET3) +SBINDIRT = $(TARGET1) $(TARGET2) $(TARGET3) +SHAREDIRSYMT = $(TARGET4) +RELAXNGDIRT = cluster.rng.in.head cluster.rng.in.tail -all: $(TARGET1) $(TARGET2) $(TARGET3) +all: $(TARGET1) $(TARGET2) $(TARGET3) $(TARGET4) include $(OBJDIR)/make/cobj.mk include $(OBJDIR)/make/clean.mk
@@ -33,6 +35,13 @@ ${TARGET2}: $(S)/${TARGET2}.in > $(TARGET2) ${TARGET3}: $(S)/${TARGET3}.in - cp $(S)/${TARGET3}.in ${TARGET3} + cat $(S)/$(TARGET3).in | sed \ + -e 's#@SBINDIR@#${sbindir}#g' \ + -e 's#@SHAREDIR@#${sharedir}#g' \ + -e 's#@VERSION@#${RELEASE_VERSION}#g' \ + > $(TARGET3) + +${TARGET4}: + ln -sf /var/lib/cluster/cluster.rng ${TARGET4} clean: generalclean
config/tools/xml/ccs_config_validate.in +24 -1
@@ -42,6 +42,7 @@ print_usage() { echo " -l configfile Validate an alternate config file (load test)" echo "" echo "Advanced options:" + echo " -u Do not update relaxng schema" echo " -r Force validation of runtime config" echo " -C config_loader Override config plugin loader" echo " -t tempfile Force temporay file to tempfile"
@@ -135,6 +136,9 @@ check_opts() { exit 255 fi ;; + -u) + updaterelaxng=0 + ;; esac shift done
@@ -146,7 +150,7 @@ lecho() return 0 } -opts=$(getopt t:hVnC:f:l:rR:ovq $@) +opts=$(getopt t:hVnC:f:l:rR:ovqu $@) if [ "$?" != 0 ]; then print_usage >&2 exit 255
@@ -182,6 +186,25 @@ else fi lecho "Configuration stored in temporary file" +lecho "Updating relaxng schema" +if [ "$updaterelaxng" != 0 ]; then + updateerr="$(ccs_update_schema 2>&1)" + if [ $? != 0 ]; then + echo "Unable to update relaxng schema: $updateerr" >&2 + exit 255 + fi +fi + +if [ -f /var/lib/cluster/rng_update.lock ]; then + echo "Relax-ng schema update in progress" >&2 + exit 255 +fi + +if [ ! -e @SHAREDIR@/cluster.rng ]; then + echo "Unable to verify a configuration without relaxng schema" >&2 + exit 255 +fi + lecho "Validating.." xmlout=$(xmllint --noout \
config/tools/xml/ccs_update_schema.in new file +311 -0
311 lines not on this page · raw message
config/tools/xml/cluster.rng.in deleted +0 -4309
2,562 lines not on this page · raw message
config/tools/xml/cluster.rng.in.head new file +1049 -0
1,049 lines not on this page · raw message
config/tools/xml/cluster.rng.in.tail new file +1 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.4.4
Part of the diff is not shown here. View the raw message.