diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2010-12-08 21:38:26 -0600 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2010-12-08 21:38:26 -0600 |
commit | 19dd6674fe58f3f83a5fa85d2f8ebacf2bfd5e13 (patch) | |
tree | 469b18580161c0cac4bb751286c0abf8e0b70fc1 | |
parent | b9d71aacc622bd285460cbe7d86b7a538c80880d (diff) | |
download | bcfg2-19dd6674fe58f3f83a5fa85d2f8ebacf2bfd5e13.tar.gz bcfg2-19dd6674fe58f3f83a5fa85d2f8ebacf2bfd5e13.tar.bz2 bcfg2-19dd6674fe58f3f83a5fa85d2f8ebacf2bfd5e13.zip |
bcfg2 client: implement bundle-quick mode
-rw-r--r-- | src/lib/Options.py | 2 | ||||
-rwxr-xr-x | src/sbin/bcfg2 | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/Options.py b/src/lib/Options.py index b467a776d..1dcad6427 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -290,6 +290,8 @@ CLIENT_REMOVE = Option('force removal of additional configuration items', default=False, cmd='-r', odesc="<entry type|all>") CLIENT_BUNDLE = Option('only configure the given bundle(s)', default=[], cmd='-b', odesc='<bundle:bundle>', cook=colon_split) +CLIENT_BUNDLEQUICK = Option('only verify/configure the given bundle(s)', default=False, + cmd='-Q') CLIENT_INDEP = Option('only configure the given bundle(s)', default=False, cmd='-z') CLIENT_KEVLAR = Option('run in kevlar (bulletproof) mode', default=False, diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 3407a1c53..10262e4a9 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -49,6 +49,7 @@ class Client: 'dryrun': Bcfg2.Options.CLIENT_DRYRUN, 'paranoid': Bcfg2.Options.CLIENT_PARANOID, 'bundle': Bcfg2.Options.CLIENT_BUNDLE, + 'bundle-quick': Bcfg2.Options.CLIENT_BUNDLEQUICK, 'indep': Bcfg2.Options.CLIENT_INDEP, 'file': Bcfg2.Options.CLIENT_FILE, 'interactive': Bcfg2.Options.INTERACTIVE, @@ -62,7 +63,6 @@ class Client: 'password': Bcfg2.Options.SERVER_PASSWORD, 'retries': Bcfg2.Options.CLIENT_RETRIES, 'kevlar': Bcfg2.Options.CLIENT_KEVLAR, - 'key': Bcfg2.Options.SERVER_KEY, 'decision-list': DECISION_LIST, 'encoding': Bcfg2.Options.ENCODING, 'omit-lock-check': Bcfg2.Options.OMIT_LOCK_CHECK, @@ -93,6 +93,13 @@ class Client: to_file=self.setup['filelog']) self.logger = logging.getLogger('bcfg2') self.logger.debug(self.setup) + if self.setup['bundle-quick']: + if self.setup['bundle'] == []: + self.logger.error("-Q option requires -b") + raise SystemExit(1) + elif self.setup['remove'] != False: + self.logger.error("-Q option incompatible with -r") + raise SystemExit(1) if 'drivers' in self.setup and self.setup['drivers'] == 'help': self.logger.info("The following drivers are available:") self.logger.info(Bcfg2.Client.Tools.drivers) @@ -251,6 +258,12 @@ class Client: self.fatal_error("Server error: %s" % (self.config.text)) return(1) + if self.setup['bundle-quick']: + newconfig = Bcfg2.Client.XML.XML('<Configuration/>') + [newconfig.append(bundle) for bundle in self.config.getchildren() if \ + bundle.tag == 'Bundle' and bundle.get('name') in self.setup['bundle']] + self.config = newconfig + self.tools = Bcfg2.Client.Frame.Frame(self.config, self.setup, times, self.setup['drivers'], @@ -281,7 +294,7 @@ class Client: except OSError: self.logger.error("Failed to unlock lockfile %s" % lockfile.name) - if not self.setup['file']: + if not self.setup['file'] and not self.setup['bundle-quick']: # upload statistics feedback = self.tools.GenerateStats() |