aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2018-11-30 16:07:24 -0500
committerBryn M. Reeves <bmr@redhat.com>2019-03-19 17:44:20 +0000
commitdf0f26196b71620d437ef58911fbdec23c7fe51d (patch)
treeab5de2ef54cfb9cb73f6a1c451c8d7b3bbcee253
parent2463612fc00c574b4b49c514fd4dac8d0b319d4a (diff)
downloadsos-df0f26196b71620d437ef58911fbdec23c7fe51d.tar.gz
[kubernetes] Fix 'describe' option enablement and function
The 'describe' option logic was incorrectly nested behind the 'all' option logic - so users couldn't successfully use the 'describe' option unless they also specified 'all'. Fixes the alignment so that 'describe' can be used properly and separately. Additionally fixes an issue where the syntax for getting resources for a specified namespace only worked for pods, and otherwise generated an error. Resolves: #1494 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/kubernetes.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py
index 2d0b5552..74f56ccb 100644
--- a/sos/plugins/kubernetes.py
+++ b/sos/plugins/kubernetes.py
@@ -107,19 +107,19 @@ class kubernetes(Plugin, RedHatPlugin):
for res in resources:
self.add_cmd_output('%s %s' % (k_cmd, res))
- if self.get_option('describe'):
- # need to drop json formatting for this
- k_cmd = '%s get %s' % (kube_cmd, knsp)
- for res in resources:
- r = self.get_command_output(
- '%s %s' % (k_cmd, res))
- if r['status'] == 0:
- k_list = [k.split()[0] for k in
- r['output'].splitlines()[1:]]
- for k in k_list:
- k_cmd = '%s %s' % (kube_cmd, knsp)
- self.add_cmd_output(
- '%s describe %s %s' % (k_cmd, res, k))
+ if self.get_option('describe'):
+ # need to drop json formatting for this
+ k_cmd = '%s %s' % (kube_cmd, knsp)
+ for res in resources:
+ r = self.get_command_output(
+ '%s get %s' % (k_cmd, res))
+ if r['status'] == 0:
+ k_list = [k.split()[0] for k in
+ r['output'].splitlines()[1:]]
+ for k in k_list:
+ k_cmd = '%s %s' % (kube_cmd, knsp)
+ self.add_cmd_output(
+ '%s describe %s %s' % (k_cmd, res, k))
if self.get_option('podlogs'):
k_cmd = '%s %s' % (kube_cmd, knsp)