diff options
-rw-r--r-- | sos/collector/__init__.py | 13 | ||||
-rw-r--r-- | sos/collector/sosnode.py | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py index 8391a38f..40831306 100644 --- a/sos/collector/__init__.py +++ b/sos/collector/__init__.py @@ -30,6 +30,7 @@ from pipes import quote from textwrap import fill from sos.collector.sosnode import SosNode from sos.collector.exceptions import ControlPersistUnsupportedException +from sos.collector.clusters import ClusterOption from sos.component import SoSComponent from sos import __version__ @@ -111,7 +112,6 @@ class SoSCollector(SoSComponent): self.log_debug("Found supported host types: %s" % self.host_types.keys()) self.verify_cluster_options() - self.prep() except KeyboardInterrupt: self._exit('Exiting on user cancel', 130) except Exception: @@ -666,8 +666,6 @@ this utility or remote systems that it connects to. self.log_info("Wrote group '%s' to %s" % (gname, fname)) except Exception as err: self.log_error("Could not save group %s: %s" % (gname, err)) - self.intro() - self.configure_sos_cmd() def intro(self): '''Prints initial messages and collects user and case if not @@ -725,6 +723,7 @@ this utility or remote systems that it connects to. if self.opts.compression: self.sos_cmd += ' -z %s' % (quote(self.opts.compression)) self.log_debug('Initial sos cmd set to %s' % self.sos_cmd) + self.commons['sos_cmd'] = self.sos_cmd def connect_to_master(self): '''If run with --master, we will run cluster checks again that @@ -772,6 +771,7 @@ this utility or remote systems that it connects to. break self.cluster = cluster self.cluster_type = cluster.name() + self.commons['cluster'] = self.cluster self.ui_log.info( 'Cluster type set to %s' % self.cluster_type) break @@ -869,6 +869,7 @@ this utility or remote systems that it connects to. ''' try: client = SosNode(node[0], self.commons, password=node[1]) + client.cluster = self.cluster if client.connected: self.client_list.append(client) else: @@ -876,6 +877,12 @@ this utility or remote systems that it connects to. except Exception: pass + def execute(self): + self.configure_sos_cmd() + self.prep() + self.intro() + self.collect() + def collect(self): ''' For each node, start a collection thread and then tar all collected sosreports ''' diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py index 4f01121e..c94a38f7 100644 --- a/sos/collector/sosnode.py +++ b/sos/collector/sosnode.py @@ -33,7 +33,6 @@ class SosNode(): self.need_sudo = commons['need_sudo'] self.local = False self.hostname = None - self.cluster = None self._password = password or self.opts.password self.sos_path = None self.retrieved = False @@ -45,7 +44,7 @@ class SosNode(): 'disabled': [], 'options': [], 'presets': [], - 'sos_cmd': 'sosreport --batch' + 'sos_cmd': commons['sos_cmd'] } filt = ['localhost', '127.0.0.1'] self.soslog = logging.getLogger('sos') @@ -543,7 +542,7 @@ class SosNode(): def finalize_sos_cmd(self): '''Use host facts and compare to the cluster type to modify the sos command if needed''' - self.sos_cmd = self.sosinfo['sos_cmd'] + self.sos_cmd = self.sos_info['sos_cmd'] label = self.determine_sos_label() if label: self.sos_cmd = ' %s %s' % (self.sos_cmd, quote(label)) |