diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2020-04-20 13:44:16 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-04-22 10:58:15 -0400 |
commit | 26cfc79e150efe26e68cc3117b27bc64b27f2aa2 (patch) | |
tree | 76fddf15f99bf34e3fc94bcc7ef630e6e2158277 | |
parent | 857da4e915c069e860f292774ece619c4211a5e6 (diff) | |
download | sos-26cfc79e150efe26e68cc3117b27bc64b27f2aa2.tar.gz |
[sosnode] Do not load local sos information when using --no-local
Skip the sos info checks for local execution for --no-local is used.
Still load the local policy for package checks however.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/collector/sosnode.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py index 14c11ab5..2ab620ac 100644 --- a/sos/collector/sosnode.py +++ b/sos/collector/sosnode.py @@ -78,8 +78,15 @@ class SosNode(): self.connected = True self.local = True self.need_sudo = os.getuid() != 0 + # load the host policy now, even if we don't want to load further + # host information. This is necessary if we're running locally on the + # cluster master but do not want a local report as we still need to do + # package checks in that instance + self.host = self.determine_host_policy() + self.get_hostname() + if self.local and self.opts.no_local: + load_facts = False if self.connected and load_facts: - self.host = self.determine_host_policy() if not self.host: self.connected = False self.close_ssh_session() @@ -87,7 +94,6 @@ class SosNode(): if self.local: if self.check_in_container(): self.host.containerized = False - self.get_hostname() if self.host.containerized: self.create_sos_container() self._load_sos_info() @@ -310,6 +316,8 @@ class SosNode(): distributions """ if self.local: + self.log_info("using local policy %s" + % self.commons['policy'].distro) return self.commons['policy'] host = load(cache={}, sysroot=self.opts.sysroot, init=InitSystem(), probe_runtime=False, remote_exec=self.ssh_cmd, |