- 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/confluence_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__), './confluence_backup.config') 13 13 14 CONFLUENCE_SCHEMA = bck.get_backup_schema() 15 16 17 def make_confluence_schema(): 18 schema = ConfigSchema(None) 19 schema.add_section(bck.DEFAULT_SCHEMA_SECTION) 20 schema.add_section(bck.COPY_SCHEMA_SECTION) 21 schema.add_section(bck.TAR_SCHEMA_SECTION) 22 schema.add_section(bck.MYSQLDUMP_SCHEMA_SECTION) 23 return schema 14 CONFLUENCE_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 ) 24 47 25 48 26 49 class ConfluenceBackup(Backup): 27 50 28 def __init__(self, config_file=EXPECTED_CONFIG_FILE, schema=None): 29 if schema is None: 30 schema = make_confluence_schema() 51 def __init__(self, config_file=EXPECTED_CONFIG_FILE, schema=CONFLUENCE_SCHEMA): 31 52 self.load_config(config_file, schema) 32 53
Note:
See TracChangeset
for help on using the changeset viewer.
