def store_victims_db(self, victims_db_dir): """ Zip victims_db_dir/* and store to S3 as VICTIMS_DB_ARCHIVE""" with tempdir() as temp_archive_dir: temp_archive_path = os.path.join(temp_archive_dir, self.VICTIMS_DB_ARCHIVE) with cwd(victims_db_dir): Archive.zip_file('.', temp_archive_path) self.store_file(temp_archive_path, self.VICTIMS_DB_ARCHIVE)
def store_depcheck_db(self, data_dir): """ Zip CVE DB file and store to S3 """ with tempdir() as archive_dir: archive_path = os.path.join(archive_dir, self.DEPCHECK_DB_ARCHIVE) db_file_path = os.path.join(data_dir, self.DEPCHECK_DB_FILENAME) try: Archive.zip_file(db_file_path, archive_path, junk_paths=True) except TaskError: pass else: self.store_file(archive_path, self.DEPCHECK_DB_ARCHIVE)
def store_index(self, target_dir): """ Zip files in target_dir/central-index dir and store to S3 """ with tempdir() as temp_dir: central_index_dir = os.path.join(target_dir, self._INDEX_DIRNAME) archive_path = os.path.join(temp_dir, self._INDEX_ARCHIVE) try: Archive.zip_file(central_index_dir, archive_path, junk_paths=True) except TaskError: pass else: self.store_file(archive_path, self._INDEX_ARCHIVE)