IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 22, 2019, 2:30:49 PM (7 years ago)
Author:
fairlamb
Message:

fixed calling as main + tests, removed argsparse from most

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ipp-259_genericise_backups/tools/backups/mailman_backup.py

    r40958 r40962  
    1 import argparse
    21import os.path as path
    32
    4 import backups.utils.config_parse_helper as cfg_help
    5 from backups.backup import Backup
    6 from backups.utils.config_parse_helper import ConfigSchema, ConfigSchemaSection, ConfigSchemaLine
     3import utils.config_parse_helper as cfg_help
     4from backup import Backup
     5from utils.config_parse_helper import ConfigSchema, ConfigSchemaSection, ConfigSchemaLine
    76
    87EXPECTED_CONFIG_FILE = path.join(path.dirname(__file__), './mailman_backup.config')
     
    3231
    3332
    34 def main():
    35     mb = MailmanBackup()
    36     mb.run_backup()
    37 
    38 
    39 def parse_args(args):
    40 
    41     parser = argparse.ArgumentParser(
    42         description='Performs backup of mailman.')
    43 
    44     parser.add_argument('--config_file',
    45         nargs='?',
    46         help='specify the location of a config that matches the ConfigSchema',
    47         default=EXPECTED_CONFIG_FILE)
    48 
    49     return parser.parse_args()
     33def main(config=EXPECTED_CONFIG_FILE, schema=MAILMAN_SCHEMA):
     34    mb = MailmanBackup(config, schema)
     35    mb.run_backup_processes()
    5036
    5137
Note: See TracChangeset for help on using the changeset viewer.