diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2019-02-15 16:23:36 -0500 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-03-04 16:42:08 +0000 |
commit | bc34d9b938f9cd1c53120fc8badc3dff600771d3 (patch) | |
tree | 404ec06a4863184e5c327b5cd86ac2c74ffc80ef | |
parent | 7b9284e948f2e9076c92741ed5b95fec7934af8d (diff) | |
download | sos-bc34d9b938f9cd1c53120fc8badc3dff600771d3.tar.gz |
[docker] Don't run docker commands when the service is not running
Prevents the docker plugin from running docker commands when the service
is not running. This will prevent us from collecting the same 'docker is
not running' error message over and over again from the docker commands
that would otherwise get run.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/plugins/docker.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sos/plugins/docker.py b/sos/plugins/docker.py index 5b2acff5..69ac997e 100644 --- a/sos/plugins/docker.py +++ b/sos/plugins/docker.py @@ -33,6 +33,14 @@ class Docker(Plugin): "/var/lib/docker/repositories-*" ]) + self.add_journal(units="docker") + self.add_cmd_output("ls -alhR /etc/docker") + + if not self.service_is_running('docker'): + # if docker is not running none of the below commands will provide + # any useful output + return + subcmds = [ 'events --since 24h --until 1s', 'info', @@ -53,9 +61,6 @@ class Docker(Plugin): if self.get_option('size'): self.add_cmd_output('docker ps -as') - self.add_journal(units="docker") - self.add_cmd_output("ls -alhR /etc/docker") - nets = self.get_command_output('docker network ls') if nets['status'] == 0: |