From e67d17690ab0f873e73b492856722274f8919140 Mon Sep 17 00:00:00 2001 From: Pavaman Subramaniyam Date: Thu, 18 Apr 2024 01:10:44 -0400 Subject: [PATCH] Adding support for full iso path keeping the legacy code for handling the full ISO path Signed-off-by: Pavaman Subramaniyam --- io/net/infiniband/mofed_install_test.py | 69 +++++++++++++------------ 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/io/net/infiniband/mofed_install_test.py b/io/net/infiniband/mofed_install_test.py index 51612e7aa..3a0979622 100755 --- a/io/net/infiniband/mofed_install_test.py +++ b/io/net/infiniband/mofed_install_test.py @@ -49,36 +49,42 @@ def setUp(self): self.uname = linux_modules.platform.uname()[2] kernel_ver = "kernel-devel-%s" % self.uname - if detected_distro.name == "SuSE": - host_distro_pattern = "sles%ssp%s" % ( - detected_distro.version, detected_distro.release) - patterns = [host_distro_pattern] - for pattern in patterns: - temp_string = process.getoutput( - "curl --silent %s" % (self.iso_location), verbose=False, shell=True, ignore_status=True) - matching_mofed_versions = re.findall( - r"(?<=\>)MLNX_OFED_LINUX-\w*[.]\w*[-]\w*[.]\w*[.]\w*[.]\w*[-]\w*[-]\w*[.]\w*", str(temp_string)) - distro_specific_mofed_versions = [host_distro_pattern - for host_distro_pattern - in matching_mofed_versions - if pattern in host_distro_pattern] - distro_specific_mofed_versions.sort(reverse=True) - self.iso_name = distro_specific_mofed_versions[0] - elif detected_distro.name in ['rhel', 'fedora', 'redhat']: - host_distro_pattern = "%s%s.%s" % ( - detected_distro.name, detected_distro.version, detected_distro.release) - patterns = [host_distro_pattern] - for pattern in patterns: - temp_string = process.getoutput( - "curl --silent %s" % (self.iso_location), verbose=False, shell=True, ignore_status=True) - matching_mofed_versions = re.findall( - r"(?<=\>)MLNX_OFED_LINUX-\w*[.]\w*[-]\w*[.]\w*[.]\w*[.]\w*[-]\w*[.]\w*[-]\w*[.]\w*", str(temp_string)) - distro_specific_mofed_versions = [host_distro_pattern - for host_distro_pattern - in matching_mofed_versions - if pattern in host_distro_pattern] - distro_specific_mofed_versions.sort(reverse=True) - self.iso_name = distro_specific_mofed_versions[0] + if '.iso' in self.iso_location: + self.iso = self.fetch_asset(self.iso_location, expire='10d') + else: + if detected_distro.name == "SuSE": + host_distro_pattern = "sles%ssp%s" % ( + detected_distro.version, detected_distro.release) + patterns = [host_distro_pattern] + for pattern in patterns: + temp_string = process.getoutput( + "curl --silent %s" % (self.iso_location), verbose=False, shell=True, ignore_status=True) + matching_mofed_versions = re.findall( + r"(?<=\>)MLNX_OFED_LINUX-\w*[.]\w*[-]\w*[.]\w*[.]\w*[.]\w*[-]\w*[-]\w*[.]\w*", str(temp_string)) + distro_specific_mofed_versions = [host_distro_pattern + for host_distro_pattern + in matching_mofed_versions + if pattern in host_distro_pattern] + distro_specific_mofed_versions.sort(reverse=True) + self.iso_name = distro_specific_mofed_versions[0] + elif detected_distro.name in ['rhel', 'fedora', 'redhat']: + host_distro_pattern = "%s%s.%s" % ( + detected_distro.name, detected_distro.version, detected_distro.release) + patterns = [host_distro_pattern] + for pattern in patterns: + temp_string = process.getoutput( + "curl --silent %s" % (self.iso_location), verbose=False, shell=True, ignore_status=True) + matching_mofed_versions = re.findall( + r"(?<=\>)MLNX_OFED_LINUX-\w*[.]\w*[-]\w*[.]\w*[.]\w*[.]\w*[-]\w*[.]\w*[-]\w*[.]\w*", str(temp_string)) + distro_specific_mofed_versions = [host_distro_pattern + for host_distro_pattern + in matching_mofed_versions + if pattern in host_distro_pattern] + distro_specific_mofed_versions.sort(reverse=True) + self.iso_name = distro_specific_mofed_versions[0] + + self.iso = "%s%s" % (self.iso_location, self.iso_name) + self.iso = self.fetch_asset(self.iso, expire='10d') smm = SoftwareManager() if detected_distro.name == "SuSE": @@ -94,8 +100,7 @@ def setUp(self): for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("Not able to install %s" % pkg) - self.iso = "%s%s" % (self.iso_location, self.iso_name) - self.iso = self.fetch_asset(self.iso, expire='10d') + cmd = "mount -o loop %s %s" % (self.iso, self.workdir) process.run(cmd, shell=True) self.pwd = os.getcwd()