Merge lp:~hazmat/pyjuju/local-origin-passthrough into lp:pyjuju
- local-origin-passthrough
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Kapil Thangavelu | ||||
Approved revision: | 417 | ||||
Merged at revision: | 384 | ||||
Proposed branch: | lp:~hazmat/pyjuju/local-origin-passthrough | ||||
Merge into: | lp:pyjuju | ||||
Prerequisite: | lp:~jimbaker/pyjuju/env-origin | ||||
Diff against target: |
389 lines (+96/-31) 12 files modified
juju/environment/config.py (+3/-2) juju/environment/tests/test_config.py (+1/-1) juju/lib/lxc/__init__.py (+9/-3) juju/lib/lxc/data/juju-create (+8/-6) juju/lib/lxc/tests/test_lxc.py (+11/-8) juju/machine/tests/test_unit_deployment.py (+30/-0) juju/machine/unit.py (+18/-6) juju/providers/local/__init__.py (+3/-0) juju/providers/local/agent.py (+10/-3) juju/providers/local/tests/test_agent.py (+1/-0) juju/unit/address.py (+1/-1) juju/unit/tests/test_address.py (+1/-1) |
||||
To merge this branch: | bzr merge lp:~hazmat/pyjuju/local-origin-passthrough | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Benjamin Saller (community) | Approve | ||
Gustavo Niemeyer | Approve | ||
Jim Baker (community) | Needs Information | ||
Review via email: mp+77646@code.launchpad.net |
This proposal supersedes a proposal from 2011-09-30.
Commit message
Description of the change
Local provider should respect juju-origin
Minor fixes to pass juju origin to the machine agent, and to juju-create
to utilize jujuorigin for lp branch names.
Depends on env-origin AND unit-relation-
the latter is probably immaterial.. just happened to be in the pipeline, i can extract if its a problem.
Kapil Thangavelu (hazmat) wrote : | # |
i'm still in progress on functionally testing this and the overall local provider end 2 end. with drawing from the review queue till that's completed.
Kapil Thangavelu (hazmat) wrote : | # |
> The implementation looks good.
>
> However, there were two problems:
>
> 1. I was unable to run this with our wordpress example. None of the service
> units start up. Are there any branches that this work implicitly depends on?
>
works pretty well for me now with juju-origin to a branch, the ppa still seems to hit the protocol version issue (i guess the ppa hasn't updated), i'd be happy to debug with you what's happening on your system. the master-
> 2. Probably related, this error was reported:
>
fixed.
thanks for having a look.
Gustavo Niemeyer (niemeyer) wrote : | # |
LGTM. Just a couple of trivials:
[1]
149 - elif [ $JUJU_ORIGIN = "branch" ]; then
150 - echo "Using juju Branch $JUJU_SOURCE"
151 + elif [[ $JUJU_ORIGIN == lp:* ]]; then
152 + echo "Using juju branch $JUJU_SOURCE"
Hmmm.. What'd be the reason to have $JUJU_SOURCE if $JUJU_ORIGIN
already has the branch?
Also, is there a difference between == and = in this context? They're
both being used with the same purpose in the two different occurrences
of this test.
[2]
177 bash -c "cd /usr/lib/juju/juju && sudo python setup.py develop"
178 + chmod -R a+r /usr/lib/juju
Indentation is slightly off here.
Benjamin Saller (bcsaller) wrote : | # |
[3]
132 - _customize_
133 + _, output = _customize_
134 +
135 + if self.customize_log:
136 + with open(self.
137 + fh.write(output)
Its very possible to write a customize_log location which is in the container but not writeable by the caller. In cases like this opening a temp file and using [sudo mv tmp customize_log] might make sense. Then again I suppose there is a single supported use of this and its already written so I don't feel strongly.
[4]
+ apt-get install --force-yes -y bzr tmux sudo python-
I am reminded reminded that we have a bug around hook execution needing the DEBIAN_
DEBIAN_
APT_OPTIONS="-o Dpkg::Options:
apt-get install $APT_OPTIONS ...
might make sense in this file as well.
[5]
175 + # light weight checkout is significantly faster, no history though
176 + bzr co --lightweight $JUJU_ORIGIN /usr/lib/juju/juju
This strikes me as very much the correct thing to so here.
[6] The private address relation stuff seems like a good idea, but I'll be more pleased when the unit-get stuff you did lands. This branch still can't run the examples as they stand now.
Kapil Thangavelu (hazmat) wrote : | # |
Excerpts from Benjamin Saller's message of Tue Oct 04 20:26:25 UTC 2011:
> Review: Approve
>
> [3]
>
> 132 - _customize_
> 133 + _, output = _customize_
> 134 +
> 135 + if self.customize_log:
> 136 + with open(self.
> 137 + fh.write(output)
>
> Its very possible to write a customize_log location which is in the container but not writeable by the caller. In cases like this opening a temp file and using [sudo mv tmp customize_log] might make sense. Then again I suppose there is a single supported use of this and its already written so I don't feel strongly.
Customize is only invoked once for master template container, not per container
in practice since its not used for clones. To make it easy to discover and find
this file we end up putting it into data-dir/
it in the container would detract from easy discovery. In practice most of the
issues with setting up the local provider where localized to the output from
this script, and keeping it outside the container helps ensure it survives
a destroy-environment if its needed for additional debugging. iotw, i think its
in a good spot for now.
>
> [4]
>
> + apt-get install --force-yes -y bzr tmux sudo python-
>
> I am reminded reminded that we have a bug around hook execution needing the DEBIAN_
>
> DEBIAN_
> APT_OPTIONS="-o Dpkg::Options:
>
> apt-get install $APT_OPTIONS ...
>
> might make sense in this file as well.
>
Sounds good, thanks.
>
>
> [5]
> 175 + # light weight checkout is significantly faster, no history though
> 176 + bzr co --lightweight $JUJU_ORIGIN /usr/lib/juju/juju
>
> This strikes me as very much the correct thing to so here.
>
Indeed, if needed they can be easily bound on a per container basis. I'm a
little concerned that this will end up stale because customize is only invoked
once, but i don't see any other easy options here, and it has a nice side
benefit ensuring consistency across a deploy.
>
> [6] The private address relation stuff seems like a good idea, but I'll be more pleased when the unit-get stuff you did lands. This branch still can't run the examples as they stand now.
Yeah.. but they where already broken for local deploy before the branch.. they
unit-get cli branch should be merged shortly.
thanks for the review.
cheers,
Kapil
- 418. By Kapil Thangavelu
-
merge pipeline, resolve conflict
Kapil Thangavelu (hazmat) wrote : | # |
Excerpts from Gustavo Niemeyer's message of Tue Oct 04 02:08:27 UTC 2011:
> Review: Approve
>
> LGTM. Just a couple of trivials:
>
> [1]
>
> 149 - elif [ $JUJU_ORIGIN = "branch" ]; then
> 150 - echo "Using juju Branch $JUJU_SOURCE"
> 151 + elif [[ $JUJU_ORIGIN == lp:* ]]; then
> 152 + echo "Using juju branch $JUJU_SOURCE"
>
> Hmmm.. What'd be the reason to have $JUJU_SOURCE if $JUJU_ORIGIN
> already has the branch?
Leftover from previous usage, replaced with JUJU_ORIGIN
>
> Also, is there a difference between == and = in this context? They're
> both being used with the same purpose in the two different occurrences
> of this test.
Sounds good, both work, i'll use '=' for consistency.
>
> [2]
>
> 177 bash -c "cd /usr/lib/juju/juju && sudo python setup.py develop"
> 178 + chmod -R a+r /usr/lib/juju
>
> Indentation is slightly off here.
Fixed, thanks
Preview Diff
1 | === modified file 'juju/environment/config.py' |
2 | --- juju/environment/config.py 2011-10-04 19:44:11 +0000 |
3 | +++ juju/environment/config.py 2011-10-04 22:53:25 +0000 |
4 | @@ -55,8 +55,9 @@ |
5 | "storage-url": String(), |
6 | "placement": String(), |
7 | "default-series": String()}, |
8 | - optional=["storage-url", "placement"]), |
9 | - "lxc": KeyDict({"admin-secret": String(), |
10 | + optional=["storage-url", "placement", |
11 | + "default-series"]), |
12 | + "local": KeyDict({"admin-secret": String(), |
13 | "data-dir": String(), |
14 | "placement": Constant("local"), |
15 | "default-series": String()}, |
16 | |
17 | === modified file 'juju/environment/tests/test_config.py' |
18 | --- juju/environment/tests/test_config.py 2011-10-04 19:44:11 +0000 |
19 | +++ juju/environment/tests/test_config.py 2011-10-04 22:53:25 +0000 |
20 | @@ -43,7 +43,7 @@ |
21 | |
22 | environments: |
23 | sample: |
24 | - type: lxc |
25 | + type: local |
26 | admin-secret: sekret |
27 | default-series: oneiric |
28 | """ |
29 | |
30 | === modified file 'juju/lib/lxc/__init__.py' |
31 | --- juju/lib/lxc/__init__.py 2011-09-29 22:04:55 +0000 |
32 | +++ juju/lib/lxc/__init__.py 2011-10-04 22:53:25 +0000 |
33 | @@ -152,7 +152,9 @@ |
34 | origin_source=None, |
35 | network_name="virbr0", |
36 | customize_script=None, |
37 | - debug_log=None, console_log=None): |
38 | + debug_log=None, |
39 | + console_log=None, |
40 | + customize_log=None): |
41 | """Create an LXCContainer |
42 | |
43 | :param container_name: should be unique within the system |
44 | @@ -174,7 +176,7 @@ |
45 | self.container_name = container_name |
46 | self.debug_log = debug_log |
47 | self.console_log = console_log |
48 | - |
49 | + self.customize_log = customize_log |
50 | if customize_script is None: |
51 | customize_script = os.path.join(DATA_PATH, |
52 | "juju-create") |
53 | @@ -240,7 +242,11 @@ |
54 | print >>fp, escape("JUJU_SOURCE", self.source) |
55 | |
56 | _cmd(["sudo", "mv", fn, target]) |
57 | - _customize_container(self.customize_script, self.rootfs) |
58 | + _, output = _customize_container(self.customize_script, self.rootfs) |
59 | + |
60 | + if self.customize_log: |
61 | + with open(self.customize_log, "w") as fh: |
62 | + fh.write(output) |
63 | |
64 | def execute(self, args): |
65 | if not isinstance(args, (list, tuple)): |
66 | |
67 | === modified file 'juju/lib/lxc/data/juju-create' |
68 | --- juju/lib/lxc/data/juju-create 2011-09-30 01:57:00 +0000 |
69 | +++ juju/lib/lxc/data/juju-create 2011-10-04 22:53:25 +0000 |
70 | @@ -69,8 +69,8 @@ |
71 | |
72 | if [ $JUJU_ORIGIN = "ppa" ]; then |
73 | echo "Using juju PPA for container" |
74 | - elif [ $JUJU_ORIGIN = "branch" ]; then |
75 | - echo "Using juju Branch $JUJU_SOURCE" |
76 | + elif [[ $JUJU_ORIGIN == lp:* ]]; then |
77 | + echo "Using juju branch $JUJU_SOURCE" |
78 | elif [ $JUJU_ORIGIN = "distro" ]; then |
79 | echo "Using juju distribution packages" |
80 | else |
81 | @@ -79,7 +79,7 @@ |
82 | fi |
83 | |
84 | echo "Setting up juju in container" |
85 | - apt-get install --force-yes -y bzr tmux sudo python-software-properties |
86 | + apt-get install --force-yes -y bzr tmux sudo python-software-properties python-yaml |
87 | |
88 | if [ $JUJU_ORIGIN = "ppa" ]; then |
89 | # the echo forces an enter to get around the interactive |
90 | @@ -87,11 +87,13 @@ |
91 | echo y | apt-add-repository ppa:juju/pkgs |
92 | apt-get update |
93 | apt-get install --force-yes -y juju python-txzookeeper |
94 | - elif [ $JUJU_ORIGIN = "branch" ]; then |
95 | - apt-get install --force-yes -y python-txzookeeper |
96 | + elif [[ $JUJU_ORIGIN = lp:* ]]; then |
97 | + apt-get install --force-yes -y python-txzookeeper python-setuptools |
98 | mkdir /usr/lib/juju |
99 | - bzr branch $JUJU_SOURCE /usr/lib/juju/juju |
100 | + # light weight checkout is significantly faster, no history though |
101 | + bzr co --lightweight $JUJU_ORIGIN /usr/lib/juju/juju |
102 | bash -c "cd /usr/lib/juju/juju && sudo python setup.py develop" |
103 | + chmod -R a+r /usr/lib/juju |
104 | elif [ $JUJU_ORIGIN = "distro" ]; then |
105 | apt-get install --force-yes -y juju python-txzookeeper |
106 | fi |
107 | |
108 | === modified file 'juju/lib/lxc/tests/test_lxc.py' |
109 | --- juju/lib/lxc/tests/test_lxc.py 2011-09-28 18:04:36 +0000 |
110 | +++ juju/lib/lxc/tests/test_lxc.py 2011-10-04 22:53:25 +0000 |
111 | @@ -76,14 +76,16 @@ |
112 | @inlineCallbacks |
113 | def test_lxc_deferred(self): |
114 | self.addCleanup(self.clean_container, DEFAULT_CONTAINER) |
115 | - yield deferToThread(_lxc_create, DEFAULT_CONTAINER, config_file=self.config) |
116 | + yield deferToThread( |
117 | + _lxc_create, DEFAULT_CONTAINER, config_file=self.config) |
118 | yield deferToThread(_lxc_start, DEFAULT_CONTAINER) |
119 | |
120 | @inlineCallbacks |
121 | def test_lxc_container(self): |
122 | self.addCleanup(self.clean_container, DEFAULT_CONTAINER) |
123 | - |
124 | - c = LXCContainer(DEFAULT_CONTAINER, "dsa...", "ppa") |
125 | + customize_log = self.makeFile() |
126 | + c = LXCContainer( |
127 | + DEFAULT_CONTAINER, "dsa...", "ppa", customize_log=customize_log) |
128 | |
129 | running = yield c.is_running() |
130 | self.assertFalse(running) |
131 | @@ -123,6 +125,9 @@ |
132 | containers = yield get_containers(None) |
133 | self.assertNotIn(DEFAULT_CONTAINER, containers) |
134 | |
135 | + # Verify the customize log file. |
136 | + self.assertTrue(os.path.exists(customize_log)) |
137 | + |
138 | # and its gone |
139 | output = _lxc_ls() |
140 | self.assertNotIn(DEFAULT_CONTAINER, output) |
141 | @@ -240,7 +245,9 @@ |
142 | # we'd have to run customize_constainer again which removes |
143 | # some of the point of the clone support to repair this. |
144 | # droppping assertion for now and replacing with a lax one |
145 | - #XXX::: self.assertIn("127.0.0.1 %s localhost" % c.container_name, sudo_get("etc/hosts")) |
146 | + #XXX::: self.assertIn("127.0.0.1 %s localhost" % c.container_name, |
147 | + #XXX sudo_get("etc/hosts")) |
148 | + |
149 | self.assertIn(c.container_name, sudo_get("etc/hosts")) |
150 | |
151 | # nameserver |
152 | @@ -263,7 +270,3 @@ |
153 | self.assertEqual(1, run(["dpkg-query", "-s", "juju"])) |
154 | # but the branch is checked out |
155 | self.asssertTrue(os.path.exists(p("usr/lib/juju/juju"))) |
156 | - |
157 | - |
158 | - |
159 | - |
160 | |
161 | === modified file 'juju/machine/tests/test_unit_deployment.py' |
162 | --- juju/machine/tests/test_unit_deployment.py 2011-09-29 22:04:55 +0000 |
163 | +++ juju/machine/tests/test_unit_deployment.py 2011-10-04 22:53:25 +0000 |
164 | @@ -386,6 +386,30 @@ |
165 | self.assertIn("Destroyed container for riak/0", output) |
166 | |
167 | @inlineCallbacks |
168 | + def test_origin_usage(self): |
169 | + """The machine agent is started with a origin environment variable |
170 | + """ |
171 | + mock_container = self.mocker.patch(LXCContainer) |
172 | + mock_container.is_constructed() |
173 | + self.mocker.result(True) |
174 | + mock_container.is_constructed() |
175 | + self.mocker.result(True) |
176 | + self.mocker.replay() |
177 | + |
178 | + environ = dict(os.environ) |
179 | + environ["JUJU_ORIGIN"] = "lp:~juju/foobar" |
180 | + |
181 | + self.change_environment(**environ) |
182 | + unit_deploy = UnitContainerDeployment( |
183 | + self.unit_name, self.juju_home) |
184 | + container = yield unit_deploy._get_master_template( |
185 | + "local", "127.0.0.1:1", "abc") |
186 | + self.assertEqual(container.origin, "lp:~juju/foobar") |
187 | + self.assertEqual( |
188 | + container.customize_log, |
189 | + os.path.join(self.juju_home, "units", "master-customize.log")) |
190 | + |
191 | + @inlineCallbacks |
192 | def test_start(self): |
193 | container = LXCContainer(self.unit_name, None, None, None) |
194 | rootfs = self.makeDir() |
195 | @@ -429,6 +453,12 @@ |
196 | self.unit_deploy.directory, "var", "lib", "juju", "units", |
197 | self.unit_deploy.unit_path_name, "charm", "metadata.yaml"))) |
198 | |
199 | + # Verify the directory structure in the unit. |
200 | + self.assertTrue(os.path.exists(os.path.join( |
201 | + self.unit_deploy.directory, "var", "lib", "juju", "state"))) |
202 | + self.assertTrue(os.path.exists(os.path.join( |
203 | + self.unit_deploy.directory, "var", "log", "juju"))) |
204 | + |
205 | # Verify log output |
206 | output = self.output.getvalue() |
207 | self.assertIn("Charm extracted into container", output) |
208 | |
209 | === modified file 'juju/machine/unit.py' |
210 | --- juju/machine/unit.py 2011-09-30 03:20:11 +0000 |
211 | +++ juju/machine/unit.py 2011-10-04 22:53:25 +0000 |
212 | @@ -188,6 +188,7 @@ |
213 | super(UnitContainerDeployment, self).__init__(unit_name, juju_home) |
214 | |
215 | self._unit_namespace = os.environ.get("JUJU_UNIT_NS") |
216 | + self._juju_origin = os.environ.get("JUJU_ORIGIN") |
217 | assert self._unit_namespace is not None, "Required unit ns not found" |
218 | |
219 | self.pid_file = None |
220 | @@ -248,7 +249,13 @@ |
221 | self._unit_namespace, machine_id) |
222 | |
223 | master_template = LXCContainer( |
224 | - container_template_name, origin="ppa", public_key=public_key) |
225 | + container_template_name, origin=self._juju_origin, |
226 | + public_key=public_key) |
227 | + |
228 | + # Debug log for the customize script, customize is only run on master. |
229 | + customize_log_path = os.path.join( |
230 | + self.juju_home, "units", "master-customize.log") |
231 | + master_template.customize_log = customize_log_path |
232 | |
233 | if not master_template.is_constructed(): |
234 | log.debug("Creating master container...") |
235 | @@ -286,7 +293,7 @@ |
236 | # Build a template container that can be cloned in deploy |
237 | # we leave the loosely initialized self.container in place for |
238 | # the class as thats all we need for methods other than start. |
239 | - container, directory = yield self._get_container(machine_id, |
240 | + self.container, self.directory = yield self._get_container(machine_id, |
241 | zookeeper_hosts, |
242 | bundle, |
243 | public_key) |
244 | @@ -295,14 +302,14 @@ |
245 | |
246 | # Extract the charm bundle |
247 | charm_path = os.path.join( |
248 | - directory, "var", "lib", "juju", "units", |
249 | + self.directory, "var", "lib", "juju", "units", |
250 | self.unit_path_name, "charm") |
251 | bundle.extract_to(charm_path) |
252 | log.debug("Charm extracted into container") |
253 | |
254 | # Write upstart file for the agent into the container |
255 | upstart_path = os.path.join( |
256 | - directory, "etc", "init", |
257 | + self.directory, "etc", "init", |
258 | "%s-unit-agent.conf" % self.unit_path_name) |
259 | with open(upstart_path, "w") as fh: |
260 | fh.write(self.get_upstart_unit_job(machine_id, zookeeper_hosts)) |
261 | @@ -312,12 +319,17 @@ |
262 | self.juju_home, "units", self.unit_path_name, "unit.log") |
263 | if not os.path.lexists(unit_log_path_host): |
264 | os.symlink( |
265 | - os.path.join(directory, "var", "log", "juju", |
266 | + os.path.join(self.directory, "var", "log", "juju", |
267 | "unit-%s.log" % self.unit_path_name), |
268 | unit_log_path_host) |
269 | |
270 | + # Debug log for the container |
271 | + container_log_path = os.path.join( |
272 | + self.juju_home, "units", self.unit_path_name, "container.log") |
273 | + self.container.debug_log = container_log_path |
274 | + |
275 | log.debug("Starting container...") |
276 | - yield container.run() |
277 | + yield self.container.run() |
278 | log.info("Started container for %s" % self.unit_name) |
279 | |
280 | @inlineCallbacks |
281 | |
282 | === modified file 'juju/providers/local/__init__.py' |
283 | --- juju/providers/local/__init__.py 2011-09-30 03:20:11 +0000 |
284 | +++ juju/providers/local/__init__.py 2011-10-04 22:53:25 +0000 |
285 | @@ -125,11 +125,14 @@ |
286 | log.info("Starting machine agent...") |
287 | pid_file = os.path.join(self._directory, "machine-agent.pid") |
288 | log_file = os.path.join(self._directory, "machine-agent.log") |
289 | + |
290 | + juju_origin = self.config.get("juju-origin") |
291 | agent = ManagedMachineAgent(pid_file, |
292 | zookeeper_hosts=zookeeper.address, |
293 | machine_id="0", |
294 | juju_directory=self._directory, |
295 | log_file=log_file, |
296 | + juju_origin=juju_origin, |
297 | juju_unit_namespace=self._qualified_name, |
298 | public_key=public_key) |
299 | yield agent.start() |
300 | |
301 | === modified file 'juju/providers/local/agent.py' |
302 | --- juju/providers/local/agent.py 2011-09-27 16:51:50 +0000 |
303 | +++ juju/providers/local/agent.py 2011-10-04 22:53:25 +0000 |
304 | @@ -7,6 +7,8 @@ |
305 | from twisted.internet.defer import inlineCallbacks, returnValue |
306 | from twisted.internet.threads import deferToThread |
307 | |
308 | +from juju.providers.common.cloudinit import get_default_origin |
309 | + |
310 | |
311 | class ManagedMachineAgent(object): |
312 | |
313 | @@ -15,8 +17,7 @@ |
314 | def __init__( |
315 | self, pid_file, zookeeper_hosts=None, machine_id="0", |
316 | log_file=None, juju_directory="/var/lib/juju", |
317 | - juju_unit_namespace="", |
318 | - public_key=None): |
319 | + juju_unit_namespace="", public_key=None, juju_origin="ppa"): |
320 | """ |
321 | :param pid_file: Path to file used to store process id. |
322 | :param machine_id: machine id for the local machine. |
323 | @@ -37,6 +38,10 @@ |
324 | self._juju_unit_namespace = juju_unit_namespace |
325 | self._log_file = log_file |
326 | self._public_key = public_key |
327 | + self._juju_origin = juju_origin |
328 | + |
329 | + if self._juju_origin is None: |
330 | + self._juju_origin = get_default_origin() |
331 | |
332 | @inlineCallbacks |
333 | def start(self): |
334 | @@ -51,6 +56,7 @@ |
335 | # to the command. |
336 | args = ["sudo", |
337 | "JUJU_ZOOKEEPER=%s" % self._zookeeper_hosts, |
338 | + "JUJU_ORIGIN=%s" % self._juju_origin, |
339 | "JUJU_MACHINE_ID=%s" % self._machine_id, |
340 | "JUJU_HOME=%s" % self._juju_directory, |
341 | "JUJU_UNIT_NS=%s" % self._juju_unit_namespace, |
342 | @@ -60,7 +66,8 @@ |
343 | "--logfile", self._log_file] |
344 | |
345 | if self._public_key: |
346 | - args.insert(1, "JUJU_PUBLIC_KEY=%s" % pipes.quote(self._public_key)) |
347 | + args.insert( |
348 | + 1, "JUJU_PUBLIC_KEY=%s" % pipes.quote(self._public_key)) |
349 | |
350 | yield deferToThread(subprocess.check_call, args) |
351 | |
352 | |
353 | === modified file 'juju/providers/local/tests/test_agent.py' |
354 | --- juju/providers/local/tests/test_agent.py 2011-09-27 16:51:50 +0000 |
355 | +++ juju/providers/local/tests/test_agent.py 2011-10-04 22:53:25 +0000 |
356 | @@ -47,6 +47,7 @@ |
357 | dict(JUJU_ZOOKEEPER=get_test_zookeeper_address(), |
358 | JUJU_MACHINE_ID="0", |
359 | JUJU_HOME=juju_directory, |
360 | + JUJU_ORIGIN="ppa", |
361 | JUJU_UNIT_NS="ns1")) |
362 | |
363 | @inlineCallbacks |
364 | |
365 | === modified file 'juju/unit/address.py' |
366 | --- juju/unit/address.py 2011-09-25 06:47:08 +0000 |
367 | +++ juju/unit/address.py 2011-10-04 22:53:25 +0000 |
368 | @@ -16,7 +16,7 @@ |
369 | provider_type = yield settings.get_provider_type() |
370 | if provider_type == "ec2": |
371 | returnValue(EC2UnitAddress()) |
372 | - elif provider_type == "lxc": |
373 | + elif provider_type == "local": |
374 | returnValue(LocalUnitAddress()) |
375 | elif provider_type == "orchestra": |
376 | returnValue(OrchestraUnitAddress()) |
377 | |
378 | === modified file 'juju/unit/tests/test_address.py' |
379 | --- juju/unit/tests/test_address.py 2011-09-26 17:11:52 +0000 |
380 | +++ juju/unit/tests/test_address.py 2011-10-04 22:53:25 +0000 |
381 | @@ -33,7 +33,7 @@ |
382 | |
383 | @inlineCallbacks |
384 | def test_get_local_address(self): |
385 | - address = yield self.get_address_for("lxc") |
386 | + address = yield self.get_address_for("local") |
387 | self.assertTrue(isinstance(address, LocalUnitAddress)) |
388 | |
389 | @inlineCallbacks |
The implementation looks good.
However, there were two problems:
1. I was unable to run this with our wordpress example. None of the service units start up. Are there any branches that this work implicitly depends on?
2. Probably related, this error was reported:
[ERROR] python2. 7/dist- packages/ twisted/ internet/ defer.py" , line 1020, in _inlineCallbacks jbaker/ canonical/ juju/hazmat/ local-origin- passthrough/ juju/machine/ tests/test_ unit_deployment .py", line 405, in test_origin_usage log=customize_ log) TypeError: __init__() got an unexpected keyword argument 'customize_log'
Traceback (most recent call last):
File "/usr/lib/
result = g.send(result)
File "/home/
self.unit_name, self.juju_home, customize_
exceptions.
juju.machine. tests.test_ unit_deployment .UnitContainerD eploymentTest. test_origin_ usage