Merge ~thedac/charms/+source/layer-openstack:master into ~openstack-charmers/charms/+source/layer-openstack:master

Proposed by David Ames
Status: Merged
Merged at revision: fdde4fbcb101ce7d305375550644ac84eab1f7c1
Proposed branch: ~thedac/charms/+source/layer-openstack:master
Merge into: ~openstack-charmers/charms/+source/layer-openstack:master
Diff against target: 36 lines (+11/-0)
1 file modified
lib/charm/openstack/charm.py (+11/-0)
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+292656@code.launchpad.net

Description of the change

Create an installed state

Provide an installed state to allow reacting to when the layer is installed.

To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

LGTM, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/charm/openstack/charm.py b/lib/charm/openstack/charm.py
2index 98a50da..6046429 100644
3--- a/lib/charm/openstack/charm.py
4+++ b/lib/charm/openstack/charm.py
5@@ -20,6 +20,8 @@ from charmhelpers.contrib.openstack.templating import get_loader
6 from charmhelpers.core.templating import render
7 from charmhelpers.core.hookenv import leader_get, leader_set
8
9+from charms.reactive.bus import set_state, remove_state
10+
11
12 class OpenStackCharm(object):
13 """
14@@ -27,6 +29,8 @@ class OpenStackCharm(object):
15 encapulates general OpenStack charm payload operations
16 """
17
18+ name = 'charmname'
19+
20 packages = []
21 """Packages to install"""
22
23@@ -63,6 +67,13 @@ class OpenStackCharm(object):
24 if packages:
25 status_set('maintenance', 'Installing packages')
26 apt_install(packages, fatal=True)
27+ self.set_state('{}-installed'.format(self.name))
28+
29+ def set_state(self, state, value=None):
30+ set_state(state, value)
31+
32+ def remove_state(self, state):
33+ remove_state(state)
34
35 def api_port(self, service, endpoint_type=PUBLIC):
36 """

Subscribers

People subscribed via source and target branches

to all changes: