Added status messages and updated opsvm changes
This commit is contained in:
parent
76fe3cb784
commit
afdf7d0f37
|
@ -6,12 +6,13 @@
|
|||
# in this file.
|
||||
|
||||
import sys
|
||||
|
||||
from charmhelpers.core.host import service_running
|
||||
from charmhelpers.core.hookenv import (
|
||||
Hooks,
|
||||
UnregisteredHookError,
|
||||
log,
|
||||
config,
|
||||
status_set
|
||||
)
|
||||
|
||||
from charmhelpers.core.host import (
|
||||
|
@ -41,7 +42,9 @@ def install():
|
|||
'''
|
||||
Install hook is run when the charm is first deployed on a node.
|
||||
'''
|
||||
status_set('maintenance', 'Executing pre-install')
|
||||
configure_sources()
|
||||
status_set('maintenance', 'Installing apt packages')
|
||||
apt_update()
|
||||
pkgs = determine_packages()
|
||||
for pkg in pkgs:
|
||||
|
@ -60,6 +63,7 @@ def config_changed():
|
|||
if (charm_config.changed('install_sources') or
|
||||
charm_config.changed('plumgrid-build') or
|
||||
charm_config.changed('install_keys')):
|
||||
status_set('maintenance', 'Upgrading apt packages')
|
||||
configure_sources()
|
||||
apt_update()
|
||||
pkgs = determine_packages()
|
||||
|
@ -93,6 +97,14 @@ def stop():
|
|||
log('Charm stopping without removal of packages')
|
||||
|
||||
|
||||
@hooks.hook('update-status')
|
||||
def update_status():
|
||||
if service_running('neutron-server'):
|
||||
status_set('active', 'Unit is ready')
|
||||
else:
|
||||
status_set('blocked', 'neutron server not running')
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
|
|
@ -13,7 +13,7 @@ from charmhelpers.fetch import (
|
|||
)
|
||||
from charmhelpers.core.hookenv import (
|
||||
config,
|
||||
is_leader,
|
||||
is_leader
|
||||
)
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
os_release,
|
||||
|
|
Loading…
Reference in New Issue