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
1=== modified file 'juju/lib/lxc/__init__.py'
2--- juju/lib/lxc/__init__.py 2012-04-12 18:39:20 +0000
3+++ juju/lib/lxc/__init__.py 2012-05-29 15:26:21 +0000
4@@ -246,6 +246,7 @@
5 print >>fp, escape("JUJU_CONTAINER_NAME", self.container_name)
6 print >>fp, escape("JUJU_PUBLIC_KEY", self.public_key)
7 print >>fp, escape("JUJU_ORIGIN", self.origin)
8+ print >>fp, escape("JUJU_SERIES", self.series)
9 if self.source:
10 print >>fp, escape("JUJU_SOURCE", self.source)
11
12
13=== modified file 'juju/lib/lxc/data/juju-create'
14--- juju/lib/lxc/data/juju-create 2012-05-10 16:20:36 +0000
15+++ juju/lib/lxc/data/juju-create 2012-05-29 15:26:21 +0000
16@@ -99,11 +99,17 @@
17 apt-get install $APT_OPTIONS bzr tmux sudo python-software-properties python-yaml
18
19 if [ $JUJU_ORIGIN = "ppa" ]; then
20- # the echo forces an enter to get around the interactive
21+ # The echo forces an enter to get around the interactive
22 # prompt in apt-add-repository
23 echo y | apt-add-repository ppa:juju/pkgs
24 apt-get update
25 apt-get install $APT_OPTIONS juju python-txzookeeper
26+ elif [ $JUJU_ORIGIN = "proposed"]; then
27+ # Enabled testing of proposed updates
28+ echo "deb http://archive.ubuntu.com/ubuntu/ $JUJU_SERIES-proposed main universe" >> /etc/apt/sources.list
29+ apt-get update
30+ apt-get install $APT_OPTIONS juju python-txzookeeper
31+
32 elif [[ $JUJU_ORIGIN = lp:* ]]; then
33 apt-get install $APT_OPTIONS python-txzookeeper python-setuptools
34 mkdir /usr/lib/juju
35
36=== modified file 'juju/providers/common/cloudinit.py'
37--- juju/providers/common/cloudinit.py 2012-03-29 01:37:57 +0000
38+++ juju/providers/common/cloudinit.py 2012-05-29 15:26:21 +0000
39@@ -11,6 +11,7 @@
40 DISTRO = "distro"
41 PPA = "ppa"
42 BRANCH = "branch"
43+PROPOSED = "proposed"
44
45
46 def _branch_install_scripts(branch):
47@@ -23,8 +24,9 @@
48
49 def _install_scripts(origin, origin_url):
50 scripts = []
51- if origin not in (DISTRO, PPA):
52+ if origin == BRANCH:
53 scripts.extend(_branch_install_scripts(origin_url))
54+
55 scripts.extend([
56 "sudo mkdir -p /var/lib/juju",
57 "sudo mkdir -p /var/log/juju"])
58@@ -69,7 +71,7 @@
59 for line in data.splitlines():
60 stripped = line.lstrip()
61 if stripped:
62- yield (len(line)-len(stripped), stripped)
63+ yield (len(line) - len(stripped), stripped)
64
65
66 def parse_juju_origin(data):
67@@ -109,7 +111,7 @@
68 return PPA, None
69 indent, line = next()
70 if indent != first_indent:
71- break # Going into a different version
72+ break # Going into a different version
73 except StopIteration:
74 pass
75 return DISTRO, None
76@@ -163,7 +165,8 @@
77 self._zookeeper = True
78 self._provision = True
79
80- def set_juju_source(self, branch=None, ppa=False, distro=False):
81+ def set_juju_source(
82+ self, branch=None, ppa=False, distro=False, proposed=False):
83 """Set the version of juju the machine should run.
84
85 :param branch: location from which to check out juju; for example,
86@@ -176,13 +179,16 @@
87 :param bool distro: if True, get the default juju version from the
88 OS distribution.
89
90+ :param bool proposed: if True, get the proposed juju version
91+ from the OS distribution.
92+
93 :raises: :exc:`juju.errors.CloudInitError` if more than one option,
94 or fewer than one options, are specified.
95
96 Note that you don't need to call this method; the juju source
97 defaults to what is returned by `get_default_origin`.
98 """
99- if len(filter(None, (branch, ppa, distro))) != 1:
100+ if len(filter(None, (branch, ppa, distro, proposed))) != 1:
101 raise CloudInitError("Please specify one source")
102 if branch:
103 self._origin = BRANCH
104@@ -193,6 +199,9 @@
105 elif distro:
106 self._origin = DISTRO
107 self._origin_url = None
108+ elif proposed:
109+ self._origin = PROPOSED
110+ self._origin_url = None
111
112 def set_machine_id(self, id):
113 """Specify the juju machine ID.
114@@ -296,11 +305,13 @@
115 if self._zookeeper:
116 packages.extend([
117 "default-jre-headless", "zookeeper", "zookeeperd"])
118- if self._origin in (DISTRO, PPA):
119+ if self._origin in (DISTRO, PPA, PROPOSED):
120 packages.append("juju")
121 return packages
122
123 def _collect_repositories(self):
124+ if self._origin == PROPOSED:
125+ return ["deb $MIRROR $RELEASE-proposed main universe"]
126 if self._origin != DISTRO:
127 return ["ppa:juju/pkgs"]
128 return []
129
130=== modified file 'juju/providers/common/launch.py'
131--- juju/providers/common/launch.py 2012-03-29 01:37:57 +0000
132+++ juju/providers/common/launch.py 2012-05-29 15:26:21 +0000
133@@ -101,6 +101,8 @@
134 cloud_init.set_juju_source(branch=origin)
135 elif origin == "ppa":
136 cloud_init.set_juju_source(ppa=True)
137+ elif origin == "proposed":
138+ cloud_init.set_juju_source(proposed=True)
139 else:
140 # Ignore other values, just use the distro for sanity
141 cloud_init.set_juju_source(distro=True)
142
143=== added file 'juju/providers/common/tests/data/cloud_init_proposed'
144--- juju/providers/common/tests/data/cloud_init_proposed 1970-01-01 00:00:00 +0000
145+++ juju/providers/common/tests/data/cloud_init_proposed 2012-05-29 15:26:21 +0000
146@@ -0,0 +1,37 @@
147+#cloud-config
148+apt-update: true
149+apt-upgrade: true
150+apt_sources:
151+- {source: 'deb $MIRROR $RELEASE-proposed main universe'}
152+machine-data: {juju-provider-type: dummy, juju-zookeeper-hosts: 'cotswold:2181,longleat:2181',
153+ machine-id: passport}
154+output: {all: '| tee -a /var/log/cloud-init-output.log'}
155+packages: [bzr, byobu, tmux, python-setuptools, python-twisted, python-txaws, python-zookeeper, juju]
156+runcmd: [sudo mkdir -p /var/lib/juju, sudo mkdir -p
157+ /var/log/juju, 'cat >> /etc/init/juju-machine-agent.conf <<EOF
158+
159+ description "Juju machine agent"
160+
161+ author "Juju Team <juju@lists.ubuntu.com>"
162+
163+
164+ start on runlevel [2345]
165+
166+ stop on runlevel [!2345]
167+
168+ respawn
169+
170+
171+ env JUJU_MACHINE_ID="passport"
172+
173+ env JUJU_ZOOKEEPER="cotswold:2181,longleat:2181"
174+
175+
176+ exec python -m juju.agents.machine --nodaemon --logfile /var/log/juju/machine-agent.log
177+ --session-file /var/run/juju/machine-agent.zksession >> /tmp/juju-machine-agent.output
178+ 2>&1
179+
180+ EOF
181+
182+ ', /sbin/start juju-machine-agent]
183+ssh_authorized_keys: [chubb]
184
185=== modified file 'juju/providers/common/tests/test_cloudinit.py'
186--- juju/providers/common/tests/test_cloudinit.py 2012-03-29 01:37:57 +0000
187+++ juju/providers/common/tests/test_cloudinit.py 2012-05-29 15:26:21 +0000
188@@ -116,6 +116,11 @@
189 cloud_init.set_juju_source(distro=True)
190 self.assert_render(cloud_init, "cloud_init_distro")
191
192+ def test_render_proposed_source(self):
193+ cloud_init = self.construct_normal()
194+ cloud_init.set_juju_source(proposed=True)
195+ self.assert_render(cloud_init, "cloud_init_proposed")
196+
197 def test_render_branch_source(self):
198 cloud_init = self.construct_normal()
199 cloud_init.set_juju_source(branch="lp:blah/juju/blah-blah")

Subscribers

People subscribed via source and target branches

to status/vote changes: