Blob Blame History Raw
From ff5e73b29b1fcc4c5531654d4f67f808408aa989 Mon Sep 17 00:00:00 2001
From: Pablo Acevedo Montserrat <pacevedo@redhat.com>
Date: Thu, 2 Mar 2023 12:12:06 +0100
Subject: [PATCH] [microshift] Fix microshift get and add commands

Drop microshift get usage in favor of oc get commands.
Add version and show-config commands before running inspect.

Closes https://issues.redhat.com/browse/USHIFT-932

Signed-off-by: Pablo Acevedo Montserrat <pacevedo@redhat.com>
---
 sos/report/plugins/microshift.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sos/report/plugins/microshift.py b/sos/report/plugins/microshift.py
index 953eb88e..69981d63 100644
--- a/sos/report/plugins/microshift.py
+++ b/sos/report/plugins/microshift.py
@@ -86,9 +86,10 @@ class Microshift(Plugin, RedHatPlugin):
 
     def _get_namespaces(self):
         res = self.exec_cmd(
-            'microshift get namespaces'
+            'oc get namespaces'
             ' -o custom-columns=NAME:.metadata.name'
-            ' --no-headers')
+            ' --no-headers'
+            ' --kubeconfig=%s' % self.get_option('kubeconfig'))
         if res['status'] == 0:
             return self._reduce_namespace_list(res['output'].split('\n'))
         return []
@@ -146,6 +147,10 @@ class Microshift(Plugin, RedHatPlugin):
         which is used to retrieve all API resources from the cluster.
         """
         self.add_forbidden_path('/var/lib/microshift')
+        self.add_cmd_output([
+            'microshift version',
+            'microshift show-config -m effective'
+        ])
 
         _cluster_resources_to_collect = ",".join(
             self._get_cluster_resources())
-- 
2.39.2