def extract_opss_wallet(self):
        """
        Extract the and unzip the OPSS wallet, if present, and return the path to the wallet directory.
        :return: the path to the extracted wallet, or None if no wallet was found
        :raises: BundleAwareException of the appropriate type: if an error occurs
        """
        _method_name = 'extract_opss_wallet'
        self.__logger.entering(class_name=self.__class_name,
                               method_name=_method_name)

        wallet_path = None
        for archive_file in self.__archive_files[::-1]:
            atp_wallet_zipentry = archive_file.getOPSSWallet()
            if atp_wallet_zipentry:
                wallet_dir = File(self.__domain_home, 'opsswallet')
                wallet_dir.mkdirs()
                wallet_path = wallet_dir.getPath()
                FileUtils.extractZipFileContent(archive_file,
                                                atp_wallet_zipentry,
                                                wallet_path)
                break

        self.__logger.exiting(class_name=self.__class_name,
                              method_name=_method_name,
                              result=wallet_path)
        return wallet_path
Пример #2
0
def extract_walletzip(model, model_context, archive_file, atp_zipentry):
    domain_parent = model_context.get_domain_parent_dir()
    if domain_parent is None:
        domain_path = model_context.get_domain_home()
    else:
        domain_path = domain_parent + os.sep + model[model_constants.TOPOLOGY][
            'Name']
    extract_path = domain_path +  os.sep + 'atpwallet'
    extract_dir = File(extract_path)
    extract_dir.mkdirs()
    FileUtils.extractZipFileContent(archive_file, atp_zipentry, extract_path)
    return extract_path