diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2013-07-25 19:00:51 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2013-07-25 19:00:51 +0100 |
commit | 8b10cb00ab44239e9f11d8e9ab766908f9f92e16 (patch) | |
tree | 29dc1d5bdeab1160c3d49556abefabea0e9ad74e | |
parent | 49f1529a7a7da196368daf952824fc502859f9af (diff) | |
download | sos-8b10cb00ab44239e9f11d8e9ab766908f9f92e16.tar.gz |
Fix broken binary checks in openstack.py
The OpenStack plug-in attempts to check for the presence of
binaries before running them. To do this it passes a relative
path to os.path.exists(); clearly this will never succeed.
Ideally plug-ins should never need to do these checks. If the
binary exists we'll run it and if not we won't (with no harmful
side-effects). This is how sos is currently designed and if there
is a need for plug-ins to ever do this we should add a method to
the base plug-in class e.g. Plugin.find_command() to do this
properly (i.e. evaluating the policy-supplied PATH).
For now, just make all of this unconditional.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/openstack.py | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/sos/plugins/openstack.py b/sos/plugins/openstack.py index 69a830bc..9c209e63 100644 --- a/sos/plugins/openstack.py +++ b/sos/plugins/openstack.py @@ -29,47 +29,44 @@ class OpenStack(Plugin): def setup(self): # Nova - if os.path.exists("nova-manage"): - self.add_cmd_output( - "nova-manage config list 2>/dev/null | sort", - suggest_filename="nova_config_list") - self.add_cmd_output( - "nova-manage service list 2>/dev/null", - suggest_filename="nova_service_list") - self.add_cmd_output( - "nova-manage db version 2>/dev/null", - suggest_filename="nova_db_version") - self.add_cmd_output( - "nova-manage fixed list 2>/dev/null", - suggest_filename="nova_fixed_ip_list") - self.add_cmd_output( - "nova-manage floating list 2>/dev/null", - suggest_filename="nova_floating_ip_list") - self.add_cmd_output( - "nova-manage flavor list 2>/dev/null", - suggest_filename="nova_flavor_list") - self.add_cmd_output( - "nova-manage network list 2>/dev/null", - suggest_filename="nova_network_list") - self.add_cmd_output( - "nova-manage vm list 2>/dev/null", - suggest_filename="nova_vm_list") + self.add_cmd_output( + "nova-manage config list 2>/dev/null | sort", + suggest_filename="nova_config_list") + self.add_cmd_output( + "nova-manage service list 2>/dev/null", + suggest_filename="nova_service_list") + self.add_cmd_output( + "nova-manage db version 2>/dev/null", + suggest_filename="nova_db_version") + self.add_cmd_output( + "nova-manage fixed list 2>/dev/null", + suggest_filename="nova_fixed_ip_list") + self.add_cmd_output( + "nova-manage floating list 2>/dev/null", + suggest_filename="nova_floating_ip_list") + self.add_cmd_output( + "nova-manage flavor list 2>/dev/null", + suggest_filename="nova_flavor_list") + self.add_cmd_output( + "nova-manage network list 2>/dev/null", + suggest_filename="nova_network_list") + self.add_cmd_output( + "nova-manage vm list 2>/dev/null", + suggest_filename="nova_vm_list") self.add_copy_specs(["/etc/nova/", "/var/log/nova/"]) # Glance - if os.path.exists("glance-manage"): - self.add_cmd_output( - "glance-manage db_version", - suggest_filename="glance_db_version") + self.add_cmd_output( + "glance-manage db_version", + suggest_filename="glance_db_version") self.add_copy_specs(["/etc/glance/", "/var/log/glance/"]) # Cinder - if os.path.exists("cinder-manage"): - self.add_cmd_output( - "cinder-manage db version", - suggest_filename="cinder_db_version") + self.add_cmd_output( + "cinder-manage db version", + suggest_filename="cinder_db_version") self.add_copy_specs(["/etc/cinder/", "/var/log/cinder/"]) |