Skip to content

Commit d29715e

Browse files
authored
Fix rex_pub_key retrieval for containerized Satellite (#22139)
1 parent 5cf122c commit d29715e

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+
if settings.server.install_method == InstallMethod.FOREMANCTL:
1779+
if 'remote-execution' in self.list_foremanctl_features(enabled=True):
1780+
result = self.execute(
1781+
f"podman exec foreman-proxy bash -c 'cat {self.rex_key_path}'"
1782+
)
1783+
else:
1784+
raise SatelliteHostError('remote-execution feature is not enabled')
1785+
else:
1786+
result = self.execute(f'cat {self.rex_key_path}')
1787+
key = result.stdout.strip()
1788+
if not key:
1789+
raise ValueError(
1790+
f'Rex public key is empty. Command returned status {result.status}: {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)