- Timestamp:
- Oct 18, 2019, 1:34:52 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ipp-259_genericise_backups/tools/backups/jira_backup.py
r40949 r40950 4 4 import os.path as path 5 5 6 import backups.backup as bck 6 import backups.utils.config_parse_helper as cfg_help 7 import backups.utils.errors as errs 7 8 import backups.utils.subprocess_utils as sub_utils 8 import backups.utils.errors as errs9 9 from backups.backup import Backup 10 from backups.utils.config_parse_helper import ConfigSchema 10 from backups.utils.config_parse_helper import ConfigSchema, ConfigSchemaSection, ConfigSchemaLine 11 11 12 12 EXPECTED_CONFIG_FILE = path.join(path.dirname(__file__), './jira_backup.config') 13 13 14 15 def make_jira_schema(): 16 schema = ConfigSchema(None) 17 schema.add_section(bck.DEFAULT_SCHEMA_SECTION) 18 schema.add_section(bck.COPY_SCHEMA_SECTION) 19 schema.add_section(bck.TAR_SCHEMA_SECTION) 20 schema.add_section(bck.MYSQLDUMP_SCHEMA_SECTION) 21 return schema 14 JIRA_SCHEMA = ConfigSchema( 15 [ ConfigSchemaSection('DEFAULT', 16 [ ConfigSchemaLine('backup_paths', True, list, 17 cfg_help.SpecialSchemaProcessing.commma_separated) 18 , ConfigSchemaLine('source_machine', True, str) 19 , ConfigSchemaLine('verbose', False, bool) 20 , ConfigSchemaLine('make_dirs', False, bool) 21 ]) 22 , ConfigSchemaSection('COPY', 23 [ ConfigSchemaLine('sources', True, list, 24 cfg_help.SpecialSchemaProcessing.commma_separated) 25 , ConfigSchemaLine('additional_args', False, list, 26 cfg_help.SpecialSchemaProcessing.space_separated) 27 ]) 28 , ConfigSchemaSection('TAR', 29 [ ConfigSchemaLine('sources', True, list, 30 cfg_help.SpecialSchemaProcessing.commma_separated) 31 , ConfigSchemaLine('additional_args', False, list, 32 cfg_help.SpecialSchemaProcessing.space_separated) 33 , ConfigSchemaLine('target_filename', True, str) 34 , ConfigSchemaLine('prefix_date', True, bool) 35 ]) 36 , ConfigSchemaSection('MYSQLDUMP', 37 [ ConfigSchemaLine('user', True, str) 38 , ConfigSchemaLine('password', True, str) 39 , ConfigSchemaLine('db_name', True, str) 40 , ConfigSchemaLine('additional_args', False, list, 41 cfg_help.SpecialSchemaProcessing.space_separated) 42 , ConfigSchemaLine('target_filename', True, str) 43 , ConfigSchemaLine('prefix_date', True, bool) 44 ]) 45 ] 46 ) 22 47 23 48 24 49 class JiraBackup(Backup): 25 50 26 def __init__(self, config_file=EXPECTED_CONFIG_FILE, schema=None): 27 if schema is None: 28 schema = make_jira_schema() 51 def __init__(self, config_file=EXPECTED_CONFIG_FILE, schema=JIRA_SCHEMA): 29 52 self.load_config(config_file, schema) 30 53
Note:
See TracChangeset
for help on using the changeset viewer.
