Fix compute agent publishing call

The compute agent was not updated to use the right arguments
when the publish module API was changed.

Change-Id: I82df05b2a9897a536c09b55600f2b8c3ac05ae9e
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
Doug Hellmann 2012-10-02 22:31:25 -04:00
parent 16d8b439ec
commit 1ff7a0a4f8
3 changed files with 16 additions and 6 deletions

View File

@ -20,6 +20,7 @@ import pkg_resources
from nova import manager
from ceilometer.openstack.common import cfg
from ceilometer.openstack.common import log
from ceilometer import publish
@ -65,7 +66,10 @@ class AgentManager(manager.Manager):
LOG.info('polling %s', name)
for c in pollster.get_counters(self, instance):
LOG.info('COUNTER: %s', c)
publish.publish_counter(context, c)
publish.publish_counter(context, c,
cfg.CONF.metering_topic,
cfg.CONF.metering_secret,
)
except Exception as err:
LOG.warning('Continuing after error from %s for %s: %s',
name, instance.name, err)

View File

@ -25,6 +25,8 @@ from ceilometer import counter
from ceilometer import publish
from ceilometer.tests import base
from ceilometer.openstack.common import cfg
def test_load_plugins():
mgr = manager.AgentManager()
@ -55,8 +57,8 @@ class TestRunTasks(base.TestCase):
self.counters.append((manager, instance))
return [self.test_data]
def faux_notify(self, context, msg):
self.notifications.append(msg)
def faux_notify(self, context, msg, topic, secret):
self.notifications.append((msg, topic, secret))
def setUp(self):
super(TestRunTasks, self).setUp()
@ -82,5 +84,8 @@ class TestRunTasks(base.TestCase):
assert self.Pollster.counters[0][1] is self.instance
def test_notifications(self):
assert self.notifications[0] is self.Pollster.test_data
assert len(self.notifications) == 1
actual = self.notifications
assert actual == [(self.Pollster.test_data,
cfg.CONF.metering_topic,
cfg.CONF.metering_secret,
)]

View File

@ -53,7 +53,8 @@ class TestPublish(base.TestCase):
publish.publish_counter(None,
self.test_data,
'metering',
'not-so-secret')
'not-so-secret',
)
def test_notify(self):
assert len(self.notifications) == 2