Skip to content

Commit 7829c3c

Browse files
committed
Fix rex_pub_key retrieval for containerized Satellite
1 parent e4849ed commit 7829c3c

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

robottelo/hosts.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
RHSSO_USER_UPDATE,
5555
SATELLITE_VERSION,
5656
)
57-
from robottelo.enums import NetworkType
57+
from robottelo.enums import InstallMethod, NetworkType
5858
from robottelo.exceptions import (
5959
CapsuleHostError,
6060
CLIFactoryError,
@@ -1775,7 +1775,19 @@ def url_katello_ca_rpm(self):
17751775

17761776
@property
17771777
def rex_pub_key(self):
1778-
return self.execute(f'cat {self.rex_key_path}').stdout.strip()
1778+
if self.install_method == InstallMethod.FOREMANCTL:
1779+
result = self.execute(
1780+
'podman exec foreman-proxy cat /var/lib/foreman-proxy/ssh/id_rsa_foreman_proxy.pub'
1781+
)
1782+
else:
1783+
result = self.execute(f'cat {self.rex_key_path}')
1784+
key = result.stdout.strip()
1785+
if not key:
1786+
raise ValueError(
1787+
f'Rex public key is empty. Command returned status {result.status}. '
1788+
f'stderr: {result.stderr}'
1789+
)
1790+
return key
17791791

17801792
def is_foremanctl_available(self):
17811793
"""Check if foremanctl is installed on the system.
@@ -1805,8 +1817,6 @@ def detect_install_method(self):
18051817
:return: InstallMethod enum value
18061818
:rtype: InstallMethod
18071819
"""
1808-
from robottelo.enums import InstallMethod
1809-
18101820
# Runtime override
18111821
if hasattr(self, '_install_method_override'):
18121822
return self._install_method_override
@@ -1855,7 +1865,6 @@ def get_service_names(self):
18551865
:rtype: list
18561866
"""
18571867
from robottelo.constants import InstallationServices
1858-
from robottelo.enums import InstallMethod
18591868

18601869
if self.install_method == InstallMethod.FOREMANCTL:
18611870
return InstallationServices.FOREMANCTL_SERVICES
@@ -2268,7 +2277,6 @@ def install_satellite(
22682277
:param foremanctl_parameters: Parameters list for foremanctl deploy
22692278
:return: Installation result
22702279
"""
2271-
from robottelo.enums import InstallMethod
22722280
from robottelo.utils.installer import InstallerCommand
22732281

22742282
# Determine method

0 commit comments

Comments
 (0)