From b419ae3065554cf778ad00c44c33416bb8ea1850 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 20 Jul 2012 13:47:46 -0400 Subject: made -B (skip bundle) mode work with -Q (bundle-quick mode) --- src/lib/Bcfg2/Client/Frame.py | 8 +++++--- src/sbin/bcfg2 | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/lib/Bcfg2/Client/Frame.py b/src/lib/Bcfg2/Client/Frame.py index 51bc4aec7..b456738d0 100644 --- a/src/lib/Bcfg2/Client/Frame.py +++ b/src/lib/Bcfg2/Client/Frame.py @@ -299,9 +299,11 @@ class Frame: bundles = filter(lambda b: b.tag != 'Bundle', bundles) if self.setup['skipbundle']: # warn if non-existent bundle given - for bundle in self.setup['skipbundle']: - if bundle not in all_bundle_names: - self.logger.info("Warning: Bundle %s not found" % bundle) + if not self.setup['bundle_quick']: + for bundle in self.setup['skipbundle']: + if bundle not in all_bundle_names: + self.logger.info("Warning: Bundle %s not found" % + bundle) bundles = filter(lambda b: \ b.get('name') not in self.setup['skipbundle'], bundles) diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 4fbbef877..4c1514117 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -57,8 +57,8 @@ class Client: 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") + if not self.setup['bundle'] and not self.setup['skipbundle']: + self.logger.error("-Q option requires -b or -B") raise SystemExit(1) elif self.setup['remove']: self.logger.error("-Q option incompatible with -r") @@ -264,7 +264,10 @@ class Client: [newconfig.append(bundle) for bundle in self.config.getchildren() if (bundle.tag == 'Bundle' and - bundle.get('name') in self.setup['bundle'])] + ((self.setup['bundle'] and + bundle.get('name') in self.setup['bundle']) or + (self.setup['skipbundle'] and + bundle.get('name') not in self.setup['skipbundle'])))] self.config = newconfig self.tools = Bcfg2.Client.Frame.Frame(self.config, -- cgit v1.2.3-1-g7c22