IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 3, 2019, 11:51:21 AM (7 years ago)
Author:
fairlamb
Message:

Better errors, chmod wrapper, fixed config loading and tests

Location:
branches/ipp-132_automate_jira_conf_backups/backups
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ipp-132_automate_jira_conf_backups/backups/backup_atlassian_applications.py

    r40896 r40897  
    1313# a restructure would be needed
    1414# Ideally, the utils should be added to the path.
    15 import utils.subprocess_utils as sub_utils
    16 
    17 
    18 DEFAULT_CONFIG_FILE = path.abspath('./atlassian_backups.config')
     15import subprocess_utils as sub_utils
     16
     17
     18DEFAULT_CONFIG_FILE = path.join(path.dirname(__file__), 'atlassian_backups.config')
    1919
    2020
     
    236236        jira_tar_name = datetime.date.today().strftime("%Y_%m_%d") + "_jira_attachments.tar"
    237237        jira_tar_filepath = path.join(latest_paths[0], jira_tar_name)
    238         jira_tar_args = ["-cf", jira_tar_filepath, self.jira_attachments_path]
     238        jira_tar_args = ["-C", "/", "-cf", jira_tar_filepath, self.jira_attachments_path.strip('/')]
    239239        sub_utils.tar_wrapper(jira_tar_args)
    240240        sub_utils.chmod_wrapper(['774', jira_tar_filepath])
     
    246246        confluence_tar_name = datetime.date.today().strftime("%Y_%m_%d") + "_confluence_attachments.tar"
    247247        confluence_tar_filepath = path.join(latest_paths[0], confluence_tar_name)
    248         confluence_tar_args = ["-cf", confluence_tar_filepath, self.conf_attachments_path]
     248        confluence_tar_args = ["-C", "/", "-cf", confluence_tar_filepath, self.conf_attachments_path.strip('/')]
    249249        sub_utils.tar_wrapper(confluence_tar_args)
    250250        sub_utils.chmod_wrapper(['774', confluence_tar_filepath])
  • branches/ipp-132_automate_jira_conf_backups/backups/backup_atlassian_applications_test.py

    r40894 r40897  
    88
    99import full_atlassian_backup_test as fab_test
    10 import utils.subprocess_utils as sub_utils
     10import subprocess_utils as sub_utils
    1111
    1212from backup_atlassian_applications import AtlassianBackups
    1313
    14 TEST_DEFAULT_CONFIG_FILE = "./testing/test.config"
     14TEST_DEFAULT_CONFIG_FILE = os.path.join(os.path.dirname(__file__), './testing/test.config')
    1515
    1616
     
    4747
    4848    def test_default_config_loads_with_no_args(self):
    49         assert os.path.exists("./atlassian_backups.config")
     49        default_config = baa.DEFAULT_CONFIG_FILE
     50        assert os.path.exists(default_config)
    5051        ab = AtlassianBackups()
    5152        assert ab.host_backup_path      == "/export/ippops4.0/atlassian_backups"
  • branches/ipp-132_automate_jira_conf_backups/backups/full_atlassian_backup_test.py

    r40893 r40897  
    66
    77from backup_atlassian_applications import AtlassianBackups
    8 
    9 TEST_DEFAULT_CONFIG_FILE = "./testing/test.config"
    10 
    118
    129def create_all_paths_and_folders(ab_class: AtlassianBackups, tmpdir) -> AtlassianBackups:
     
    140137
    141138    def test_entire_process(self, tmpdir):
    142         ab = AtlassianBackups(config_file=TEST_DEFAULT_CONFIG_FILE)
     139        test_config_file = os.path.join(os.path.dirname(__file__), 'testing', 'test.config')
     140
     141        ab = AtlassianBackups(config_file=test_config_file)
    143142        ab = create_all_paths_and_folders(ab, tmpdir)
    144143
Note: See TracChangeset for help on using the changeset viewer.