From ee125da42e0c80614c79517f0f7df9fa6d7a9b4c Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 11 Apr 2011 08:31:35 -0400 Subject: Added two flags to bcfg2-repo-validate: * --schema allows you to specify a custom path to the XML Schema files * --stdin allows you to specify a list of files on stdin and bcfg2-repo-validate will only validate those files. This is particularly useful to speed up validation checks in post-commit hooks (or similar). --- src/lib/Options.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib/Options.py') diff --git a/src/lib/Options.py b/src/lib/Options.py index 4041ccf78..f64b491d5 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -201,6 +201,12 @@ PARANOID_MAX_COPIES = Option('Specify the number of paranoid copies you want', OMIT_LOCK_CHECK = Option('Omit lock check', default=False, cmd='-O') CORE_PROFILE = Option('profile', default=False, cmd='-p', ) +FILES_ON_STDIN = Option('Operate on a list of files supplied on stdin', + cmd='--stdin', default=False, long_arg=True) +SCHEMA_PATH = Option('Path to XML Schema files', cmd='--schema', + odesc='', + default="%s/share/bcfg2/schemas" % DEFAULT_INSTALL_PREFIX, + long_arg=True) # Metadata options MDATA_OWNER = Option('Default Path owner', -- cgit v1.2.3-1-g7c22 From 5819d7182ac703c9f830df1ea2b940fbfa976db7 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 13 Apr 2011 13:29:48 -0400 Subject: A property file can now have a matching .xsd file (e.g., "Properties/foo.xml" and "Properties/foo.xsd") which specifies a schema for that property file. bcfg2-repo-validate will check the property file against its schema. Updated bcfg2-repo-validate man page with several new options. --- src/lib/Options.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib/Options.py') diff --git a/src/lib/Options.py b/src/lib/Options.py index f64b491d5..1973e7091 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -207,6 +207,8 @@ SCHEMA_PATH = Option('Path to XML Schema files', cmd='--schema', odesc='', default="%s/share/bcfg2/schemas" % DEFAULT_INSTALL_PREFIX, long_arg=True) +REQUIRE_SCHEMA = Option("Require property files to have matching schema files", + cmd="--require-schema", default=False, long_arg=True) # Metadata options MDATA_OWNER = Option('Default Path owner', -- cgit v1.2.3-1-g7c22 From d3348a34c78ba13d4d4c3e96db19faeeeefac11b Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Wed, 27 Apr 2011 11:40:08 -0500 Subject: Common: Add full PY3K compatibility Signed-off-by: Sol Jerome --- src/lib/Options.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/Options.py') diff --git a/src/lib/Options.py b/src/lib/Options.py index 1973e7091..d5304e696 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -1,11 +1,12 @@ """Option parsing library for utilities.""" __revision__ = '$Revision$' -import ConfigParser import getopt import os import sys import Bcfg2.Client.Tools +# Compatibility imports +from Bcfg2.Bcfg2Py3k import ConfigParser def bool_cook(x): if x: @@ -146,7 +147,8 @@ class OptionSet(dict): try: opts, args = getopt.getopt(argv, self.buildGetopt(), self.buildLongGetopt()) - except getopt.GetoptError, err: + except getopt.GetoptError: + err = sys.exc_info()[1] self.helpExit(err) if '-h' in argv: self.helpExit('', 0) -- cgit v1.2.3-1-g7c22