From 2fc2ad4287d49b050df5a87ca8f3f56f2be25142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Wei=C3=9F?= Date: Mon, 12 Sep 2011 15:26:04 +0200 Subject: bcfg2: Ignore "-l" if configuring from a file The "-f" option, which tells the client to configure from a file rather than querying the server, cannot be combined with the "-l" option (nor with the equivalent setting in the bcfg2.conf(5) file), as a decision list won't be available. Instead of crashing (with a KeyError: 'decision_list'), the client will now ignore the "-l" option if the "-f" option also is specified. --- src/lib/Client/Frame.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/lib/Client') diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index 5eac86d18..eca8960c1 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -172,23 +172,23 @@ class Frame: # Need to process decision stuff early so that dryrun mode works with it self.whitelist = [entry for entry in self.states \ if not self.states[entry]] - if self.setup['decision'] == 'whitelist': - dwl = self.setup['decision_list'] - w_to_rem = [e for e in self.whitelist \ - if not matches_white_list(e, dwl)] - if w_to_rem: - self.logger.info("In whitelist mode: suppressing installation of:") - self.logger.info(["%s:%s" % (e.tag, e.get('name')) for e in w_to_rem]) - self.whitelist = [x for x in self.whitelist \ - if x not in w_to_rem] - - elif self.setup['decision'] == 'blacklist': - b_to_rem = [e for e in self.whitelist \ - if not passes_black_list(e, self.setup['decision_list'])] - if b_to_rem: - self.logger.info("In blacklist mode: suppressing installation of:") - self.logger.info(["%s:%s" % (e.tag, e.get('name')) for e in b_to_rem]) - self.whitelist = [x for x in self.whitelist if x not in b_to_rem] + if not self.setup['file']: + if self.setup['decision'] == 'whitelist': + dwl = self.setup['decision_list'] + w_to_rem = [e for e in self.whitelist \ + if not matches_white_list(e, dwl)] + if w_to_rem: + self.logger.info("In whitelist mode: suppressing installation of:") + self.logger.info(["%s:%s" % (e.tag, e.get('name')) for e in w_to_rem]) + self.whitelist = [x for x in self.whitelist \ + if x not in w_to_rem] + elif self.setup['decision'] == 'blacklist': + b_to_rem = [e for e in self.whitelist \ + if not passes_black_list(e, self.setup['decision_list'])] + if b_to_rem: + self.logger.info("In blacklist mode: suppressing installation of:") + self.logger.info(["%s:%s" % (e.tag, e.get('name')) for e in b_to_rem]) + self.whitelist = [x for x in self.whitelist if x not in b_to_rem] # take care of important entries first if not self.dryrun and not self.setup['bundle']: -- cgit v1.2.3-1-g7c22