aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2021-01-11 14:32:40 -0500
committerJake Hunsaker <jhunsake@redhat.com>2021-01-13 13:13:32 -0500
commitd3e9ae5dc0689a0e8b3045e3ca417926286360fb (patch)
treea8827b602db90bdd2271e52986f560c04cd73e6c
parent164b28f60030a91c0bc99cb36b668efc7edfcf22 (diff)
downloadsos-d3e9ae5dc0689a0e8b3045e3ca417926286360fb.tar.gz
[sosnode] Fix scoping issues within finalize_sos_cmd()
First fixes an issue with an improperly scoped setting of the sos command label. Second, addresses an issue where the final sos command determined wasn't being written to the node's metadata. Resolves: #2363 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/collector/sosnode.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py
index e9664d7a..f67ae60d 100644
--- a/sos/collector/sosnode.py
+++ b/sos/collector/sosnode.py
@@ -116,6 +116,7 @@ class SosNode():
self.manifest.add_field('hostname', self._hostname)
self.manifest.add_field('policy', self.host.distro)
self.manifest.add_field('sos_version', self.sos_info['version'])
+ self.manifest.add_field('final_sos_command', '')
def check_in_container(self):
"""
@@ -425,6 +426,7 @@ class SosNode():
"""Run a sosreport on the node, then collect it"""
self.sos_cmd = self.finalize_sos_cmd()
self.log_info('Final sos command set to %s' % self.sos_cmd)
+ self.manifest.add_field('final_sos_command', self.sos_cmd)
try:
path = self.execute_sos_command()
if path:
@@ -618,7 +620,7 @@ class SosNode():
sos_cmd = self.sos_info['sos_cmd']
label = self.determine_sos_label()
if label:
- self.sos_cmd = '%s %s ' % (sos_cmd, quote(label))
+ sos_cmd = '%s %s ' % (sos_cmd, quote(label))
if self.opts.sos_opt_line:
return '%s %s' % (sos_cmd, self.opts.sos_opt_line)
@@ -719,7 +721,6 @@ class SosNode():
'not exist on node' % self.opts.preset)
_sos_cmd = "%s %s" % (sos_cmd, ' '.join(sos_opts))
- self.manifest.add_field('final_sos_command', _sos_cmd)
return _sos_cmd
def determine_sos_label(self):