Skip to content

Commit b41e5c1

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

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

robottelo/hosts.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,21 @@ 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+
from robottelo.enums import InstallMethod
1779+
1780+
if self.install_method == InstallMethod.FOREMANCTL:
1781+
result = self.execute(
1782+
'podman exec foreman-proxy cat /var/lib/foreman-proxy/ssh/id_rsa_foreman_proxy.pub'
1783+
)
1784+
else:
1785+
result = self.execute(f'cat {self.rex_key_path}')
1786+
key = result.stdout.strip()
1787+
if not key:
1788+
raise ValueError(
1789+
f'Rex public key is empty. Command returned status {result.status}. '
1790+
f'stderr: {result.stderr}'
1791+
)
1792+
return key
17791793

17801794
def is_foremanctl_available(self):
17811795
"""Check if foremanctl is installed on the system.

0 commit comments

Comments
 (0)