diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2021-06-11 23:20:59 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2021-06-21 12:48:07 -0400 |
commit | aed0102a1d6ef9a030c9e5349f092b51b9d1f22d (patch) | |
tree | a512d0d9a6dad2a805a838cbd6f462e183eeedb4 | |
parent | 69a2d8e7e82d7c7dbf2b8e3c0f65ac1ed954faef (diff) | |
download | sos-aed0102a1d6ef9a030c9e5349f092b51b9d1f22d.tar.gz |
[SoSNode] Allow individually setting node options
Like we now do for primary nodes, add the ability to individually set
node options via a new `set_node_options()` method for when blanket
setting options across all nodes via the options class attrs is not
sufficient.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/collector/clusters/__init__.py | 10 | ||||
-rw-r--r-- | sos/collector/sosnode.py | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/sos/collector/clusters/__init__.py b/sos/collector/clusters/__init__.py index 90e62d79..c4da1ab8 100644 --- a/sos/collector/clusters/__init__.py +++ b/sos/collector/clusters/__init__.py @@ -137,6 +137,16 @@ class Cluster(): """ self.cluster_ssh_key = key + def set_node_options(self, node): + """If there is a need to set specific options on ONLY the non-primary + nodes in a collection, override this method in the cluster profile + and do that here. + + :param node: The non-primary node + :type node: ``SoSNode`` + """ + pass + def set_master_options(self, node): """If there is a need to set specific options in the sos command being run on the cluster's master nodes, override this method in the cluster diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py index 1fc03076..7e784aa1 100644 --- a/sos/collector/sosnode.py +++ b/sos/collector/sosnode.py @@ -657,6 +657,8 @@ class SosNode(): # set master-only options if self.cluster.check_node_is_master(self): self.cluster.set_master_options(self) + else: + self.cluster.set_node_options(self) def finalize_sos_cmd(self): """Use host facts and compare to the cluster type to modify the sos @@ -713,13 +715,13 @@ class SosNode(): sos_opts.append('--cmd-timeout=%s' % quote(str(self.opts.cmd_timeout))) + self.update_cmd_from_cluster() + sos_cmd = sos_cmd.replace( 'sosreport', os.path.join(self.host.sos_bin_path, self.sos_bin) ) - self.update_cmd_from_cluster() - if self.opts.only_plugins: plugs = [o for o in self.opts.only_plugins if self._plugin_exists(o)] |