diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2021-05-12 16:06:29 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2021-06-02 13:05:05 -0400 |
commit | cae9dd79a59107aa92db5f90aed356e093985bd9 (patch) | |
tree | bfab22e4b7ff9ae3584d8d05509a77552e2c5e1f | |
parent | 3cbbd7df6f0700609eeef3210d7388298b9e0c21 (diff) | |
download | sos-cae9dd79a59107aa92db5f90aed356e093985bd9.tar.gz |
[sosnode] Don't fail on sos-less bastion nodes used for node lists
If the master node is determined to not have sos installed, that is not
necessarily a fatal error for scenarios where the 'master' node is only
being used to enumerate node lists and is not actually part of the
cluster. This can happen when a user is using a bastion node to
enumerate and connect to the cluster environment, or if the local host
is being used to enumerate nodes via cluster client tooling.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/collector/sosnode.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py index 62666635..7e56483d 100644 --- a/sos/collector/sosnode.py +++ b/sos/collector/sosnode.py @@ -287,13 +287,20 @@ class SosNode(): # use the containerized policy's command pkgs = self.run_command(self.host.container_version_command, use_container=True, need_root=True) - ver = pkgs['stdout'].strip().split('-')[1] - if ver: - self.sos_info['version'] = ver - if 'version' in self.sos_info: + if pkgs['status'] == 0: + ver = pkgs['stdout'].strip().split('-')[1] + if ver: + self.sos_info['version'] = ver + else: + self.sos_info['version'] = None + if self.sos_info['version']: self.log_info('sos version is %s' % self.sos_info['version']) else: - self.log_error('sos is not installed on this node') + if not self.address == self.opts.master: + # in the case where the 'master' enumerates nodes but is not + # intended for collection (bastions), don't worry about sos not + # being present + self.log_error('sos is not installed on this node') self.connected = False return False cmd = 'sosreport -l' |