From d13405d13f4572de6dd11668b0d1a6723d6f4762 Mon Sep 17 00:00:00 2001 From: Helena McGough Date: Thu, 21 Sep 2017 17:09:24 +0100 Subject: [PATCH] Update Openstack plugins - Only implement plugin if aodh/gnocchiclient is available - Included in any missing licenses Signed-off-by: Helena McGough --- core/message_bus/__init__.py | 21 ++++++++++++++++++++ plugins/OpenStack/Aodh/__init__.py | 21 ++++++++++++++++++++ plugins/OpenStack/Aodh/notifier.py | 9 ++++++++- plugins/OpenStack/Aodh/plugin_instance.py | 7 ++++++- plugins/OpenStack/Gnocchi/__init__.py | 21 ++++++++++++++++++++ plugins/OpenStack/Gnocchi/plugin_instance.py | 8 +++++++- plugins/OpenStack/__init__.py | 21 ++++++++++++++++++++ plugins/__init__.py | 21 ++++++++++++++++++++ 8 files changed, 126 insertions(+), 3 deletions(-) diff --git a/core/message_bus/__init__.py b/core/message_bus/__init__.py index e69de29..32eb94e 100644 --- a/core/message_bus/__init__.py +++ b/core/message_bus/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: helena.mcgough@intel.com or adrian.hoban@intel.com +## diff --git a/plugins/OpenStack/Aodh/__init__.py b/plugins/OpenStack/Aodh/__init__.py index e69de29..32eb94e 100644 --- a/plugins/OpenStack/Aodh/__init__.py +++ b/plugins/OpenStack/Aodh/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: helena.mcgough@intel.com or adrian.hoban@intel.com +## diff --git a/plugins/OpenStack/Aodh/notifier.py b/plugins/OpenStack/Aodh/notifier.py index aa95215..3487daa 100644 --- a/plugins/OpenStack/Aodh/notifier.py +++ b/plugins/OpenStack/Aodh/notifier.py @@ -24,6 +24,12 @@ import json import logging as log +try: + import aodhclient +except ImportError: + log.warn("Failed to import the aodhclient") + + from core.message_bus.producer import KafkaProducer from plugins.OpenStack.Aodh.alarming import Alarming @@ -97,4 +103,5 @@ class Notifier(object): except Exception as exc: log.warn("Failed to send notify response:%s", exc) -register_notifier() +if aodhclient: + register_notifier() diff --git a/plugins/OpenStack/Aodh/plugin_instance.py b/plugins/OpenStack/Aodh/plugin_instance.py index ade14f3..11bacf6 100644 --- a/plugins/OpenStack/Aodh/plugin_instance.py +++ b/plugins/OpenStack/Aodh/plugin_instance.py @@ -22,6 +22,10 @@ """Aodh plugin for the OSM monitoring module.""" import logging as log +try: + import aodhclient +except ImportError: + log.warn("Failed to import the aodhclient") from plugins.OpenStack.Aodh.alarming import Alarming from plugins.OpenStack.settings import Config @@ -59,4 +63,5 @@ class Plugin(object): log.info("Begin alarm functionality.") self._alarming.alarming() -register_plugin() +if aodhclient: + register_plugin() diff --git a/plugins/OpenStack/Gnocchi/__init__.py b/plugins/OpenStack/Gnocchi/__init__.py index e69de29..32eb94e 100644 --- a/plugins/OpenStack/Gnocchi/__init__.py +++ b/plugins/OpenStack/Gnocchi/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: helena.mcgough@intel.com or adrian.hoban@intel.com +## diff --git a/plugins/OpenStack/Gnocchi/plugin_instance.py b/plugins/OpenStack/Gnocchi/plugin_instance.py index 8e4296f..7b516e8 100644 --- a/plugins/OpenStack/Gnocchi/plugin_instance.py +++ b/plugins/OpenStack/Gnocchi/plugin_instance.py @@ -23,6 +23,11 @@ import logging as log +try: + import gnocchiclient +except ImportError: + log.warn("Gnocchiclient could not be imported") + from plugins.OpenStack.Gnocchi.metrics import Metrics from plugins.OpenStack.settings import Config @@ -56,4 +61,5 @@ class Plugin(object): log.info("Initialize metric functionality.") self._metrics.metric_calls() -register_plugin() +if gnocchiclient: + register_plugin() diff --git a/plugins/OpenStack/__init__.py b/plugins/OpenStack/__init__.py index e69de29..32eb94e 100644 --- a/plugins/OpenStack/__init__.py +++ b/plugins/OpenStack/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: helena.mcgough@intel.com or adrian.hoban@intel.com +## diff --git a/plugins/__init__.py b/plugins/__init__.py index e69de29..32eb94e 100644 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: helena.mcgough@intel.com or adrian.hoban@intel.com +## -- 2.25.1