diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2022-12-28 14:19:56 +0100 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2023-01-05 13:52:42 -0500 |
commit | 19d20652296f91b270651efd1aa1240aff53c960 (patch) | |
tree | 5039a24fde4b85c3c1f117f9ae156450bc79ef97 | |
parent | 9c60afed25c6cd8ecbd25c52a403376262a121d2 (diff) | |
download | sos-19d20652296f91b270651efd1aa1240aff53c960.tar.gz |
[collector] Prevent appending local host in strict_node_list mode
The changes in respecting strict_node_list are three-fold:
1) Don't add local hostname among "list of nodes to collect from:"
2) Skip explicit adding of the primary node to client_list
3) Apply strict_node_list to reduce_node_list (as it can purge away
hostname or IP address of the local host, otherwise)
Resolves: #3096
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/collector/__init__.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py index 965a7003..232a580b 100644 --- a/sos/collector/__init__.py +++ b/sos/collector/__init__.py @@ -914,7 +914,8 @@ class SoSCollector(SoSComponent): self.ui_log.info('The following is a list of nodes to collect from:') if self.primary.connected and self.primary.hostname is not None: - if not (self.primary.local and self.opts.no_local): + if not ((self.primary.local and self.opts.no_local) + or self.cluster.strict_node_list): self.ui_log.info('\t%-*s' % (self.commons['hostlen'], self.primary.hostname)) @@ -1026,12 +1027,13 @@ class SoSCollector(SoSComponent): if applicable""" if (self.hostname in self.node_list and self.opts.no_local): self.node_list.remove(self.hostname) - for i in self.ip_addrs: - if i in self.node_list: - self.node_list.remove(i) + if not self.cluster.strict_node_list: + for i in self.ip_addrs: + if i in self.node_list: + self.node_list.remove(i) # remove the primary node from the list, since we already have # an open session to it. - if self.primary is not None: + if self.primary is not None and not self.cluster.strict_node_list: for n in self.node_list: if n == self.primary.hostname or n == self.opts.primary: self.node_list.remove(n) @@ -1177,7 +1179,7 @@ this utility or remote systems that it connects to. def collect(self): """ For each node, start a collection thread and then tar all collected sosreports """ - if self.primary.connected: + if self.primary.connected and not self.cluster.strict_node_list: self.client_list.append(self.primary) self.ui_log.info("\nConnecting to nodes...") |