diff options
author | Holger Weiß <holger@zedat.fu-berlin.de> | 2011-09-12 15:26:04 +0200 |
---|---|---|
committer | Holger Weiß <holger@zedat.fu-berlin.de> | 2011-09-12 15:26:04 +0200 |
commit | 2fc2ad4287d49b050df5a87ca8f3f56f2be25142 (patch) | |
tree | d52ab21f800e752cc31998d7470c53450db1e286 /src/lib/Client | |
parent | 49e51224e3b7637c516ad11391e0e382a158d501 (diff) | |
download | bcfg2-2fc2ad4287d49b050df5a87ca8f3f56f2be25142.tar.gz bcfg2-2fc2ad4287d49b050df5a87ca8f3f56f2be25142.tar.bz2 bcfg2-2fc2ad4287d49b050df5a87ca8f3f56f2be25142.zip |
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.
Diffstat (limited to 'src/lib/Client')
-rw-r--r-- | src/lib/Client/Frame.py | 34 |
1 files changed, 17 insertions, 17 deletions
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']: |