Fix work of udp publisher

* Signature is appended also to udp messages
 * All methods for convert from sample to message are moved to publisher/utils.py
 * In configs metering_secret is moved from group publisher_rpc to publisher
 * Changed tests for udp publisher

Fixes: bug #1259171

Change-Id: Ic7727c69d4be6d17ff00f21e323341efd57122a7
This commit is contained in:
Ilya Tyaptin
2013-12-17 17:55:39 +04:00
parent e564c1e395
commit cdab1401dc
28 changed files with 361 additions and 327 deletions

View File

@@ -2,7 +2,8 @@
#
# Copyright © 2013 eNovance
#
# Author: Julien Danjou <julien@danjou.info>
# Author: Julien Danjou <julien@danjou.info>,
# Tyaptin Ilya <ityaptin@mirantis.com>
#
# 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
@@ -27,6 +28,7 @@ from ceilometer.openstack.common.gettextutils import _ # noqa
from ceilometer.openstack.common import log
from ceilometer.openstack.common import network_utils
from ceilometer import publisher
from ceilometer.publisher import utils
cfg.CONF.import_opt('udp_port', 'ceilometer.collector',
group='collector')
@@ -35,7 +37,6 @@ LOG = log.getLogger(__name__)
class UDPPublisher(publisher.PublisherBase):
def __init__(self, parsed_url):
self.host, self.port = network_utils.parse_host_port(
parsed_url.netloc,
@@ -51,7 +52,9 @@ class UDPPublisher(publisher.PublisherBase):
"""
for sample in samples:
msg = sample.as_dict()
msg = utils.meter_message_from_counter(
sample,
cfg.CONF.publisher.metering_secret)
host = self.host
port = self.port
LOG.debug(_("Publishing sample %(msg)s over UDP to "