fix repo setup

Add .zuul.yaml file, add .gitreview file.

Fix pep8 errors.

Change-Id: Ied4fcfde84e9124f5553e9043de0bd4b3246ff34
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-09-29 11:12:58 -04:00 committed by Andreas Jaeger
parent 2fc24d6c1d
commit ce6e5a4c5b
7 changed files with 35 additions and 20 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/charm-mistral.git

4
.zuul.yaml Normal file
View File

@ -0,0 +1,4 @@
- project:
templates:
- python-charm-jobs
- openstack-python35-jobs

View File

@ -1,5 +1,4 @@
import collections
import socket
import subprocess
import charmhelpers.core.hookenv as hookenv
@ -19,7 +18,10 @@ class MistralCharm(charms_openstack.charm.HAOpenStackCharm):
release = 'mitaka'
# List of packages to install for this charm
packages = ['mistral-api', 'mistral-engine', 'mistral-executor', 'python-apt']
packages = ['mistral-api',
'mistral-engine',
'mistral-executor',
'python-apt']
api_ports = {
'mistral-api': {
@ -54,7 +56,11 @@ class MistralCharm(charms_openstack.charm.HAOpenStackCharm):
]),
}
sync_cmd = ['mistral-db-manage', '--config-file', '/etc/mistral/mistral.conf', 'upgrade', 'head']
sync_cmd = ['mistral-db-manage',
'--config-file',
'/etc/mistral/mistral.conf',
'upgrade',
'head']
def db_sync(self):
"""Perform a database sync using the command defined in the
@ -63,9 +69,20 @@ class MistralCharm(charms_openstack.charm.HAOpenStackCharm):
"""
if not self.db_sync_done() and hookenv.is_leader():
subprocess.check_call(['mistral-db-manage', '--config-file', '/etc/mistral/mistral.conf', 'upgrade', 'head'])
subprocess.check_call(['mistral-db-manage', '--config-file', '/etc/mistral/mistral.conf', 'stamp', 'head'])
subprocess.check_call(['mistral-db-manage', '--config-file', '/etc/mistral/mistral.conf', 'populate'])
subprocess.check_call(['mistral-db-manage',
'--config-file',
'/etc/mistral/mistral.conf',
'upgrade',
'head'])
subprocess.check_call(['mistral-db-manage',
'--config-file',
'/etc/mistral/mistral.conf',
'stamp',
'head'])
subprocess.check_call(['mistral-db-manage',
'--config-file',
'/etc/mistral/mistral.conf',
'populate'])
hookenv.leader_set({'db-sync-done': True})
# Restart services immediately after db sync as
@ -79,7 +96,7 @@ class MistralCharm(charms_openstack.charm.HAOpenStackCharm):
return [{
'database': 'mistral',
'username': 'mistral',
'hostname': hookenv.unit_private_ip() },]
'hostname': hookenv.unit_private_ip()}, ]
@property
def public_url(self):
@ -92,4 +109,3 @@ class MistralCharm(charms_openstack.charm.HAOpenStackCharm):
@property
def internal_url(self):
return super().internal_url + "/v2"

View File

@ -39,7 +39,8 @@ def horrible_hack_to_workaround_missing_package_files():
archive.extractall('/usr/lib/python2.7/dist-packages/mistral')
shutil.copyfile(
'files/mapping.json',
'/usr/lib/python2.7/dist-packages/mistral/actions/openstack/mapping.json')
'/usr/lib/python2.7/dist-packages/mistral/actions/openstack'
'/mapping.json')
@reactive.when('charm.installed')

View File

@ -43,4 +43,4 @@ sys.modules['charmhelpers.fetch'] = charmhelpers.fetch
sys.modules['charmhelpers.cli'] = charmhelpers.cli
sys.modules['charmhelpers.contrib.hahelpers'] = charmhelpers.contrib.hahelpers
sys.modules['charmhelpers.contrib.hahelpers.cluster'] = (
charmhelpers.contrib.hahelpers.cluster)
charmhelpers.contrib.hahelpers.cluster)

View File

@ -19,8 +19,6 @@ import unittest
import mock
import charm.openstack.sdn_charm as sdn_charm
class Helper(unittest.TestCase):
@ -42,6 +40,3 @@ class Helper(unittest.TestCase):
started.return_value = return_value
self._patches_start[attr] = started
setattr(self, attr, started)
class TestSDNCharm(Helper):

View File

@ -15,8 +15,6 @@
from __future__ import absolute_import
from __future__ import print_function
import mock
import reactive.sdn_charm_handlers as handlers
import charms_openstack.test_utils as test_utils
@ -38,6 +36,3 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
# test that the hooks were registered via the
# reactive.barbican_handlers
self.registered_hooks_test_helper(handlers, hook_set, defaults)
class TestSDNCharmHandles(test_utils.PatchHelper):