aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuggi <github@schuppert.net>2017-06-28 21:35:45 +0200
committerAdam Stokes <battlemidget@users.noreply.github.com>2017-06-28 15:35:45 -0400
commit5bbe32f49f3406368ac794e638b61a3234da1d11 (patch)
treec84f43cc288f9d81134b8e7f68ff71e8717b3c66
parent665b85fcf25c016cbb467f8d9e3e93c2005b0fb9 (diff)
downloadsos-5bbe32f49f3406368ac794e638b61a3234da1d11.tar.gz
[openstack plugins] run openstack command when correct ENV is set (#1048)
With Tripleo Pike the default ENV changed from OS_TENANT_NAME to OS_PROJECT_NAME. The commands of the openstack plugins against the env should run when either OSP_TENANT_NAME or OS_PROJECT_NAME is set. Signed-off-by: Martin Schuppert mschuppe@redhat.com Signed-off-by: Adam Stokes <battlemidget@users.noreply.github.com>
-rw-r--r--sos/plugins/gnocchi.py10
-rw-r--r--sos/plugins/openstack_glance.py10
-rw-r--r--sos/plugins/openstack_heat.py10
-rw-r--r--sos/plugins/openstack_instack.py10
-rw-r--r--sos/plugins/openstack_ironic.py10
-rw-r--r--sos/plugins/openstack_keystone.py10
-rw-r--r--sos/plugins/openstack_neutron.py10
-rw-r--r--sos/plugins/openstack_nova.py10
8 files changed, 56 insertions, 24 deletions
diff --git a/sos/plugins/gnocchi.py b/sos/plugins/gnocchi.py
index 14baf552..dc79a0fe 100644
--- a/sos/plugins/gnocchi.py
+++ b/sos/plugins/gnocchi.py
@@ -44,9 +44,13 @@ class GnocchiPlugin(Plugin, RedHatPlugin):
self.add_copy_spec("/var/log/gnocchi/*.log",
sizelimit=self.limit)
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py
index 88d06e30..6202c495 100644
--- a/sos/plugins/openstack_glance.py
+++ b/sos/plugins/openstack_glance.py
@@ -51,9 +51,13 @@ class OpenStackGlance(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py
index 2dad83fd..0f457d9d 100644
--- a/sos/plugins/openstack_heat.py
+++ b/sos/plugins/openstack_heat.py
@@ -34,9 +34,13 @@ class OpenStackHeat(Plugin):
suggest_filename="heat_db_version"
)
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
diff --git a/sos/plugins/openstack_instack.py b/sos/plugins/openstack_instack.py
index 87ec59fc..f990476a 100644
--- a/sos/plugins/openstack_instack.py
+++ b/sos/plugins/openstack_instack.py
@@ -48,9 +48,13 @@ class OpenStackInstack(Plugin):
"/var/log/containers/zaqar/*.log"],
sizelimit=self.limit)
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
diff --git a/sos/plugins/openstack_ironic.py b/sos/plugins/openstack_ironic.py
index e4e320d6..0396cc63 100644
--- a/sos/plugins/openstack_ironic.py
+++ b/sos/plugins/openstack_ironic.py
@@ -44,9 +44,13 @@ class OpenStackIronic(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
diff --git a/sos/plugins/openstack_keystone.py b/sos/plugins/openstack_keystone.py
index 5a8f4e2a..82e987ab 100644
--- a/sos/plugins/openstack_keystone.py
+++ b/sos/plugins/openstack_keystone.py
@@ -48,9 +48,13 @@ class OpenStackKeystone(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py
index b0f66990..d2bfe6b8 100644
--- a/sos/plugins/openstack_neutron.py
+++ b/sos/plugins/openstack_neutron.py
@@ -42,9 +42,13 @@ class OpenStackNeutron(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py
index 3dda7aff..c0e8109f 100644
--- a/sos/plugins/openstack_nova.py
+++ b/sos/plugins/openstack_nova.py
@@ -35,9 +35,13 @@ class OpenStackNova(Plugin):
self.add_cmd_output("nova-manage fixed list")
self.add_cmd_output("nova-manage floating list")
- vars = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
- if not all(vars):
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")