def unpack_file_to_temp_dir(self): """ Unpack file to temp dir on remote node. """ # mk temp extract dir if not exist CommonTools.mkdir_with_mode(EXTRACT_DIR, Constant.AUTH_COMMON_DIR_STR) # clean extract dir CommonTools.clean_dir(EXTRACT_DIR) # extract package file to temp dir CommonTools.extract_file_to_dir(self.package_path, EXTRACT_DIR) g.logger.info('Success unpack files to temp dir.')
def _get_install_path(self, pack_path): """ Extract version info and assembling install path. """ g.logger.info('Start getting install path.') # mk temp extract dir if not exist CommonTools.mkdir_with_mode(EXTRACT_DIR, Constant.AUTH_COMMON_DIR_STR) # clean extract dir CommonTools.clean_dir(EXTRACT_DIR) # extract package file to temp dir CommonTools.extract_file_to_dir(pack_path, EXTRACT_DIR) g.logger.info('Success extract files to temp dir.') # get version info from version file version_file = os.path.realpath(os.path.join(EXTRACT_DIR, Constant.VERSION_FILE)) version = CommonTools.get_version_info_from_file(version_file) g.logger.info('Got version info:%s' % version) base_dir = Constant.PACK_PATH_PREFIX + version install_path = os.path.join(self.project_path, base_dir) g.logger.info('Got install path:%s.' % install_path) CommonTools.check_path_valid(install_path) g.logger.info('Successfully to get install path.') return install_path, version