Merge ~johnsca/charms/+source/basic:imports into ~bcsaller/charms/+source/basic:master

Proposed by Cory Johns
Status: Needs review
Proposed branch: ~johnsca/charms/+source/basic:imports
Merge into: ~bcsaller/charms/+source/basic:master
Diff against target: 77 lines (+13/-10)
5 files modified
hooks/config-changed (+1/-1)
hooks/install (+1/-1)
hooks/start (+1/-1)
hooks/stop (+1/-1)
reactive/main.py (+9/-6)
Reviewer Review Type Date Requested Status
Benjamin Saller Pending
Review via email: mp+268644@code.launchpad.net

Description of the change

Fixed import issues due to charms.reactive split

To post a comment you must log in.

Unmerged commits

929f77a... by Cory Johns

Fixed import issues

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/hooks/config-changed b/hooks/config-changed
2index 2ce463f..786acbc 100755
3--- a/hooks/config-changed
4+++ b/hooks/config-changed
5@@ -10,5 +10,5 @@ sys.path.append('lib')
6 #
7 # See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
8 # for more information on this pattern.
9-from charmhelpers.core.reactive import main
10+from charms.reactive import main
11 main()
12diff --git a/hooks/install b/hooks/install
13index 2ce463f..786acbc 100755
14--- a/hooks/install
15+++ b/hooks/install
16@@ -10,5 +10,5 @@ sys.path.append('lib')
17 #
18 # See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
19 # for more information on this pattern.
20-from charmhelpers.core.reactive import main
21+from charms.reactive import main
22 main()
23diff --git a/hooks/start b/hooks/start
24index 2ce463f..786acbc 100755
25--- a/hooks/start
26+++ b/hooks/start
27@@ -10,5 +10,5 @@ sys.path.append('lib')
28 #
29 # See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
30 # for more information on this pattern.
31-from charmhelpers.core.reactive import main
32+from charms.reactive import main
33 main()
34diff --git a/hooks/stop b/hooks/stop
35index 2ce463f..786acbc 100755
36--- a/hooks/stop
37+++ b/hooks/stop
38@@ -10,5 +10,5 @@ sys.path.append('lib')
39 #
40 # See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
41 # for more information on this pattern.
42-from charmhelpers.core.reactive import main
43+from charms.reactive import main
44 main()
45diff --git a/reactive/main.py b/reactive/main.py
46index a5be3c4..067c3d3 100644
47--- a/reactive/main.py
48+++ b/reactive/main.py
49@@ -1,19 +1,22 @@
50-from reactive import local
51-
52 from charmhelpers.core.hookenv import status_set
53-from charmhelpers.core.reactive import hook
54 from charmhelpers.core.unitdata import kv
55-
56 from charmhelpers.fetch import apt_install
57 from charmhelpers.fetch import filter_installed_packages
58
59+from charms.reactive import hook
60+
61+try:
62+ from local import PACKAGES
63+except ImportError:
64+ PACKAGES = []
65+
66
67 db = kv()
68
69
70 @hook('install')
71 def install_packages():
72- if not db.get('installed'):
73+ if PACKAGES and not db.get('installed'):
74 status_set('maintenance', 'Installing packages')
75- apt_install(filter_installed_packages(local.PACKAGES))
76+ apt_install(filter_installed_packages(PACKAGES))
77 db.set('installed', True)

Subscribers

People subscribed via source and target branches

to all changes: