# !/usr/bin/python

import os
import sys

sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))

from lib.charmhelpers.core import (
    hookenv,
    host,
)

from lib.charmhelpers.fetch import (
    apt_update,
    apt_upgrade,
    apt_install
)

hooks = hookenv.Hooks()
log = hookenv.log

SERVICE = 'openstack-trove'


@hooks.hook('install')
def install():
    log('Updating apt source')
    apt_update()

    log('Upgrading packages')
    apt_upgrade()

    log('Installing openstack-trove')
    apt_install('python-trove',
                'python-troveclient',
                'python-glanceclient',
                'trove-common',
                'trove-api',
                'trove-taskmanager')


@hooks.hook('config-changed')
def config_changed():
    config = hookenv.config()

    for key in config:
        if config.changed(key):
            log("config['{}'] changed from {} to {}".format(
                key, config.previous(key), config[key]))

    config.save()
    start()


@hooks.hook('upgrade-charm')
def upgrade_charm():
    log('Upgrading openstack-trove')


@hooks.hook('start')
def start():
    host.service_restart(SERVICE) or host.service_start(SERVICE)


@hooks.hook('stop')
def stop():
    host.service_stop(SERVICE)


if __name__ == "__main__":
    # execute a hook based on the name the program is called by
    hooks.execute(sys.argv)

@@ -306,28 +306,65 @@
 VICE
+S
  = 
-'openstack-trove'
+%5B'trove-api', 'trove-taskmanager', 'trove-conductor'%5D
 %0A%0A%0A@
@@ -1153,24 +1153,57 @@
 ef start():%0A
+    for service in SERVICES:%0A    
     host.ser
@@ -1215,23 +1215,23 @@
 restart(
-SERVICE
+service
 ) or hos
@@ -1246,23 +1246,23 @@
 e_start(
-SERVICE
+service
 )%0A%0A%0A@hoo
@@ -1285,24 +1285,57 @@
 def stop():%0A
+    for service in SERVICES:%0A    
     host.ser
@@ -1344,23 +1344,23 @@
 ce_stop(
-SERVICE
+service
 )%0A%0A%0Aif _

Add start and stop features