diff options
-rw-r--r-- | ceilometer/ipmi/platform/intel_node_manager.py | 21 | ||||
-rw-r--r-- | ceilometer/neutron_client.py | 5 | ||||
-rw-r--r-- | ceilometer/objectstore/swift_middleware.py | 3 | ||||
-rw-r--r-- | requirements-py3.txt | 2 | ||||
-rw-r--r-- | requirements.txt | 2 |
5 files changed, 23 insertions, 10 deletions
diff --git a/ceilometer/ipmi/platform/intel_node_manager.py b/ceilometer/ipmi/platform/intel_node_manager.py index 000ee143..2b046e4e 100644 --- a/ceilometer/ipmi/platform/intel_node_manager.py +++ b/ceilometer/ipmi/platform/intel_node_manager.py @@ -33,10 +33,17 @@ from ceilometer.ipmi.platform import ipmitool from ceilometer.openstack.common.gettextutils import _ from oslo.config import cfg -try: - import collections as ordereddict -except ImportError: - import ordereddict + +def get_ordereddict(): + """A fix for py26 not having ordereddict.""" + try: + import collections + return collections.OrderedDict + except AttributeError: + import ordereddict + return ordereddict.OrderedDict + +OrderedDict = get_ordereddict() node_manager_init_retry = cfg.IntOpt('node_manager_init_retry', default=3, @@ -66,7 +73,7 @@ INTEL_PREFIX = '5701000d01' ONE_RETURN_TEMPLATE = {"ret": 1} -BMC_INFO_TEMPLATE = ordereddict.OrderedDict() +BMC_INFO_TEMPLATE = OrderedDict() BMC_INFO_TEMPLATE['Device_ID'] = 1 BMC_INFO_TEMPLATE['Device_Revision'] = 1 BMC_INFO_TEMPLATE['Firmware_Revision_1'] = 1 @@ -77,7 +84,7 @@ BMC_INFO_TEMPLATE['Manufacturer_ID'] = 3 BMC_INFO_TEMPLATE['Product_ID'] = 2 BMC_INFO_TEMPLATE['Auxiliary_Firmware_Revision'] = 4 -NM_STATISTICS_TEMPLATE = ordereddict.OrderedDict() +NM_STATISTICS_TEMPLATE = OrderedDict() NM_STATISTICS_TEMPLATE['Manufacturer_ID'] = 3 NM_STATISTICS_TEMPLATE['Current_value'] = 2 NM_STATISTICS_TEMPLATE['Minimum_value'] = 2 @@ -87,7 +94,7 @@ NM_STATISTICS_TEMPLATE['Time_stamp'] = 4 NM_STATISTICS_TEMPLATE['Report_period'] = 4 NM_STATISTICS_TEMPLATE["DomainID_PolicyState"] = 1 -NM_GET_DEVICE_ID_TEMPLATE = ordereddict.OrderedDict() +NM_GET_DEVICE_ID_TEMPLATE = OrderedDict() NM_GET_DEVICE_ID_TEMPLATE['Device_ID'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Device_revision'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Firmware_revision_1'] = 1 diff --git a/ceilometer/neutron_client.py b/ceilometer/neutron_client.py index 930d7eab..c9751cf1 100644 --- a/ceilometer/neutron_client.py +++ b/ceilometer/neutron_client.py @@ -16,6 +16,7 @@ import functools +from neutronclient.common import exceptions from neutronclient.v2_0 import client as clientv20 from oslo.config import cfg @@ -40,6 +41,10 @@ def logged(func): def with_logging(*args, **kwargs): try: return func(*args, **kwargs) + except exceptions.NeutronClientException as e: + # handles 404's when services are disabled in neutron + LOG.warn(e) + return [] except Exception as e: LOG.exception(e) raise diff --git a/ceilometer/objectstore/swift_middleware.py b/ceilometer/objectstore/swift_middleware.py index 3c5fa126..fc4369db 100644 --- a/ceilometer/objectstore/swift_middleware.py +++ b/ceilometer/objectstore/swift_middleware.py @@ -44,6 +44,7 @@ import logging from oslo.utils import timeutils import six +import six.moves.urllib.parse as urlparse from ceilometer.openstack.common import context from ceilometer import pipeline @@ -144,7 +145,7 @@ class CeilometerMiddleware(object): return iter_response(iterable) def publish_sample(self, env, bytes_received, bytes_sent): - path = env['PATH_INFO'] + path = urlparse.quote(env['PATH_INFO']) method = env['REQUEST_METHOD'] headers = {} for header in env: diff --git a/requirements-py3.txt b/requirements-py3.txt index eed3775e..82aa0945 100644 --- a/requirements-py3.txt +++ b/requirements-py3.txt @@ -29,7 +29,7 @@ python-keystoneclient>=0.10.0 python-neutronclient>=2.3.6,<3 python-novaclient>=2.18.0 python-swiftclient>=2.2.0 -pytz>=2010h +pytz PyYAML>=3.1.0 requests>=1.2.1,!=2.4.0 six>=1.7.0 diff --git a/requirements.txt b/requirements.txt index 4da6a0b0..52ea22bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,7 @@ python-keystoneclient>=0.10.0 python-neutronclient>=2.3.6,<3 python-novaclient>=2.18.0 python-swiftclient>=2.2.0 -pytz>=2010h +pytz PyYAML>=3.1.0 requests>=1.2.1,!=2.4.0 six>=1.7.0 |