Misc updates
Tidy pep8 errors. Add gitreview configuration. Drop registration of default release selector - not required. Use default version of ceilometer charm in testing now that relevant changes have landed. Ensure sane default release is passed to charm superclass. Correct behaviour for disabling services based on any of the required states not being set. Add xenial-pike test target. Change-Id: Iefcdc1d4870572dae00e71e1b855fb1abf68a4e9
This commit is contained in:
parent
73285470e3
commit
17c89a1d63
|
@ -0,0 +1,4 @@
|
|||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/charm-gnocchi.git
|
|
@ -21,4 +21,4 @@ existing OpenStack cloud (which includes ceilometer):
|
|||
|
||||
After re-configuration the Ceilometer API will be disabled - the Gnocchi REST
|
||||
API should be used to query information on resource, metrics and associated
|
||||
measures.
|
||||
measures.
|
||||
|
|
|
@ -16,8 +16,8 @@ import os
|
|||
import collections
|
||||
import subprocess
|
||||
|
||||
import charmhelpers.contrib.openstack.utils as ch_utils
|
||||
import charmhelpers.contrib.network.ip as ch_ip
|
||||
import charmhelpers.core.hookenv as hookenv
|
||||
import charmhelpers.core.host as host
|
||||
|
||||
import charms_openstack.charm
|
||||
|
@ -148,6 +148,15 @@ class GnocchiCharm(charms_openstack.charm.HAOpenStackCharm):
|
|||
|
||||
adapters_class = GnocchiCharmRelationAdapaters
|
||||
|
||||
def __init__(self, release=None, **kwargs):
|
||||
"""Custom initialiser for class
|
||||
If no release is passed, then the charm determines the release from the
|
||||
ch_utils.os_release() function.
|
||||
"""
|
||||
if release is None:
|
||||
release = ch_utils.os_release('python-keystonemiddleware')
|
||||
super(GnocchiCharm, self).__init__(release=release, **kwargs)
|
||||
|
||||
def install(self):
|
||||
super(GnocchiCharm, self).install()
|
||||
# NOTE(jamespage): always pause gnocchi-api service as we force
|
||||
|
|
|
@ -12,7 +12,6 @@ tags:
|
|||
series:
|
||||
- xenial
|
||||
- trusty
|
||||
- yakkety
|
||||
- zesty
|
||||
provides:
|
||||
metric-service:
|
||||
|
|
|
@ -26,20 +26,21 @@ charm.use_defaults(
|
|||
'identity-service.connected',
|
||||
'identity-service.available', # enables SSL support
|
||||
'config.changed',
|
||||
'update-status',
|
||||
'charm.default-select-release')
|
||||
'update-status')
|
||||
|
||||
required_interfaces = ['coordinator-memcached.available',
|
||||
'shared-db.available',
|
||||
'identity-service.available',
|
||||
'storage-ceph.pools.available']
|
||||
|
||||
|
||||
@reactive.when_not('config.rendered')
|
||||
@reactive.when_not_all(*required_interfaces)
|
||||
def disable_services():
|
||||
with charm.provide_charm_instance() as charm_class:
|
||||
charm_class.disable_services()
|
||||
|
||||
|
||||
@reactive.when('coordinator-memcached.available')
|
||||
@reactive.when('shared-db.available')
|
||||
@reactive.when('identity-service.available')
|
||||
@reactive.when('storage-ceph.pools.available')
|
||||
@reactive.when(*required_interfaces)
|
||||
def render_config(*args):
|
||||
"""Render the configuration for charm when all the interfaces are
|
||||
available.
|
||||
|
|
|
@ -23,8 +23,8 @@ import charmhelpers.contrib.openstack.amulet.deployment as amulet_deployment
|
|||
import charmhelpers.contrib.openstack.amulet.utils as os_amulet_utils
|
||||
|
||||
from gnocchiclient.v1 import client as gnocchi_client
|
||||
from keystoneclient import session as keystone_session
|
||||
from keystoneclient.auth import identity as keystone_identity
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from keystoneauth1 import identity as keystone_identity
|
||||
|
||||
# Use DEBUG to turn on debug logging
|
||||
u = os_amulet_utils.OpenStackAmuletUtils(os_amulet_utils.DEBUG)
|
||||
|
@ -63,13 +63,10 @@ class GnocchiCharmDeployment(amulet_deployment.OpenStackAmuletDeployment):
|
|||
other_services = [
|
||||
{'name': 'percona-cluster'},
|
||||
{'name': 'mongodb'},
|
||||
# NOTE(jamespage): Drop when changes land into ceilometer/master
|
||||
{'name': 'ceilometer',
|
||||
'location': 'cs:~james-page/ceilometer'},
|
||||
{'name': 'ceilometer'},
|
||||
{'name': 'keystone'},
|
||||
{'name': 'rabbitmq-server'},
|
||||
{'name': 'memcached',
|
||||
'location': 'cs:memcached'},
|
||||
{'name': 'memcached', 'location': 'cs:memcached'},
|
||||
{'name': 'ceph-mon', 'units': 3},
|
||||
{'name': 'ceph-osd', 'units': 3},
|
||||
]
|
||||
|
@ -131,10 +128,13 @@ class GnocchiCharmDeployment(amulet_deployment.OpenStackAmuletDeployment):
|
|||
service_type='identity',
|
||||
interface='publicURL')
|
||||
|
||||
auth = keystone_identity.V2Token(auth_url=keystone_ep,
|
||||
token=self.keystone.auth_token)
|
||||
auth = keystone_identity.V2Password(auth_url=keystone_ep,
|
||||
username='admin',
|
||||
password='openstack',
|
||||
tenant_name='admin')
|
||||
sess = keystone_session.Session(auth=auth)
|
||||
self.gnocchi = gnocchi_client.Client(session=sess)
|
||||
self.gnocchi = gnocchi_client.Client(session=sess,
|
||||
endpoint_override=gnocchi_ep)
|
||||
|
||||
def check_and_wait(self, check_command, interval=2, max_wait=200,
|
||||
desc=None):
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2016 Canonical Ltd
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Amulet tests on a basic Gnocchi Charm deployment on xenial-pike."""
|
||||
|
||||
from basic_deployment import GnocchiCharmDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = GnocchiCharmDeployment(series='xenial',
|
||||
openstack='cloud:xenial-pike')
|
||||
deployment.run_tests()
|
Loading…
Reference in New Issue