Merge lp:~junaidali/charms/trusty/plumgrid-edge/trunk into lp:~plumgrid-team/charms/trusty/plumgrid-edge/trunk

Proposed by Junaid Ali
Status: Merged
Merged at revision: 26
Proposed branch: lp:~junaidali/charms/trusty/plumgrid-edge/trunk
Merge into: lp:~plumgrid-team/charms/trusty/plumgrid-edge/trunk
Diff against target: 77 lines (+17/-2)
3 files modified
hooks/pg_edge_hooks.py (+12/-0)
hooks/pg_edge_utils.py (+3/-1)
templates/kilo/00-pg.conf (+2/-1)
To merge this branch: bzr merge lp:~junaidali/charms/trusty/plumgrid-edge/trunk
Reviewer Review Type Date Requested Status
Bilal Baqar Approve
Review via email: mp+291149@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Bilal Baqar (bbaqar) :
review: Approve
26. By Bilal Baqar

Adding status messages in charms - Ticket:[SOL-949]

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/pg_edge_hooks.py'
2--- hooks/pg_edge_hooks.py 2016-03-27 15:40:59 +0000
3+++ hooks/pg_edge_hooks.py 2016-04-06 18:43:48 +0000
4@@ -15,6 +15,7 @@
5 relation_set,
6 relation_ids,
7 config,
8+ status_set
9 )
10
11 from charmhelpers.fetch import (
12@@ -48,8 +49,10 @@
13 '''
14 Install hook is run when the charm is first deployed on a node.
15 '''
16+ status_set('maintenance', 'Executing pre-install')
17 load_iptables()
18 configure_sources(update=True)
19+ status_set('maintenance', 'Installing apt packages')
20 pkgs = determine_packages()
21 for pkg in pkgs:
22 apt_install(pkg, options=['--force-yes'], fatal=True)
23@@ -104,6 +107,7 @@
24 charm_config.changed('install_keys') or
25 charm_config.changed('iovisor-build')):
26 stop_pg()
27+ status_set('maintenance', 'Upgrading apt packages')
28 configure_sources(update=True)
29 pkgs = determine_packages()
30 for pkg in pkgs:
31@@ -137,6 +141,14 @@
32 stop_pg()
33
34
35+@hooks.hook('update-status')
36+def update_status():
37+ if service_running('plumgrid'):
38+ status_set('active', 'Unit is ready')
39+ else:
40+ status_set('blocked', 'plumgrid service not running')
41+
42+
43 def main():
44 try:
45 hooks.execute(sys.argv)
46
47=== modified file 'hooks/pg_edge_utils.py'
48--- hooks/pg_edge_utils.py 2016-03-26 21:06:23 +0000
49+++ hooks/pg_edge_utils.py 2016-04-06 18:43:48 +0000
50@@ -16,7 +16,8 @@
51 from charmhelpers.core.hookenv import (
52 log,
53 config,
54- unit_get
55+ unit_get,
56+ status_set
57 )
58 from charmhelpers.contrib.network.ip import (
59 get_iface_from_addr,
60@@ -174,6 +175,7 @@
61 raise ValueError("plumgrid service couldn't be started")
62 else:
63 raise ValueError("libvirt-bin service couldn't be started")
64+ status_set('active', 'Unit is ready')
65
66
67 def stop_pg():
68
69=== added symlink 'hooks/update-status'
70=== target is u'pg_edge_hooks.py'
71=== modified file 'templates/kilo/00-pg.conf'
72--- templates/kilo/00-pg.conf 2016-03-25 12:39:00 +0000
73+++ templates/kilo/00-pg.conf 2016-04-06 18:43:48 +0000
74@@ -1,1 +1,2 @@
75-$template ls_json,"{{'{'}}{{'%'}}timestamp:::date-rfc3339,jsonf:@timestamp%,%source:::jsonf:@source_host%,%msg:::json%}":syslogtag,isequal,"pg:" @{{ opsvm_ip }}:6000;ls_json
76+$template ls_json,"{{'{'}}{{'%'}}timestamp:::date-rfc3339,jsonf:@timestamp%,%source:::jsonf:@source_host%,%msg:::json%}"
77+:syslogtag,isequal,"pg:" @{{ opsvm_ip }}:6000;ls_json

Subscribers

People subscribed via source and target branches