Move Gnocchi options out of the "alarms" group

Which was actually a typo I think since all the rest of the options were
in "alarm" and opts.py was declaring Gnocchi options in "alarm" too.

Change-Id: Ic8d06ff31ad09e21b59ad224d46fc3dcd2da5320
This commit is contained in:
Julien Danjou 2015-07-23 12:10:52 +02:00
parent a10a13a629
commit 1ea9662cac
4 changed files with 10 additions and 12 deletions

View File

@ -24,8 +24,7 @@ from aodh.api.controllers.v2 import utils as v2_utils
from aodh import keystone_client
cfg.CONF.import_opt('gnocchi_url', 'aodh.evaluator.gnocchi',
group="alarms")
cfg.CONF.import_opt('gnocchi_url', 'aodh.evaluator.gnocchi')
class GnocchiUnavailable(Exception):
@ -65,7 +64,7 @@ class AlarmGnocchiThresholdRule(base.AlarmRule):
@staticmethod
def _get_aggregation_methods():
ks_client = keystone_client.get_client()
gnocchi_url = cfg.CONF.alarms.gnocchi_url
gnocchi_url = cfg.CONF.gnocchi_url
headers = {'Content-Type': "application/json",
'X-Auth-Token': ks_client.auth_token}
try:
@ -105,7 +104,7 @@ class MetricOfResourceRule(AlarmGnocchiThresholdRule):
rule = alarm.gnocchi_resources_threshold_rule
ks_client = keystone_client.get_client()
gnocchi_url = cfg.CONF.alarms.gnocchi_url
gnocchi_url = cfg.CONF.gnocchi_url
headers = {'Content-Type': "application/json",
'X-Auth-Token': ks_client.auth_token}
try:
@ -165,7 +164,7 @@ class AggregationMetricByResourcesLookupRule(AlarmGnocchiThresholdRule):
ks_client = keystone_client.get_client()
request = {
'url': "%s/v1/aggregation/resource/%s/metric/%s" % (
cfg.CONF.alarms.gnocchi_url,
cfg.CONF.gnocchi_url,
rule.resource_type,
rule.metric),
'headers': {'Content-Type': "application/json",

View File

@ -30,7 +30,7 @@ OPTS = [
help='URL to Gnocchi.'),
]
cfg.CONF.register_opts(OPTS, group="alarms")
cfg.CONF.register_opts(OPTS)
cfg.CONF.import_opt('http_timeout', 'aodh.service')
@ -38,7 +38,7 @@ class GnocchiThresholdEvaluator(threshold.ThresholdEvaluator):
def __init__(self, notifier):
super(threshold.ThresholdEvaluator, self).__init__(notifier)
self.gnocchi_url = cfg.CONF.alarms.gnocchi_url
self.gnocchi_url = cfg.CONF.gnocchi_url
self._ks_client = None
@property

View File

@ -32,8 +32,8 @@ def list_opts():
aodh.notifier.rest.OPTS,
aodh.service.OPTS,
aodh.rpc.OPTS,
aodh.storage.OLD_OPTS,)),
('alarm', aodh.api.controllers.v2.alarms.ALARM_API_OPTS),
aodh.storage.OLD_OPTS,
aodh.api.controllers.v2.alarms.ALARM_API_OPTS)),
('api',
itertools.chain(aodh.api.OPTS,
aodh.api.app.API_OPTS,)),

View File

@ -2365,7 +2365,7 @@ class TestAlarms(TestAlarmsBase):
) as gnocchi_get:
self.post_json('/alarms', params=json, headers=self.auth_headers)
gnocchi_url = self.CONF.alarms.gnocchi_url
gnocchi_url = self.CONF.gnocchi_url
capabilities_url = urlparse.urljoin(gnocchi_url,
'/v1/capabilities')
resource_url = urlparse.urljoin(
@ -2418,8 +2418,7 @@ class TestAlarms(TestAlarmsBase):
@mock.patch('aodh.keystone_client.get_client')
def test_post_gnocchi_aggregation_alarm_project_constraint(self, __):
self.CONF.set_override('gnocchi_url', 'http://localhost:8041',
group='alarms')
self.CONF.set_override('gnocchi_url', 'http://localhost:8041')
json = {
'enabled': False,
'name': 'project_constraint',