summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviswesn <viswesn@gmail.com>2016-11-10 23:08:55 +0530
committerviswesn <viswesn@gmail.com>2016-11-10 23:08:55 +0530
commit60adafe49b82ad9e571337000e5e80cd602dd409 (patch)
treee74951d7436a8fbd133a29ccd4f068f3b8aad4b0
parent4c6339e28abe695abee5ba71611cd15bd5feba5c (diff)
downloadcharm-murano-60adafe49b82ad9e571337000e5e80cd602dd409.zip
charm-murano-60adafe49b82ad9e571337000e5e80cd602dd409.tar.gz
charm-murano-60adafe49b82ad9e571337000e5e80cd602dd409.tar.bz2
Addressed the review comments provided by Liam
-rw-r--r--src/lib/charm/openstack/murano.py119
-rw-r--r--src/reactive/murano_handlers.py24
2 files changed, 4 insertions, 139 deletions
diff --git a/src/lib/charm/openstack/murano.py b/src/lib/charm/openstack/murano.py
index 9cdaf8a..e3ccdff 100644
--- a/src/lib/charm/openstack/murano.py
+++ b/src/lib/charm/openstack/murano.py
@@ -7,97 +7,8 @@ import charmhelpers.core.hookenv as hookenv
import charms_openstack.charm
import charms_openstack.ip as os_ip
-# import charms_openstack.sdn.odl as odl
-# import charms_openstack.sdn.ovs as ovs
-
RC_FILE = '/root/novarc'
-def get_environment(env):
- with open("/root/novarc", "r") as ins:
- for line in ins:
- k, v = line.replace('export', '').replace(" ", "").split('=')
- env[k] = v.strip()
- return env
-
-def run_command(cmd):
- os_env = get_environment(os.environ.copy())
- subprocess.check_call(cmd, env=os_env)
-
-
-def register_endpoints(keystone):
- """When the keystone interface connects, register this unit in the keystone
- catalogue.
-
- @param keystone: KeystoneRequires() interface class
- @returns: None
- """
- charm = MuranoCharm.singleton
- keystone.register_endpoints(charm.service_type,
- charm.region,
- charm.public_url,
- charm.internal_url,
- charm.admin_url)
-
-def configure_ha_resources(hacluster):
- """Use the singleton from the MuranoCharm to run configure ha resources
-
- @param hacluster: OpenstackHAPeers() interface class
- @returns: None
- """
- MuranoCharm.singleton.configure_ha_resources(hacluster)
-
-
-def restart_all():
- """Use the singleton from the MuranoCharm to restart all registered
- services
-
- @returns: None
- """
- MuranoCharm.singleton.restart_all()
-
-
-def configure_ssl(keystone=None):
- """Use the singleton from the MuranoCharm to configure ssl
-
- @param keystone: KeystoneRequires() interface class
- @returns: None
- """
- MuranoCharm.singleton.configure_ssl(keystone)
-
-def update_peers(hacluster):
- """Use the singleton from the MuranoCharm to update peers with detials
- of this unit
-
- @param hacluster: OpenstackHAPeers() interface class
- @returns: None
- """
- MuranoCharm.singleton.update_peers(hacluster)
-
-def assess_status():
- """Just call the MuranoCharm.singleton.assess_status() command to update
- status on the unit.
-
- @returns: None
- """
- MuranoCharm.singleton.assess_status()
-
-def render_novarc_config(interfaces_list):
- """Use the singleton from the MuranoCharm to run render_novarc_config
-
- @param interfaces_list: List of instances of interface classes.
- @returns: None
- """
- MuranoCharm.singleton.render_novarc_config(interfaces_list)
-
-def import_io_murano():
- """Use the singleton from the MuranoCharm to run import io-murano
- package
-
- @returns: None
- """
- MuranoCharm.singleton.import_io_murano()
-
-
class MuranoCharm(charms_openstack.charm.HAOpenStackCharm):
# Internal name of charm
@@ -132,7 +43,6 @@ class MuranoCharm(charms_openstack.charm.HAOpenStackCharm):
ha_resources = ['vips', 'haproxy']
-
sync_cmd = ['murano-db-manage', '--config-file', '/etc/murano/murano.conf', 'upgrade']
def __init__(self, release=None, **kwargs):
@@ -144,35 +54,6 @@ class MuranoCharm(charms_openstack.charm.HAOpenStackCharm):
release = ch_utils.os_release('python-keystonemiddleware')
super(MuranoCharm, self).__init__(release=release, **kwargs)
- def install(self):
- """Customise the installation, configure the source and then call the
- parent install() method to install the packages
- """
- self.configure_source()
- super(MuranoCharm, self).install()
-
- def render_novarc_config(self, interfaces_list):
- """Render novarc config to bootstrap Murano service
-
- @returns None
- """
- configs = [RC_FILE]
- self.render_with_interfaces(
- interfaces_list,
- configs=configs)
-
-
- def import_io_murano(self):
- """Install Core libary io-murano
-
- @returns None
- """
- io_murano_lib = "/usr/share/murano-common/io.murano.zip"
- if os.path.isfile(io_murano_lib):
- cmd = ['murano', 'package-import', io_murano_lib]
- run_command(cmd)
-
-
def get_amqp_credentials(self):
"""Provide the default amqp username and vhost as a tuple.
diff --git a/src/reactive/murano_handlers.py b/src/reactive/murano_handlers.py
index 55ccf5a..2eb4011 100644
--- a/src/reactive/murano_handlers.py
+++ b/src/reactive/murano_handlers.py
@@ -14,11 +14,8 @@
import charms_openstack.charm as charm
import charms.reactive as reactive
-import charmhelpers.core.hookenv as hookenv
-# This charm's library contains all of the handler code associated with
-# sdn_charm
-import charm.openstack.murano as murano # noqa
+#import charm.openstack.murano as murano
charm.use_defaults(
'charm.installed',
@@ -43,7 +40,6 @@ def render_config(*args):
with charm.provide_charm_instance() as charm_class:
charm_class.render_with_interfaces(args)
charm_class.assess_status()
- murano.render_novarc_config(args)
reactive.set_state('config.rendered')
@@ -54,20 +50,8 @@ def init_db():
charm_class.db_sync()
-@reactive.when_not('io-murano.imported')
-@reactive.when(*COMPLETE_INTERFACE_STATES)
-@reactive.when('config.rendered')
-def import_io_murano(*args):
- murano.import_io_murano()
- reactive.set_state('io-murano.imported')
-
-
@reactive.when('ha.connected')
def cluster_connected(hacluster):
- murano.configure_ha_resources(hacluster)
- murano.assess_status()
-
-
-@reactive.hook('upgrade-charm')
-def upgrade_charm():
- murano.install()
+ with charm.provide_charm_instance() as charm_class:
+ charm_class.configure_ha_resources(hacluster)
+ charm_class.assess_status()

This mirror site include all the OpenStack related repositories under: openstack, openstack-dev and openstack-infra.

NOTE: All repositories are updated every one hour.

Usage

For Git Clone
 git clone http://git.trystack.cn/openstack/nova.git 
For DevStack

Add GIT_BASE, NOVNC_REPO and SPICE_REPO variables to local.conf file.

[[local|localrc]]

# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git