Merge lp:~frankban/charms/precise/juju-gui/install-yaml into lp:~juju-gui/charms/precise/juju-gui/trunk

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 127
Proposed branch: lp:~frankban/charms/precise/juju-gui/install-yaml
Merge into: lp:~juju-gui/charms/precise/juju-gui/trunk
Diff against target: 145 lines (+28/-25)
6 files modified
hooks/backend.py (+1/-2)
hooks/install (+10/-6)
hooks/utils.py (+12/-12)
revision (+1/-1)
server-requirements.pip (+2/-0)
tests/test_backends.py (+2/-4)
To merge this branch: bzr merge lp:~frankban/charms/precise/juju-gui/install-yaml
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+195113@code.launchpad.net

Description of the change

Fix base Python dependencies.

The install hook imported charmhelpers
before installing python-yaml, and
charmhelpers imports from yaml.

This very old bug has been hidden by the
fact that python-yaml is automatically
installed in ec2/lxc instances, but showed
itself when using the manual provider.

Copy/pasting and integrating the QA from
my last branch, a double check can help
before the release.
QA:
- Bootstrap a Juju environment with --debug.
- Deploy and expose the GUI (make deploy).
- Check juju debug-log (or
  less ~/.juju/local/log/unit-juju-gui-0.log if you
  used lxc): you should see the following message
  at the beginning of the install hook log:
  "Installing base Python dependencies: python-apt,
  python-launchpadlib, python-tempita, python-yaml."
- Wait for the GUI to be ready/started.
- Deploy this bundle: http://pastebin.ubuntu.com/6411548/
- Check everything is ok, xy annotations work (
  the services are vertically aligned), wordpress has
  customized constraints, mysql customized options and
  two units.
- No try to deploy the same bundle again, you
  will see a "services already there" kind of error.

https://codereview.appspot.com/26190043/

To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote :
Download full text (5.9 KiB)

Reviewers: mp+195113_code.launchpad.net,

Message:
Please take a look.

Description:
Fix base Python dependencies.

The install hook imported charmhelpers
before installing python-yaml, and
charmhelpers imports from yaml.

This very old bug has been hidden by the
fact that python-yaml is automatically
installed in ec2/lxc instances, but showed
itself when using the manual provider.

Copy/pasting and integrating the QA from
my last branch, a double check can help
before the release.
QA:
- Bootstrap a Juju environment with --debug.
- Deploy and expose the GUI (make deploy).
- Check juju debug-log (or
   less ~/.juju/local/log/unit-juju-gui-0.log if you
   used lxc): you should see the following message
   at the beginning of the install hook log:
   "Installing base Python dependencies: python-apt,
   python-launchpadlib, python-tempita, python-yaml."
- Wait for the GUI to be ready/started.
- Deploy this bundle: http://pastebin.ubuntu.com/6411548/
- Check everything is ok, xy annotations work (
   the services are vertically aligned), wordpress has
   customized constraints, mysql customized options and
   two units.
- No try to deploy the same bundle again, you
   will see a "services already there" kind of error.

https://code.launchpad.net/~frankban/charms/precise/juju-gui/install-yaml/+merge/195113

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/26190043/

Affected files (+30, -25 lines):
   A [revision details]
   M hooks/backend.py
   M hooks/install
   M hooks/utils.py
   M revision
   M server-requirements.pip
   M tests/test_backends.py

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision:
<email address hidden>

Index: revision
=== modified file 'revision'
--- revision 2013-11-13 16:36:02 +0000
+++ revision 2013-11-13 18:01:03 +0000
@@ -1,1 +1,1 @@
-97
+98

Index: server-requirements.pip
=== modified file 'server-requirements.pip'
--- server-requirements.pip 2013-11-13 17:45:50 +0000
+++ server-requirements.pip 2013-11-13 18:01:03 +0000
@@ -18,6 +18,8 @@

  # Note: the order of the following dependencies is important! The last ones
  # depends on the previous.
+# The python-bzrlib and python-yaml dependencies are installed using apt in
+# the charm hooks.

  futures==2.1.4
  tornado==3.1.1

Index: hooks/backend.py
=== modified file 'hooks/backend.py'
--- hooks/backend.py 2013-10-08 07:46:11 +0000
+++ hooks/backend.py 2013-11-13 18:01:03 +0000
@@ -106,8 +106,7 @@

  class GoMixin(object):
      """Manage the real Go juju-core backend."""
-
- debs = ('python-yaml',)
+ pass

  class GuiMixin(object):

Index: hooks/install
=== modified file 'hooks/install'
--- hooks/install 2013-10-07 14:45:00 +0000
+++ hooks/install 2013-11-13 18:01:03 +0000
@@ -20,10 +20,6 @@
  import errno
  import os

-from charmhelpers import (
- get_config,
- log,
-)
  from shelltoolbox import (
      apt_get_install,
      run,
@@ -32,1...

Read more...

129. By Francesco Banconi

Fix typo.

Revision history for this message
Francesco Banconi (frankban) wrote :
Revision history for this message
Gary Poster (gary) wrote :
Revision history for this message
Francesco Banconi (frankban) wrote :

*** Submitted:

Fix base Python dependencies.

The install hook imported charmhelpers
before installing python-yaml, and
charmhelpers imports from yaml.

This very old bug has been hidden by the
fact that python-yaml is automatically
installed in ec2/lxc instances, but showed
itself when using the manual provider.

Copy/pasting and integrating the QA from
my last branch, a double check can help
before the release.
QA:
- Bootstrap a Juju environment with --debug.
- Deploy and expose the GUI (make deploy).
- Check juju debug-log (or
   less ~/.juju/local/log/unit-juju-gui-0.log if you
   used lxc): you should see the following message
   at the beginning of the install hook log:
   "Installing base Python dependencies: python-apt,
   python-launchpadlib, python-tempita, python-yaml."
- Wait for the GUI to be ready/started.
- Deploy this bundle: http://pastebin.ubuntu.com/6411548/
- Check everything is ok, xy annotations work (
   the services are vertically aligned), wordpress has
   customized constraints, mysql customized options and
   two units.
- No try to deploy the same bundle again, you
   will see a "services already there" kind of error.

R=gary.poster
CC=
https://codereview.appspot.com/26190043

https://codereview.appspot.com/26190043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/backend.py'
2--- hooks/backend.py 2013-10-08 07:46:11 +0000
3+++ hooks/backend.py 2013-11-13 18:37:19 +0000
4@@ -106,8 +106,7 @@
5
6 class GoMixin(object):
7 """Manage the real Go juju-core backend."""
8-
9- debs = ('python-yaml',)
10+ pass
11
12
13 class GuiMixin(object):
14
15=== modified file 'hooks/install'
16--- hooks/install 2013-10-07 14:45:00 +0000
17+++ hooks/install 2013-11-13 18:37:19 +0000
18@@ -20,10 +20,6 @@
19 import errno
20 import os
21
22-from charmhelpers import (
23- get_config,
24- log,
25-)
26 from shelltoolbox import (
27 apt_get_install,
28 run,
29@@ -32,13 +28,21 @@
30
31 # Python dependencies must be installed here so that the charm can import and
32 # use required libraries.
33-PYTHON_DEPENDENCIES = ('python-apt', 'python-launchpadlib', 'python-tempita')
34+PYTHON_DEPENDENCIES = (
35+ 'python-apt', 'python-launchpadlib', 'python-tempita', 'python-yaml')
36
37-log('Installing base Python dependnecies: {}.'.format(
38+run('juju-log', '--', 'Installing base Python dependencies: {}.'.format(
39 ', '.join(PYTHON_DEPENDENCIES)))
40 apt_get_install(*PYTHON_DEPENDENCIES)
41
42
43+# The charmhelpers module depends on python-yaml and must be imported only
44+# after the installation of the Python dependencies above.
45+from charmhelpers import (
46+ get_config,
47+ log,
48+)
49+
50 from utils import (
51 config_json,
52 log_hook,
53
54=== modified file 'hooks/utils.py'
55--- hooks/utils.py 2013-11-12 12:23:25 +0000
56+++ hooks/utils.py 2013-11-13 18:37:19 +0000
57@@ -74,11 +74,20 @@
58 import urlparse
59
60 import apt
61+from launchpadlib.launchpad import Launchpad
62 import tempita
63+import yaml
64
65-from launchpadlib.launchpad import Launchpad
66+from charmhelpers import (
67+ get_config,
68+ log,
69+ RESTART,
70+ service_control,
71+ START,
72+ STOP,
73+ unit_get,
74+)
75 from shelltoolbox import (
76- Serializer,
77 apt_get_install,
78 command,
79 environ,
80@@ -86,17 +95,9 @@
81 run,
82 script_name,
83 search_file,
84+ Serializer,
85 su,
86 )
87-from charmhelpers import (
88- RESTART,
89- START,
90- STOP,
91- get_config,
92- log,
93- service_control,
94- unit_get,
95-)
96
97
98 AGENT = 'juju-api-agent'
99@@ -173,7 +174,6 @@
100 # The JUJU_API_ADDRESSES environment variable is not included in the hooks
101 # context in older releases of juju-core. Retrieve it from the machiner
102 # agent file instead.
103- import yaml # python-yaml is only installed if juju-core is used.
104 if unit_dir is None:
105 base_dir = os.path.join(CURRENT_DIR, '..', '..')
106 else:
107
108=== modified file 'revision'
109--- revision 2013-11-13 16:36:02 +0000
110+++ revision 2013-11-13 18:37:19 +0000
111@@ -1,1 +1,1 @@
112-97
113+98
114
115=== modified file 'server-requirements.pip'
116--- server-requirements.pip 2013-11-13 17:45:50 +0000
117+++ server-requirements.pip 2013-11-13 18:37:19 +0000
118@@ -18,6 +18,8 @@
119
120 # Note: the order of the following dependencies is important! The last ones
121 # depends on the previous.
122+# The python-bzrlib and python-yaml dependencies are installed using apt in
123+# the charm hooks.
124
125 futures==2.1.4
126 tornado==3.1.1
127
128=== modified file 'tests/test_backends.py'
129--- tests/test_backends.py 2013-10-07 14:17:11 +0000
130+++ tests/test_backends.py 2013-11-13 18:37:19 +0000
131@@ -33,12 +33,10 @@
132
133
134 EXPECTED_PYTHON_LEGACY_DEBS = ('apache2', 'curl', 'haproxy', 'openssl')
135-EXPECTED_GO_LEGACY_DEBS = (
136- 'apache2', 'curl', 'haproxy', 'openssl', 'python-yaml')
137+EXPECTED_GO_LEGACY_DEBS = ('apache2', 'curl', 'haproxy', 'openssl')
138 EXPECTED_PYTHON_BUILTIN_DEBS = (
139 'curl', 'openssl', 'python-bzrlib', 'python-pip')
140-EXPECTED_GO_BUILTIN_DEBS = (
141- 'curl', 'openssl', 'python-bzrlib', 'python-pip', 'python-yaml')
142+EXPECTED_GO_BUILTIN_DEBS = ('curl', 'openssl', 'python-bzrlib', 'python-pip')
143
144 simulate_pyjuju = mock.patch('utils.legacy_juju', mock.Mock(return_value=True))
145 simulate_juju_core = mock.patch(

Subscribers

People subscribed via source and target branches