Resolve lint complaints

This commit is contained in:
hmlanigan 2016-09-16 16:16:23 -04:00
parent 6c941a7989
commit 6ffc0fa81e
5 changed files with 45 additions and 30 deletions

View File

@ -1 +0,0 @@

View File

@ -17,12 +17,12 @@
# needed on the class.
from __future__ import absolute_import
import subprocess
# import subprocess
import charmhelpers.contrib.openstack.utils as ch_utils
import charmhelpers.core.hookenv as hookenv
# import charmhelpers.core.hookenv as hookenv
import charmhelpers.core.unitdata as unitdata
import charmhelpers.fetch
# import charmhelpers.fetch
import charms_openstack.charm
import charms_openstack.adapters
@ -41,30 +41,34 @@ OPENSTACK_RELEASE_KEY = 'trove-charm.openstack-release-version'
###
# Handler functions for events that are interesting to the Trove charms
#Copied from the Congress example charm
#https://github.com/openstack/charm-guide/blob/master/doc/source/new-charm.rst
# Copied from the Congress example charm
# https://github.com/openstack/charm-guide/blob/master/doc/source/new-charm.rst
def install():
"""Use the singleton from the TroveCharm to install the packages on the
unit
"""
TroveCharm.singleton.install()
def restart_all():
"""Use the singleton from the TroveCharm to restart services on the
unit
"""
TroveCharm.singleton.restart_all()
def db_sync():
"""Use the singleton from the TroveCharm to run db migration
"""
TroveCharm.singleton.db_sync()
def configure_ha_resources(hacluster):
"""Use the singleton from the TroveCharm to run configure_ha_resources
"""
TroveCharm.singleton.configure_ha_resources(hacluster)
def setup_endpoint(keystone):
"""When the keystone interface connects, register this unit in the keystone
catalogue.
@ -87,6 +91,7 @@ def render_configs(interfaces_list):
"""
TroveCharm.singleton.render_with_interfaces(interfaces_list)
def assess_status():
"""Just call the TroveCharm.singleton.assess_status() command to update
status on the unit.
@ -101,16 +106,19 @@ def configure_ssl(keystone=None):
"""
TroveCharm.singleton.configure_ssl(keystone)
def configure_cloud_compute():
#TODO
# TODO
pass
def configure_cinder():
#TODO
# TODO
pass
def configure_image_service():
#TODO
# TODO
pass
@ -129,6 +137,7 @@ class TroveConfigurationAdapter(
"Unsupported keystone-api-version ({}). It should be 2 or 3"
.format(self.keystone_api_version))
class TroveAdapters(charms_openstack.adapters.OpenStackAPIRelationAdapters):
def __init__(self, relations):
super(TroveAdapters, self).__init__(
@ -144,13 +153,13 @@ class TroveCharm(charms_openstack.charm.HAOpenStackCharm):
release = 'mitaka'
packages = ['python-trove', 'python-troveclient', 'trove-common', 'trove-api', 'trove-taskmanager','trove-conductor']
packages = ['python-trove', 'python-troveclient', 'trove-common',
'trove-api', 'trove-taskmanager', 'trove-conductor']
services = ['trove-api', 'trove-taskmanager', 'trove-conductor']
#not sure if this will work or not
# not sure if this will work or not
adapters_class = charms_openstack.adapters.OpenStackAPIRelationAdapters
#adapters_class = TroveAdapters
default_service = 'trove-api'
@ -166,10 +175,13 @@ class TroveCharm(charms_openstack.charm.HAOpenStackCharm):
service_type = 'trove'
# Note that the hsm interface is optional - defined in config.yaml
#required_relations = ['shared-db', 'amqp', 'identity-service', 'image-service', 'cloud-compute', 'cluster',cinder heat swift]
#required_relations = ['shared-db', 'amqp', 'identity-service', 'image-service', 'cloud-compute', 'cinder-volume-service']
# required_relations = ['shared-db', 'amqp', 'identity-service',
# 'image-service', 'cloud-compute', 'cluster',
# cinder heat swift]
# required_relations = ['shared-db', 'amqp', 'identity-service',
# 'image-service', 'cloud-compute',
# 'cinder-volume-service']
required_relations = ['shared-db', 'amqp', 'identity-service']
restart_map = {
@ -179,13 +191,12 @@ class TroveCharm(charms_openstack.charm.HAOpenStackCharm):
TROVE_TASK_MANAGER: services
}
ha_resources = ['vips', 'haproxy']
def __init__(self, release=None, **kwargs):
"""
Copied out of the github congress example. Checks to make sure a release
is give, if not it pull the one out of keystone.
Copied out of the github congress example. Checks to make sure a
release is give, if not it pull the one out of keystone.
"""
if release is None:
release = ch_utils.os_release('python-keystonemiddleware')

View File

@ -49,14 +49,15 @@ def setup_database(database):
database.configure(hookenv.config('database'),
hookenv.config('database-user'),
hookenv.unit_private_ip())
#database.configure('trove', 'trove', hookenv.unit_private_ip())
trove.assess_status()
#this is to check if ha is running
# this is to check if ha is running
@reactive.when('ha.connected')
def cluster_connected(hacluster):
trove.configure_ha_resources(hacluster)
@reactive.when('identity-service.connected')
def setup_endpoint(keystone):
trove.setup_endpoint(keystone)
@ -72,6 +73,7 @@ def render_stuff(*args):
reactive.set_state('config.complete')
trove.assess_status()
@reactive.when('config.complete')
@reactive.when_not('db.synced')
def run_db_migration():
@ -108,6 +110,7 @@ def render_clustered(*args):
render(*args)
"""
@reactive.when('config.changed')
def config_changed():
trove.assess_status()
@ -118,24 +121,26 @@ def configure_ssl(keystone):
trove.configure_ssl(keystone)
#when cloud-compute.available
# when cloud-compute.available
@reactive.when('cloud-compute.available')
def configure_cloud_compute():
trove.configure_cloud_compute()
trove.assess_status()
#when image-service.available
# when image-service.available
@reactive.when('image-service.available')
def configure_image_service():
trove.configure_image_service()
trove.assess_status()
#when cinder-volume-service
# when cinder-volume-service
@reactive.when('cinder-volume-service.available')
def configure_cinder():
trove.configure_cinder()
trove.assess_status()
#when heat - I need to find out what juju calls this
# when heat - I need to find out what juju calls this
#when ceph.available
# when ceph.available

View File

@ -15,12 +15,12 @@
from __future__ import absolute_import
from __future__ import print_function
import contextlib
# import contextlib
import unittest
import mock
import charm.openstack.designate as designate
# import charm.openstack.designate as designate
def FakeConfig(init_dict):

View File

@ -3,9 +3,9 @@ import unittest
import reactive.designate_utils as dutils
#DOMAIN_LIST = b"""
#b78d458c-2a69-47e7-aa40-a1f9ff8809e3 frodo.com. 1467534540
#fa5111a7-5659-45c6-a101-525b4259e8f0 bilbo.com. 1467534855
DOMAIN_LIST = b"""
b78d458c-2a69-47e7-aa40-a1f9ff8809e3 frodo.com. 1467534540
fa5111a7-5659-45c6-a101-525b4259e8f0 bilbo.com. 1467534855
"""
SERVER_LIST = b"""