Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(is_enterprise): check command output applying logic #6957

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions sdcm/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,16 +716,21 @@ def start_network_interface(self, interface_name="eth1"):
self.remoter.sudo(startup_interface_command.format(interface_name))

@cached_property
def is_enterprise(self):
def is_enterprise(self) -> bool | None:
_is_enterprise = None
if self.distro.is_rhel_like:
result = self.remoter.sudo("yum search scylla-enterprise 2>&1", ignore_status=True).stdout
if 'One of the configured repositories failed (Extra Packages for Enterprise Linux 7 - x86_64)' in result:
return "enterprise" in self.remoter.sudo("cat /etc/yum.repos.d/scylla.repo").stdout
return "scylla-enterprise.x86_64" in result or "No matches found" not in result
result = self.remoter.sudo("yum search scylla-enterprise 2>&1", ignore_status=True)
if result.ok:
_is_enterprise = "scylla-enterprise.x86_64" in result.stdout or "No matches found" not in result.stdout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about enterprise on Arm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the other logic would cover it (i.e. No matches)

I just moved it around, the already available logic.

elif self.distro.is_sles:
result = self.remoter.sudo("zypper search scylla-enterprise 2>&1", ignore_status=True).stdout
return "scylla-enterprise" in result or "No matching items found" not in result
return "scylla-enterprise" in self.remoter.sudo("apt-cache search scylla-enterprise", ignore_status=True).stdout
result = self.remoter.sudo("zypper search scylla-enterprise 2>&1", ignore_status=True)
if result.ok:
_is_enterprise = "scylla-enterprise" in result.stdout or "No matching items found" not in result.stdout
elif self.distro.is_debian_like:
result = self.remoter.sudo("apt-cache search scylla-enterprise", ignore_status=True)
if result.ok:
_is_enterprise = "scylla-enterprise" in result.stdout
return _is_enterprise

@property
def public_ip_address(self) -> Optional[str]:
Expand Down Expand Up @@ -2078,6 +2083,7 @@ def scylla_version(self) -> Optional[str]:
def forget_scylla_version(self) -> None:
self.__dict__.pop("scylla_version_detailed", None)
self.__dict__.pop("scylla_version", None)
self.__dict__.pop('is_enterprise', None)

@log_run_info("Detecting disks")
def detect_disks(self, nvme=True):
Expand Down