From cb097b133e1b5a3216f2c023c6b899f995fcad51 Mon Sep 17 00:00:00 2001 From: Xiangce Liu Date: Fri, 8 Nov 2024 20:54:05 +0800 Subject: [PATCH] feat: download egg as per the RHEL major version - Mulitple eggs will be provided on CDN for different RHEL releases - Decide the egg name before downloading according to the current RHEL major version - The orignial "insights-core.egg" is set as default - Jira Card: RHINENG-12166 Signed-off-by: Xiangce Liu --- insights/client/__init__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/insights/client/__init__.py b/insights/client/__init__.py index e4249eb410..4801da32f2 100644 --- a/insights/client/__init__.py +++ b/insights/client/__init__.py @@ -19,6 +19,7 @@ get_tags, write_tags, migrate_tags, + os_release_info, get_parent_process) NETWORK = constants.custom_network_log_level @@ -121,9 +122,18 @@ def fetch(self, force=False): """ self.tmpdir = tempfile.mkdtemp() atexit.register(self.delete_tmpdir) + try: + _, os_release = os_release_info() + rhel_major = os_release.split('.')[0] + # set egg name as 'insights-core.el#.egg' per RHEL # + egg_name = 'insights-core.el{0}.egg'.format(rhel_major) + except Exception: + # set default egg as 'insights-core.egg' + egg_name = 'insights-core.egg' + fetch_results = { - 'core': os.path.join(self.tmpdir, 'insights-core.egg'), - 'gpg_sig': os.path.join(self.tmpdir, 'insights-core.egg.asc') + 'core': os.path.join(self.tmpdir, egg_name), + 'gpg_sig': os.path.join(self.tmpdir, '{0}.asc'.format(egg_name)) } logger.debug("Beginning core fetch.") @@ -141,13 +151,13 @@ def fetch(self, force=False): egg_url = self.config.egg_path egg_gpg_url = self.config.egg_gpg_path if egg_url is None: - egg_url = '/v1/static{0}/insights-core.egg'.format(egg_release) + egg_url = '/v1/static{0}/{1}'.format(egg_release, egg_name) # if self.config.legacy_upload: # egg_url = '/v1/static/core/insights-core.egg' # else: # egg_url = '/static/insights-core.egg' if egg_gpg_url is None: - egg_gpg_url = '/v1/static{0}/insights-core.egg.asc'.format(egg_release) + egg_gpg_url = '/v1/static{0}/{1}.asc'.format(egg_release, egg_name) # if self.config.legacy_upload: # egg_gpg_url = '/v1/static/core/insights-core.egg.asc' # else: