Skip to content

Commit

Permalink
feat: download egg as per the RHEL major version
Browse files Browse the repository at this point in the history
- 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 <xiangceliu@redhat.com>
  • Loading branch information
xiangce committed Nov 8, 2024
1 parent b88a6e8 commit cb097b1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions insights/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
get_tags,
write_tags,
migrate_tags,
os_release_info,
get_parent_process)

NETWORK = constants.custom_network_log_level
Expand Down Expand Up @@ -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.")
Expand All @@ -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:
Expand Down

0 comments on commit cb097b1

Please sign in to comment.