<s> """<STR_LIT>""" <EOL> import sys <EOL> import whisper <EOL> from os . path import dirname , exists , join , realpath <EOL> from ConfigParser import ConfigParser <EOL> if len ( sys . argv ) == <NUM_LIT:2> : <EOL> SCHEMAS_FILE = sys . argv [ <NUM_LIT:1> ] <EOL> print "<STR_LIT>" % SCHEMAS_FILE <EOL> else : <EOL> SCHEMAS_FILE = realpath ( join ( dirname ( __file__ ) , '<STR_LIT:..>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> print "<STR_LIT>" % SCHEMAS_FILE <EOL> config_parser = ConfigParser ( ) <EOL> if not config_parser . read ( SCHEMAS_FILE ) : <EOL> print "<STR_LIT>" % SCHEMAS_FILE <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> errors_found = <NUM_LIT:0> <EOL> for section in config_parser . sections ( ) : <EOL> print "<STR_LIT>" % section <EOL> options = dict ( config_parser . items ( section ) ) <EOL> retentions = options [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) <EOL> archives = [ ] <EOL> section_failed = False <EOL> for retention in retentions : <EOL> try : <EOL> archives . append ( whisper . parseRetentionDef ( retention ) ) <EOL> except ValueError , e : <EOL> print "<STR_LIT>" % ( section , retention ) <EOL> print "<STR_LIT>" % e . message <EOL> section_failed = True <EOL> if not section_failed : <EOL> try : <EOL> whisper . validateArchiveList ( archives ) <EOL> except whisper . InvalidConfiguration , e : <EOL> print "<STR_LIT>" % ( section , '<STR_LIT:U+002C>' . join ( retentions ) ) <EOL> print "<STR_LIT>" % e . message <EOL> if section_failed : <EOL> errors_found += <NUM_LIT:1> <EOL> else : <EOL> print "<STR_LIT>" <EOL> if errors_found : <EOL> print <EOL> print "<STR_LIT>" % SCHEMAS_FILE <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> print <EOL> print "<STR_LIT>" % SCHEMAS_FILE </s>
