Skip to content

Commit

Permalink
Configuration check for election algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
andreisavu committed Jul 16, 2010
1 parent 87cfcdb commit 60111b7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions zoocfg.py
Expand Up @@ -156,6 +156,24 @@ def check(cls, cfg):

return warnings, errors

class ElectionAlgorithm(BaseRule):
""" Check the selected election algorithm """

@classmethod
def check(cls, cfg):
warnings, errors = [], []

if 'electionAlg' not in cfg:
errors.append('No `electionAlg` found in config file.')

elif cfg.electionAlg not in (0, 1, 2, 3):
errors.append('Unknown `electionAlg`. Valid values: 0, 1, 2, 3.')

elif cfg.electionAlg in (1, 2):
warnings.append('Election algorithm implementation 1 and 2 are no longer supported.')

return warnings, errors

def main(argv):
parser = OptionParser()

Expand Down

0 comments on commit 60111b7

Please sign in to comment.