Merge lp:~hazmat/pyjuju/proposed-support into lp:pyjuju

Proposed by Kapil Thangavelu
Status: Merged
Approved by: Kapil Thangavelu
Approved revision: 488
Merge reported by: Kapil Thangavelu
Merged at revision: not available
Proposed branch: lp:~hazmat/pyjuju/proposed-support
Merge into: lp:pyjuju
Diff against target: 199 lines (+69/-7)
6 files modified
juju/lib/lxc/__init__.py (+1/-0)
juju/lib/lxc/data/juju-create (+7/-1)
juju/providers/common/cloudinit.py (+17/-6)
juju/providers/common/launch.py (+2/-0)
juju/providers/common/tests/data/cloud_init_proposed (+37/-0)
juju/providers/common/tests/test_cloudinit.py (+5/-0)
To merge this branch: bzr merge lp:~hazmat/pyjuju/proposed-support
Reviewer Review Type Date Requested Status
Clint Byrum (community) Approve
Review via email: mp+107404@code.launchpad.net

Description of the change

Proposed apt repository pocket support for testing updates.

Adds a new juju-origin value of 'proposed' which enables the
proposed pocket against the current environment series when launching
machines.

To post a comment you must log in.
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Please take a look.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hi Kapil, this is great! Except one thing:

124 + if self._origin == PROPOSED:
125 + return ["deb $MIRROR $RELEASE-proposed main"]

Juju is not in 'main' yet. You'll need to enable universe as well. You can do so by adding just 'universe' as a word after 'main'.

Once that is done, +1!

review: Needs Fixing
lp:~hazmat/pyjuju/proposed-support updated
488. By Kapil Thangavelu

enable proposed on main AND universe.

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Updated to include universe, i'm going to go ahead and merge this then.

On Sat, May 26, 2012 at 1:24 AM, Clint Byrum <email address hidden> wrote:

> Review: Needs Fixing
>
> Hi Kapil, this is great! Except one thing:
>
> 124 + if self._origin == PROPOSED:
> 125 + return ["deb $MIRROR $RELEASE-proposed main"]
>
> Juju is not in 'main' yet. You'll need to enable universe as well. You can
> do so by adding just 'universe' as a word after 'main'.
>
> Once that is done, +1!
> --
> https://code.launchpad.net/~hazmat/juju/proposed-support/+merge/107404
> You are the owner of lp:~hazmat/juju/proposed-support.
>

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Looks great thanks Kapil!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'juju/lib/lxc/__init__.py'
--- juju/lib/lxc/__init__.py 2012-04-12 18:39:20 +0000
+++ juju/lib/lxc/__init__.py 2012-05-29 15:26:21 +0000
@@ -246,6 +246,7 @@
246 print >>fp, escape("JUJU_CONTAINER_NAME", self.container_name)246 print >>fp, escape("JUJU_CONTAINER_NAME", self.container_name)
247 print >>fp, escape("JUJU_PUBLIC_KEY", self.public_key)247 print >>fp, escape("JUJU_PUBLIC_KEY", self.public_key)
248 print >>fp, escape("JUJU_ORIGIN", self.origin)248 print >>fp, escape("JUJU_ORIGIN", self.origin)
249 print >>fp, escape("JUJU_SERIES", self.series)
249 if self.source:250 if self.source:
250 print >>fp, escape("JUJU_SOURCE", self.source)251 print >>fp, escape("JUJU_SOURCE", self.source)
251252
252253
=== modified file 'juju/lib/lxc/data/juju-create'
--- juju/lib/lxc/data/juju-create 2012-05-10 16:20:36 +0000
+++ juju/lib/lxc/data/juju-create 2012-05-29 15:26:21 +0000
@@ -99,11 +99,17 @@
99 apt-get install $APT_OPTIONS bzr tmux sudo python-software-properties python-yaml99 apt-get install $APT_OPTIONS bzr tmux sudo python-software-properties python-yaml
100100
101 if [ $JUJU_ORIGIN = "ppa" ]; then101 if [ $JUJU_ORIGIN = "ppa" ]; then
102 # the echo forces an enter to get around the interactive102 # The echo forces an enter to get around the interactive
103 # prompt in apt-add-repository103 # prompt in apt-add-repository
104 echo y | apt-add-repository ppa:juju/pkgs104 echo y | apt-add-repository ppa:juju/pkgs
105 apt-get update105 apt-get update
106 apt-get install $APT_OPTIONS juju python-txzookeeper106 apt-get install $APT_OPTIONS juju python-txzookeeper
107 elif [ $JUJU_ORIGIN = "proposed"]; then
108 # Enabled testing of proposed updates
109 echo "deb http://archive.ubuntu.com/ubuntu/ $JUJU_SERIES-proposed main universe" >> /etc/apt/sources.list
110 apt-get update
111 apt-get install $APT_OPTIONS juju python-txzookeeper
112
107 elif [[ $JUJU_ORIGIN = lp:* ]]; then113 elif [[ $JUJU_ORIGIN = lp:* ]]; then
108 apt-get install $APT_OPTIONS python-txzookeeper python-setuptools114 apt-get install $APT_OPTIONS python-txzookeeper python-setuptools
109 mkdir /usr/lib/juju115 mkdir /usr/lib/juju
110116
=== modified file 'juju/providers/common/cloudinit.py'
--- juju/providers/common/cloudinit.py 2012-03-29 01:37:57 +0000
+++ juju/providers/common/cloudinit.py 2012-05-29 15:26:21 +0000
@@ -11,6 +11,7 @@
11DISTRO = "distro"11DISTRO = "distro"
12PPA = "ppa"12PPA = "ppa"
13BRANCH = "branch"13BRANCH = "branch"
14PROPOSED = "proposed"
1415
1516
16def _branch_install_scripts(branch):17def _branch_install_scripts(branch):
@@ -23,8 +24,9 @@
2324
24def _install_scripts(origin, origin_url):25def _install_scripts(origin, origin_url):
25 scripts = []26 scripts = []
26 if origin not in (DISTRO, PPA):27 if origin == BRANCH:
27 scripts.extend(_branch_install_scripts(origin_url))28 scripts.extend(_branch_install_scripts(origin_url))
29
28 scripts.extend([30 scripts.extend([
29 "sudo mkdir -p /var/lib/juju",31 "sudo mkdir -p /var/lib/juju",
30 "sudo mkdir -p /var/log/juju"])32 "sudo mkdir -p /var/log/juju"])
@@ -69,7 +71,7 @@
69 for line in data.splitlines():71 for line in data.splitlines():
70 stripped = line.lstrip()72 stripped = line.lstrip()
71 if stripped:73 if stripped:
72 yield (len(line)-len(stripped), stripped)74 yield (len(line) - len(stripped), stripped)
7375
7476
75def parse_juju_origin(data):77def parse_juju_origin(data):
@@ -109,7 +111,7 @@
109 return PPA, None111 return PPA, None
110 indent, line = next()112 indent, line = next()
111 if indent != first_indent:113 if indent != first_indent:
112 break # Going into a different version114 break # Going into a different version
113 except StopIteration:115 except StopIteration:
114 pass116 pass
115 return DISTRO, None117 return DISTRO, None
@@ -163,7 +165,8 @@
163 self._zookeeper = True165 self._zookeeper = True
164 self._provision = True166 self._provision = True
165167
166 def set_juju_source(self, branch=None, ppa=False, distro=False):168 def set_juju_source(
169 self, branch=None, ppa=False, distro=False, proposed=False):
167 """Set the version of juju the machine should run.170 """Set the version of juju the machine should run.
168171
169 :param branch: location from which to check out juju; for example,172 :param branch: location from which to check out juju; for example,
@@ -176,13 +179,16 @@
176 :param bool distro: if True, get the default juju version from the179 :param bool distro: if True, get the default juju version from the
177 OS distribution.180 OS distribution.
178181
182 :param bool proposed: if True, get the proposed juju version
183 from the OS distribution.
184
179 :raises: :exc:`juju.errors.CloudInitError` if more than one option,185 :raises: :exc:`juju.errors.CloudInitError` if more than one option,
180 or fewer than one options, are specified.186 or fewer than one options, are specified.
181187
182 Note that you don't need to call this method; the juju source188 Note that you don't need to call this method; the juju source
183 defaults to what is returned by `get_default_origin`.189 defaults to what is returned by `get_default_origin`.
184 """190 """
185 if len(filter(None, (branch, ppa, distro))) != 1:191 if len(filter(None, (branch, ppa, distro, proposed))) != 1:
186 raise CloudInitError("Please specify one source")192 raise CloudInitError("Please specify one source")
187 if branch:193 if branch:
188 self._origin = BRANCH194 self._origin = BRANCH
@@ -193,6 +199,9 @@
193 elif distro:199 elif distro:
194 self._origin = DISTRO200 self._origin = DISTRO
195 self._origin_url = None201 self._origin_url = None
202 elif proposed:
203 self._origin = PROPOSED
204 self._origin_url = None
196205
197 def set_machine_id(self, id):206 def set_machine_id(self, id):
198 """Specify the juju machine ID.207 """Specify the juju machine ID.
@@ -296,11 +305,13 @@
296 if self._zookeeper:305 if self._zookeeper:
297 packages.extend([306 packages.extend([
298 "default-jre-headless", "zookeeper", "zookeeperd"])307 "default-jre-headless", "zookeeper", "zookeeperd"])
299 if self._origin in (DISTRO, PPA):308 if self._origin in (DISTRO, PPA, PROPOSED):
300 packages.append("juju")309 packages.append("juju")
301 return packages310 return packages
302311
303 def _collect_repositories(self):312 def _collect_repositories(self):
313 if self._origin == PROPOSED:
314 return ["deb $MIRROR $RELEASE-proposed main universe"]
304 if self._origin != DISTRO:315 if self._origin != DISTRO:
305 return ["ppa:juju/pkgs"]316 return ["ppa:juju/pkgs"]
306 return []317 return []
307318
=== modified file 'juju/providers/common/launch.py'
--- juju/providers/common/launch.py 2012-03-29 01:37:57 +0000
+++ juju/providers/common/launch.py 2012-05-29 15:26:21 +0000
@@ -101,6 +101,8 @@
101 cloud_init.set_juju_source(branch=origin)101 cloud_init.set_juju_source(branch=origin)
102 elif origin == "ppa":102 elif origin == "ppa":
103 cloud_init.set_juju_source(ppa=True)103 cloud_init.set_juju_source(ppa=True)
104 elif origin == "proposed":
105 cloud_init.set_juju_source(proposed=True)
104 else:106 else:
105 # Ignore other values, just use the distro for sanity107 # Ignore other values, just use the distro for sanity
106 cloud_init.set_juju_source(distro=True)108 cloud_init.set_juju_source(distro=True)
107109
=== added file 'juju/providers/common/tests/data/cloud_init_proposed'
--- juju/providers/common/tests/data/cloud_init_proposed 1970-01-01 00:00:00 +0000
+++ juju/providers/common/tests/data/cloud_init_proposed 2012-05-29 15:26:21 +0000
@@ -0,0 +1,37 @@
1#cloud-config
2apt-update: true
3apt-upgrade: true
4apt_sources:
5- {source: 'deb $MIRROR $RELEASE-proposed main universe'}
6machine-data: {juju-provider-type: dummy, juju-zookeeper-hosts: 'cotswold:2181,longleat:2181',
7 machine-id: passport}
8output: {all: '| tee -a /var/log/cloud-init-output.log'}
9packages: [bzr, byobu, tmux, python-setuptools, python-twisted, python-txaws, python-zookeeper, juju]
10runcmd: [sudo mkdir -p /var/lib/juju, sudo mkdir -p
11 /var/log/juju, 'cat >> /etc/init/juju-machine-agent.conf <<EOF
12
13 description "Juju machine agent"
14
15 author "Juju Team <juju@lists.ubuntu.com>"
16
17
18 start on runlevel [2345]
19
20 stop on runlevel [!2345]
21
22 respawn
23
24
25 env JUJU_MACHINE_ID="passport"
26
27 env JUJU_ZOOKEEPER="cotswold:2181,longleat:2181"
28
29
30 exec python -m juju.agents.machine --nodaemon --logfile /var/log/juju/machine-agent.log
31 --session-file /var/run/juju/machine-agent.zksession >> /tmp/juju-machine-agent.output
32 2>&1
33
34 EOF
35
36 ', /sbin/start juju-machine-agent]
37ssh_authorized_keys: [chubb]
038
=== modified file 'juju/providers/common/tests/test_cloudinit.py'
--- juju/providers/common/tests/test_cloudinit.py 2012-03-29 01:37:57 +0000
+++ juju/providers/common/tests/test_cloudinit.py 2012-05-29 15:26:21 +0000
@@ -116,6 +116,11 @@
116 cloud_init.set_juju_source(distro=True)116 cloud_init.set_juju_source(distro=True)
117 self.assert_render(cloud_init, "cloud_init_distro")117 self.assert_render(cloud_init, "cloud_init_distro")
118118
119 def test_render_proposed_source(self):
120 cloud_init = self.construct_normal()
121 cloud_init.set_juju_source(proposed=True)
122 self.assert_render(cloud_init, "cloud_init_proposed")
123
119 def test_render_branch_source(self):124 def test_render_branch_source(self):
120 cloud_init = self.construct_normal()125 cloud_init = self.construct_normal()
121 cloud_init.set_juju_source(branch="lp:blah/juju/blah-blah")126 cloud_init.set_juju_source(branch="lp:blah/juju/blah-blah")

Subscribers

People subscribed via source and target branches

to status/vote changes: