diff options
author | Jose Castillo <jcastillo@redhat.com> | 2024-03-04 08:34:16 +0100 |
---|---|---|
committer | Pavel Moravec <pmoravec@redhat.com> | 2024-03-04 08:35:23 +0100 |
commit | 5b0c986af87ad3a9f35196a3de73acda8249cb64 (patch) | |
tree | 550306662c3d0b8701e1628c57636d4298b6e3b3 | |
parent | ab01c8e3b3308081a62ec1f8de305766457c9447 (diff) | |
download | sos-5b0c986af87ad3a9f35196a3de73acda8249cb64.tar.gz |
[collect|ocp] Add an option to specify API URL
If no API url is specified, it will use
localhost always. In some cases, specially
when using Ansible, we'll want to specify
another API URL.
Related: RH: RHEL-24523
Closes: #3517
Co-authored-by: Alberto Losada Grande <alberto.losada@redhat.com>
Signed-off-by: Jose Castillo <jcastillo@redhat.com>
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/collector/clusters/ocp.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sos/collector/clusters/ocp.py b/sos/collector/clusters/ocp.py index 812c65b3..e0db93d3 100644 --- a/sos/collector/clusters/ocp.py +++ b/sos/collector/clusters/ocp.py @@ -69,7 +69,8 @@ class ocp(Cluster): ('role', 'master', 'Colon delimited list of roles to filter on'), ('kubeconfig', '', 'Path to the kubeconfig file'), ('token', '', 'Service account token to use for oc authorization'), - ('with-api', False, 'Collect OCP API data from a master node') + ('with-api', False, 'Collect OCP API data from a master node'), + ('api-url', '', 'Alternate API URL of an external control-plane'), ] @property @@ -109,8 +110,9 @@ class ocp(Cluster): token """ _res = self.exec_primary_cmd( - self.fmt_oc_cmd("login --insecure-skip-tls-verify=True --token=%s" - % self.token) + self.fmt_oc_cmd("login --insecure-skip-tls-verify=True " + f"--token={self.token} " + f"{self.get_option('api-url')}") ) return _res['status'] == 0 |