|
54 | 54 | RHSSO_USER_UPDATE, |
55 | 55 | SATELLITE_VERSION, |
56 | 56 | ) |
57 | | -from robottelo.enums import NetworkType |
| 57 | +from robottelo.enums import InstallMethod, NetworkType |
58 | 58 | from robottelo.exceptions import ( |
59 | 59 | CapsuleHostError, |
60 | 60 | CLIFactoryError, |
@@ -1693,7 +1693,6 @@ def podman_logout(self, registry=None): |
1693 | 1693 |
|
1694 | 1694 |
|
1695 | 1695 | class Capsule(ContentHost, CapsuleMixins): |
1696 | | - rex_key_path = '~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub' |
1697 | 1696 | product_rpm_name = 'satellite-capsule' |
1698 | 1697 | upstream_rpm_name = 'foreman-proxy' |
1699 | 1698 |
|
@@ -1775,7 +1774,23 @@ def url_katello_ca_rpm(self): |
1775 | 1774 |
|
1776 | 1775 | @property |
1777 | 1776 | def rex_pub_key(self): |
1778 | | - return self.execute(f'cat {self.rex_key_path}').stdout.strip() |
| 1777 | + if settings.server.install_method == InstallMethod.FOREMANCTL: |
| 1778 | + if 'remote-execution' in self.list_foremanctl_features(enabled=True): |
| 1779 | + result = self.execute( |
| 1780 | + "podman secret inspect" |
| 1781 | + " foreman_proxy-remote_execution_ssh-id_rsa_foreman_proxy-pub" |
| 1782 | + " --showsecret --format '{{.SecretData}}'" |
| 1783 | + ) |
| 1784 | + else: |
| 1785 | + raise SatelliteHostError('remote-execution feature is not enabled') |
| 1786 | + else: |
| 1787 | + result = self.execute('cat ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub') |
| 1788 | + key = result.stdout.strip() |
| 1789 | + if not key: |
| 1790 | + raise ValueError( |
| 1791 | + f'Rex public key is empty. Command returned status {result.status}: {result.stderr}' |
| 1792 | + ) |
| 1793 | + return key |
1779 | 1794 |
|
1780 | 1795 | def is_foremanctl_available(self): |
1781 | 1796 | """Check if foremanctl is installed on the system. |
@@ -1805,8 +1820,6 @@ def detect_install_method(self): |
1805 | 1820 | :return: InstallMethod enum value |
1806 | 1821 | :rtype: InstallMethod |
1807 | 1822 | """ |
1808 | | - from robottelo.enums import InstallMethod |
1809 | | - |
1810 | 1823 | # Runtime override |
1811 | 1824 | if hasattr(self, '_install_method_override'): |
1812 | 1825 | return self._install_method_override |
@@ -1855,7 +1868,6 @@ def get_service_names(self): |
1855 | 1868 | :rtype: list |
1856 | 1869 | """ |
1857 | 1870 | from robottelo.constants import InstallationServices |
1858 | | - from robottelo.enums import InstallMethod |
1859 | 1871 |
|
1860 | 1872 | if self.install_method == InstallMethod.FOREMANCTL: |
1861 | 1873 | return InstallationServices.FOREMANCTL_SERVICES |
@@ -2271,7 +2283,6 @@ def install_satellite( |
2271 | 2283 | :param foremanctl_parameters: Parameters list for foremanctl deploy |
2272 | 2284 | :return: Installation result |
2273 | 2285 | """ |
2274 | | - from robottelo.enums import InstallMethod |
2275 | 2286 | from robottelo.utils.installer import InstallerCommand |
2276 | 2287 |
|
2277 | 2288 | # Determine method |
|
0 commit comments