Merge lp:~bac/lpsetup/host2target into lp:lpsetup
- host2target
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | 76 |
Merged at revision: | 74 |
Proposed branch: | lp:~bac/lpsetup/host2target |
Merge into: | lp:lpsetup |
Diff against target: |
514 lines (+77/-73) 9 files modified
README.rst (+1/-1) commands.rst (+11/-11) lpsetup/cli.py (+4/-4) lpsetup/subcommands/init_target.py (+8/-8) lpsetup/subcommands/initlxc.py (+14/-13) lpsetup/subcommands/install_lxc.py (+5/-6) lpsetup/tests/integration/test_init_target.py (+8/-8) lpsetup/tests/subcommands/test_init_target.py (+24/-20) lpsetup/tests/subcommands/test_smoke.py (+2/-2) |
To merge this branch: | bzr merge lp:~bac/lpsetup/host2target |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Review via email:
|
Commit message
Change 'host' to 'target' everywhere to make it less confusing.
Description of the change
Change 'host' to 'target' everywhere to make it less confusing.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Launchpad QA Bot (lpqabot) wrote : | # |
Attempt to merge into lp:lpsetup failed due to conflicts:
text conflict in lpsetup/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Launchpad QA Bot (lpqabot) wrote : | # |
The attempt to merge lp:~bac/lpsetup/host2target into lp:lpsetup failed. Below is the output from the failed tests.
+ set -o errexit
++ grep -v distribute_setup.py
++ find . -name build -prune -o -name '*.py'
+ pyfiles='./setup.py
./lplxcip/
./lplxcip/
./lplxcip/
./lplxcip/
./lplxcip/
./lplxcip/lxcip.py
./lpsetup/utils.py
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/
./lpsetup/cli.py'
+ pocketlint ./setup.py ./lplxcip/
+ pep8 --exclude=build ./setup.py ./lplxcip/
- 76. By Brad Crittenden
-
Fixed merge problem
Preview Diff
1 | === modified file 'README.rst' |
2 | --- README.rst 2012-07-30 18:56:59 +0000 |
3 | +++ README.rst 2012-08-16 10:07:21 +0000 |
4 | @@ -88,7 +88,7 @@ |
5 | long as you specify using the '-e' command line option. The tests |
6 | are in lpsetup/tests/integration. |
7 | |
8 | -The first, *test_init_host.py*, only tests the *init-host* command but |
9 | +The first, *test_init_target.py*, only tests the *init-target* command but |
10 | goes no further. The second, *test_install_lxc.py*, tests |
11 | *install-lxc*. If this test is run against a local LXC environment, |
12 | some changes need are first required to the host machine where the |
13 | |
14 | === modified file 'commands.rst' |
15 | --- commands.rst 2012-07-19 17:48:40 +0000 |
16 | +++ commands.rst 2012-08-16 10:07:21 +0000 |
17 | @@ -6,7 +6,7 @@ |
18 | |
19 | usage: lp-setup [-h] |
20 | |
21 | - {finish-init-host,init-host,init-lxc,init-repo,install-lxc,update,version,help} |
22 | + {finish-init-target,init-target,init-lxc,init-repo,install-lxc,update,version,help} |
23 | ... |
24 | |
25 | Create and update Launchpad development and testing environments. |
26 | @@ -15,11 +15,11 @@ |
27 | -h, --help show this help message and exit |
28 | |
29 | subcommands: |
30 | - {finish-init-host,init-host,init-lxc,init-repo,install-lxc,update,version,help} |
31 | + {finish-init-target,init-target,init-lxc,init-repo,install-lxc,update,version,help} |
32 | Each subcommand accepts --h or --help to describe it. |
33 | - finish-init-host Finish the initialization of a Launchpad development |
34 | - host. |
35 | - init-host Prepare a machine to run Launchpad. May be an LXC |
36 | + finish-init-target Finish the initialization of a Launchpad development |
37 | + target. |
38 | + init-target Prepare a machine to run Launchpad. May be an LXC |
39 | container or not. |
40 | init-lxc Create an LXC container suitable for later installing |
41 | a Launchpad development environment. |
42 | @@ -69,14 +69,14 @@ |
43 | |
44 | Create an LXC container suitable for later installing a Launchpad |
45 | development environment. The `lpsetup` package is installed in the |
46 | -container and `init-host` is called. The LXC container is shutdown at |
47 | +container and `init-target` is called. The LXC container is shutdown at |
48 | the end of the command. |
49 | |
50 | Run as root on the host machine. |
51 | |
52 | |
53 | -init-host |
54 | -~~~~~~~~~ |
55 | +init-target |
56 | +~~~~~~~~~~~ |
57 | |
58 | Prepare a machine to run Launchpad. It may be a host machine or an |
59 | LXC container. It installs the base packages, creates the specified |
60 | @@ -108,8 +108,8 @@ |
61 | Run as the user in the Launchpad target, either a host machine or LXC |
62 | container. |
63 | |
64 | -finish-init-host |
65 | -~~~~~~~~~~~~~~~~ |
66 | +finish-init-target |
67 | +~~~~~~~~~~~~~~~~~~ |
68 | |
69 | Finish the initialization of a Launchpad development host. |
70 | |
71 | @@ -118,7 +118,7 @@ |
72 | been retrieved and run as root. |
73 | |
74 | Run as root in the Launchpad target, either a host machine or LXC |
75 | -container. Must be done after `init-host` and `init-repo` have |
76 | +container. Must be done after `init-target` and `init-repo` have |
77 | completed. |
78 | |
79 | TODO: rename to finish-init-target |
80 | |
81 | === modified file 'lpsetup/cli.py' |
82 | --- lpsetup/cli.py 2012-08-13 08:42:08 +0000 |
83 | +++ lpsetup/cli.py 2012-08-16 10:07:21 +0000 |
84 | @@ -19,8 +19,8 @@ |
85 | exceptions, |
86 | ) |
87 | from lpsetup.subcommands import ( |
88 | - finish_inithost, |
89 | - inithost, |
90 | + finish_init_target, |
91 | + init_target, |
92 | initlxc, |
93 | initrepo, |
94 | install_lxc, |
95 | @@ -31,8 +31,8 @@ |
96 | |
97 | |
98 | SUBCOMMANDS = [ |
99 | - ('finish-init-host', finish_inithost.SubCommand()), |
100 | - ('init-host', inithost.SubCommand()), |
101 | + ('finish-init-target', finish_init_target.SubCommand()), |
102 | + ('init-target', init_target.SubCommand()), |
103 | ('init-lxc', initlxc.SubCommand()), |
104 | ('init-repo', initrepo.SubCommand()), |
105 | ('install-lxc', install_lxc.SubCommand()), |
106 | |
107 | === renamed file 'lpsetup/subcommands/finish_inithost.py' => 'lpsetup/subcommands/finish_init_target.py' |
108 | === renamed file 'lpsetup/subcommands/inithost.py' => 'lpsetup/subcommands/init_target.py' |
109 | --- lpsetup/subcommands/inithost.py 2012-08-15 17:18:04 +0000 |
110 | +++ lpsetup/subcommands/init_target.py 2012-08-16 10:07:21 +0000 |
111 | @@ -2,7 +2,7 @@ |
112 | # Copyright 2012 Canonical Ltd. This software is licensed under the |
113 | # GNU Affero General Public License version 3 (see the file LICENSE). |
114 | |
115 | -"""inithost subcommand: prepare a host machine to run Launchpad.""" |
116 | +"""init-target subcommand: prepare a target machine to run Launchpad.""" |
117 | |
118 | __metaclass__ = type |
119 | __all__ = [ |
120 | @@ -133,7 +133,7 @@ |
121 | |
122 | |
123 | def initialize_base(user): |
124 | - """Perform base initialization shared by inithost and initlxc.""" |
125 | + """Perform base initialization shared by init-target and init-lxc.""" |
126 | # Install necessary deb packages. This requires Oneiric or later. |
127 | call('apt-get', 'update') |
128 | apt_get_install(*BASE_PACKAGES, caller=call) |
129 | @@ -148,7 +148,7 @@ |
130 | |
131 | |
132 | def initialize(user): |
133 | - """Initialize host machine.""" |
134 | + """Initialize target machine.""" |
135 | make_version_dir() |
136 | initialize_base(user) |
137 | with su(user): |
138 | @@ -159,7 +159,7 @@ |
139 | for module in LP_APACHE_MODULES.split(): |
140 | call('a2enmod', module) |
141 | |
142 | - # The user must be added to sudoers if inithost is run in a container |
143 | + # The user must be added to sudoers if init-target is run in a container |
144 | # and we are running the developer story. |
145 | # XXX 2012-07-18 frankban: add the developer/testing check. |
146 | if running_in_container(): |
147 | @@ -188,11 +188,11 @@ |
148 | |
149 | This is a separate step for several reasons:: |
150 | |
151 | - - It is directly called by *initlxc* as one of its first steps. |
152 | - Note that *initlxc* needs the user's `.ssh` dir to be set up |
153 | + - It is directly called by *init-lxc* as one of its first steps. |
154 | + Note that *init-lxc* needs the user's `.ssh` dir to be set up |
155 | to be able to connect to the container. |
156 | - - *initlxc* should be able to skip this step when re-executing |
157 | - *inithost* from inside the container, to avoid setting up the |
158 | + - *init-lxc* should be able to skip this step when re-executing |
159 | + *init-target* from inside the container, to avoid setting up the |
160 | user home two times. Note: the user home is bind mounted by lxc. |
161 | """ |
162 | with su(user) as env: |
163 | |
164 | === modified file 'lpsetup/subcommands/initlxc.py' |
165 | --- lpsetup/subcommands/initlxc.py 2012-08-14 15:10:12 +0000 |
166 | +++ lpsetup/subcommands/initlxc.py 2012-08-16 10:07:21 +0000 |
167 | @@ -2,7 +2,7 @@ |
168 | # Copyright 2012 Canonical Ltd. This software is licensed under the |
169 | # GNU Affero General Public License version 3 (see the file LICENSE). |
170 | |
171 | -"""initlxc subcommand: prepare an LXC container to run Launchpad. |
172 | +"""init-lxc subcommand: prepare an LXC container to run Launchpad. |
173 | |
174 | Run as root on the host machine to create an LXC container that can later be |
175 | used to install a Launchpad development environment. |
176 | @@ -11,7 +11,7 @@ |
177 | __metaclass__ = type |
178 | __all__ = [ |
179 | 'create_lxc', |
180 | - 'inithost_in_lxc', |
181 | + 'init_target_in_lxc', |
182 | 'initialize', |
183 | 'install_lpsetup_in_lxc', |
184 | 'start_lxc', |
185 | @@ -45,7 +45,7 @@ |
186 | LXC_PACKAGES, |
187 | PY26_PACKAGES, |
188 | ) |
189 | -from lpsetup.subcommands import inithost |
190 | +from lpsetup.subcommands import init_target |
191 | from lpsetup.utils import ( |
192 | call, |
193 | get_container_path, |
194 | @@ -60,13 +60,13 @@ |
195 | |
196 | def initialize(user, install_haveged): |
197 | """Initialize the LXC host.""" |
198 | - inithost.initialize_base(user) |
199 | + init_target.initialize_base(user) |
200 | if install_haveged: |
201 | # haveged is used to fill /dev/random, avoiding |
202 | # entropy exhaustion during automated parallel tests. |
203 | apt_get_install('haveged', caller=call) |
204 | |
205 | -initialize.description = inithost.initialize_base.description + """If \ |
206 | +initialize.description = init_target.initialize_base.description + """If \ |
207 | requested, install haveged in order to fill /dev/random, avoiding \ |
208 | entropy exhaustion during automated parallel tests. |
209 | """ |
210 | @@ -207,16 +207,16 @@ |
211 | install_lpsetup_in_lxc.description = None |
212 | |
213 | |
214 | -def inithost_in_lxc(lxc_name, ssh_key_path, user, email, full_name, lpuser, |
215 | +def init_target_in_lxc(lxc_name, ssh_key_path, user, email, full_name, lpuser, |
216 | ssh_key_name, home_dir): |
217 | """Prepare the Launchpad environment inside an LXC.""" |
218 | # Use ssh to call this script from inside the container. |
219 | - args = ['init-host', '--yes', '-u', user, '-E', email, '-f', full_name, |
220 | + args = ['init-target', '--yes', '-u', user, '-E', email, '-f', full_name, |
221 | '-l', lpuser, '-S', ssh_key_name, '--skip-steps', 'setup_home'] |
222 | cmd = this_command(home_dir, args) |
223 | ssh(lxc_name, cmd, key=ssh_key_path) |
224 | |
225 | -inithost_in_lxc.description = 'Initialize the LXC instance $lxc_name.\n' |
226 | +init_target_in_lxc.description = 'Initialize the LXC instance $lxc_name.\n' |
227 | |
228 | |
229 | def stop_lxc(lxc_name, ssh_key_path): |
230 | @@ -228,7 +228,7 @@ |
231 | stop_lxc.description = 'Stop the LXC instance $lxc_name.\n' |
232 | |
233 | |
234 | -class SubCommand(inithost.SubCommand): |
235 | +class SubCommand(init_target.SubCommand): |
236 | """Create an LXC container suitable for later installing a Launchpad |
237 | development environment. |
238 | """ |
239 | @@ -242,8 +242,8 @@ |
240 | install_lpsetup_in_lxc, |
241 | ['lxc_name', 'ssh_key_path', 'lxc_os', 'user', 'home_dir', |
242 | 'lpsetup_branch']) |
243 | - inithost_in_lxc_step = ( |
244 | - inithost_in_lxc, |
245 | + init_target_in_lxc_step = ( |
246 | + init_target_in_lxc, |
247 | ['lxc_name', 'ssh_key_path', 'user', 'email', 'full_name', 'lpuser', |
248 | 'ssh_key_name', 'home_dir']) |
249 | stop_lxc_step = ( |
250 | @@ -252,13 +252,14 @@ |
251 | |
252 | base_steps = ( |
253 | (initialize, ['user', 'install_haveged']), |
254 | - inithost.SubCommand.setup_home_step, |
255 | + init_target.SubCommand.setup_home_step, |
256 | create_lxc_step, |
257 | start_lxc_step, |
258 | wait_for_lxc_step, |
259 | install_lpsetup_in_lxc_step, |
260 | + init_target_in_lxc_step, |
261 | ) |
262 | - steps = base_steps + (inithost_in_lxc_step, stop_lxc_step) |
263 | + steps = base_steps + (stop_lxc_step, ) |
264 | |
265 | help = __doc__ |
266 | root_required = True |
267 | |
268 | === modified file 'lpsetup/subcommands/install_lxc.py' |
269 | --- lpsetup/subcommands/install_lxc.py 2012-08-15 17:27:24 +0000 |
270 | +++ lpsetup/subcommands/install_lxc.py 2012-08-16 10:07:21 +0000 |
271 | @@ -7,7 +7,7 @@ |
272 | __metaclass__ = type |
273 | __all__ = [ |
274 | 'create_scripts', |
275 | - 'finish_inithost_in_lxc', |
276 | + 'finish_init_target_in_lxc', |
277 | 'init_repo_in_lxc', |
278 | 'SubCommand', |
279 | 'update_in_lxc', |
280 | @@ -127,12 +127,12 @@ |
281 | update.update_tree.description) |
282 | |
283 | |
284 | -def finish_inithost_in_lxc( |
285 | +def finish_init_target_in_lxc( |
286 | lxc_name, ssh_key_path, home_dir, user, target_dir): |
287 | - args = ['finish-init-host', target_dir, '--user', user, '--yes'] |
288 | + args = ['finish-init-target', target_dir, '--user', user, '--yes'] |
289 | cmd_in_lxc(lxc_name, ssh_key_path, home_dir, args) |
290 | |
291 | -finish_inithost_in_lxc.description = """Set up the database, make and \ |
292 | +finish_init_target_in_lxc.description = """Set up the database, make and \ |
293 | install Launchpad inside the LXC instance $lxc_name. |
294 | """ |
295 | |
296 | @@ -145,14 +145,13 @@ |
297 | (create_scripts, ['lxc_name', 'ssh_key_path', 'user'], |
298 | lambda namespace: namespace.create_scripts), |
299 | # Run inside the container: |
300 | - initlxc.SubCommand.inithost_in_lxc_step, |
301 | (init_repo_in_lxc, |
302 | ['lxc_name', 'ssh_key_path', 'home_dir', 'user', 'source', 'use_http', |
303 | 'branch_name', 'checkout_name', 'repository', 'no_checkout']), |
304 | (update_in_lxc, |
305 | ['lxc_name', 'ssh_key_path', 'home_dir', 'user', 'external_path', |
306 | 'target_dir', 'lp_source_deps', 'use_http']), |
307 | - (finish_inithost_in_lxc, |
308 | + (finish_init_target_in_lxc, |
309 | ['lxc_name', 'ssh_key_path', 'home_dir', 'user', 'target_dir']), |
310 | # Run on host: |
311 | initlxc.SubCommand.stop_lxc_step, |
312 | |
313 | === renamed file 'lpsetup/tests/integration/test_init_host.py' => 'lpsetup/tests/integration/test_init_target.py' |
314 | --- lpsetup/tests/integration/test_init_host.py 2012-07-27 08:07:45 +0000 |
315 | +++ lpsetup/tests/integration/test_init_target.py 2012-08-16 10:07:21 +0000 |
316 | @@ -2,7 +2,7 @@ |
317 | # Copyright 2012 Canonical Ltd. This software is licensed under the |
318 | # GNU Affero General Public License version 3 (see the file LICENSE). |
319 | |
320 | -"""A simple, integration test of init-host. |
321 | +"""A simple, integration test of init-target. |
322 | |
323 | Tests initialization of the host without init-lxc in order to demonstrate that |
324 | it can be run in isolation, as part of a non-LXC environment. |
325 | @@ -13,22 +13,22 @@ |
326 | from common import IntegrationTestBase |
327 | |
328 | |
329 | -class InitHostTest(IntegrationTestBase): |
330 | +class InitTargetTest(IntegrationTestBase): |
331 | |
332 | - test_type = 'init-host tests' |
333 | + test_type = 'init-target tests' |
334 | default_juju_env = 'lpsetup-testing-ec2' |
335 | juju_target = 'ubuntu/0' |
336 | |
337 | def do_test(self): |
338 | - """Run an integration test that only address host issues. |
339 | + """Run an integration test that only address target issues. |
340 | |
341 | - Can be run on EC2 or LXC as the host machine. |
342 | + Can be run on EC2 or LXC as the target machine. |
343 | """ |
344 | # Since the most common scenario is to have bzr whoami setup, we do |
345 | # that instead of providing the arguments directly to lpsetup. |
346 | - super(InitHostTest, self).do_test() |
347 | - self.on_remote('cd lpsetup; ./lp-setup init-host --yes') |
348 | + super(InitTargetTest, self).do_test() |
349 | + self.on_remote('cd lpsetup; ./lp-setup init-target --yes') |
350 | |
351 | |
352 | if __name__ == '__main__': |
353 | - sys.exit(InitHostTest().run()) |
354 | + sys.exit(InitTargetTest().run()) |
355 | |
356 | === renamed file 'lpsetup/tests/subcommands/test_inithost.py' => 'lpsetup/tests/subcommands/test_init_target.py' |
357 | --- lpsetup/tests/subcommands/test_inithost.py 2012-08-14 12:07:46 +0000 |
358 | +++ lpsetup/tests/subcommands/test_init_target.py 2012-08-16 10:07:21 +0000 |
359 | @@ -2,7 +2,7 @@ |
360 | # Copyright 2012 Canonical Ltd. This software is licensed under the |
361 | # GNU Affero General Public License version 3 (see the file LICENSE). |
362 | |
363 | -"""Tests for the inithost subcommand.""" |
364 | +"""Tests for the init-target subcommand.""" |
365 | |
366 | import os |
367 | import shutil |
368 | @@ -10,12 +10,12 @@ |
369 | import tempfile |
370 | import unittest |
371 | |
372 | -from lpsetup.subcommands import inithost |
373 | +from lpsetup.subcommands import init_target |
374 | from lpsetup.tests.utils import get_random_string |
375 | |
376 | |
377 | class WriteFileContentsTestCase(unittest.TestCase): |
378 | - """Tests for inithost.write_file_contents().""" |
379 | + """Tests for init_target.write_file_contents().""" |
380 | |
381 | def setUp(self): |
382 | temp_file = tempfile.NamedTemporaryFile() |
383 | @@ -25,11 +25,12 @@ |
384 | self.temp_filename = temp_file.name |
385 | |
386 | def test_write_file_contents_writes_file_contents(self): |
387 | - # inithost.write_file_contents writes the supplied file contents |
388 | + # init_target.write_file_contents writes the supplied file contents |
389 | # to a given file using the mode provided and chmods the file to |
390 | # 0644 for the current user. |
391 | self.addCleanup(os.remove, self.temp_filename) |
392 | - inithost.write_file_contents(self.temp_filename, 'Hello, world!', 'w') |
393 | + init_target.write_file_contents( |
394 | + self.temp_filename, 'Hello, world!', 'w') |
395 | with open(self.temp_filename, 'r') as the_file: |
396 | contents = the_file.read() |
397 | self.assertEqual('Hello, world!', contents) |
398 | @@ -47,29 +48,32 @@ |
399 | # contents differ from `contents`, write_file_contents() raises an |
400 | # Exception. |
401 | self.addCleanup(os.remove, self.temp_filename) |
402 | - inithost.write_file_contents(self.temp_filename, 'Hello, world!', 'w') |
403 | + init_target.write_file_contents( |
404 | + self.temp_filename, 'Hello, world!', 'w') |
405 | self.assertRaises( |
406 | - Exception, inithost.write_file_contents, self.temp_filename, |
407 | + Exception, init_target.write_file_contents, self.temp_filename, |
408 | 'Hello again!', 'w') |
409 | |
410 | def test_write_file_contents_returns_if_file_contents_dont_change(self): |
411 | # If the existing file's contents don't differ from `contents`, |
412 | # write_file_contents() will simply return. |
413 | self.addCleanup(os.remove, self.temp_filename) |
414 | - inithost.write_file_contents(self.temp_filename, 'Hello, world!', 'w') |
415 | + init_target.write_file_contents( |
416 | + self.temp_filename, 'Hello, world!', 'w') |
417 | # This second call shouldn't raise an exception. |
418 | - inithost.write_file_contents(self.temp_filename, 'Hello, world!', 'w') |
419 | + init_target.write_file_contents( |
420 | + self.temp_filename, 'Hello, world!', 'w') |
421 | |
422 | def test_write_file_contents_accepts_modes_a_or_w(self): |
423 | # Passing a `mode` other than "a" or "w" to write_file_contents() |
424 | # will cause an Exception. |
425 | self.assertRaises( |
426 | - AssertionError, inithost.write_file_contents, |
427 | + AssertionError, init_target.write_file_contents, |
428 | '/tmp/foo', 'Hello, world!', 'a+') |
429 | |
430 | |
431 | class SetupSSHTest(unittest.TestCase): |
432 | - """Tests for inithost.setup_ssh().""" |
433 | + """Tests for init_target.setup_ssh().""" |
434 | |
435 | def setUp(self): |
436 | temp_file = tempfile.NamedTemporaryFile() |
437 | @@ -82,14 +86,14 @@ |
438 | |
439 | def test_setup_ssh_generates_keys_if_not_present(self): |
440 | # If SSH keys do not exist, the function will generate some. |
441 | - inithost.setup_ssh(self.ssh_dir, False, self.temp_filename) |
442 | + init_target.setup_ssh(self.ssh_dir, False, self.temp_filename) |
443 | self.assertTrue(os.path.exists(self.temp_filename)) |
444 | self.assertTrue(os.path.exists(self.temp_filename + '.pub')) |
445 | |
446 | def test_setup_ssh_generates_authorized_keys(self): |
447 | # setup_ssh() also generates an authorized_keys file containing |
448 | # the public key. |
449 | - inithost.setup_ssh(self.ssh_dir, False, self.temp_filename) |
450 | + init_target.setup_ssh(self.ssh_dir, False, self.temp_filename) |
451 | authorized_keys = os.path.join(self.ssh_dir, 'authorized_keys') |
452 | self.assertTrue(os.path.exists(authorized_keys)) |
453 | public_key = open(self.temp_filename + '.pub').read() |
454 | @@ -98,7 +102,7 @@ |
455 | def test_setup_ssh_generates_known_hosts(self): |
456 | # setup_ssh() also generates a `known_host` file containing |
457 | # 'bazaar.launchpad.net'. |
458 | - inithost.setup_ssh(self.ssh_dir, False, self.temp_filename) |
459 | + init_target.setup_ssh(self.ssh_dir, False, self.temp_filename) |
460 | known_hosts = os.path.join(self.ssh_dir, 'known_hosts') |
461 | self.assertTrue(os.path.exists(known_hosts)) |
462 | self.assertIn('bazaar.launchpad.net', open(known_hosts).read()) |
463 | @@ -107,7 +111,7 @@ |
464 | # If the ssh_dir passed to setup_ssh() doesn't exist, it |
465 | # will be created. |
466 | shutil.rmtree(self.ssh_dir) |
467 | - inithost.setup_ssh(self.ssh_dir, False, self.temp_filename) |
468 | + init_target.setup_ssh(self.ssh_dir, False, self.temp_filename) |
469 | self.assertTrue(os.path.exists(self.ssh_dir)) |
470 | self.assertTrue(os.path.isdir(self.ssh_dir)) |
471 | |
472 | @@ -123,14 +127,14 @@ |
473 | |
474 | def test_version_dir_creation(self): |
475 | # If the version path does not exist, it is created. |
476 | - inithost.make_version_dir(mkdirs=self.mkdirs) |
477 | - self.assertIn(inithost.get_version_path(), self.directories_made) |
478 | + init_target.make_version_dir(mkdirs=self.mkdirs) |
479 | + self.assertIn(init_target.get_version_path(), self.directories_made) |
480 | |
481 | def test_originals_dir_creation(self): |
482 | # If the version path contains an "originals" directory for backups of |
483 | # files that we modify. |
484 | - inithost.make_version_dir(mkdirs=self.mkdirs) |
485 | - self.assertIn(inithost.get_version_path(), self.directories_made) |
486 | + init_target.make_version_dir(mkdirs=self.mkdirs) |
487 | + self.assertIn(init_target.get_version_path(), self.directories_made) |
488 | |
489 | |
490 | def create(filename, contents=None): |
491 | @@ -156,7 +160,7 @@ |
492 | destination_dir = lambda: self.tempdir |
493 | contents = get_random_string() |
494 | create(source, contents) |
495 | - inithost.make_backup(source, destination_dir) |
496 | + init_target.make_backup(source, destination_dir) |
497 | get_backup_path = destination_dir() + os.path.sep + source |
498 | self.assertTrue(os.path.exists(get_backup_path)) |
499 | self.assertEqual(file(get_backup_path).read(), contents) |
500 | |
501 | === modified file 'lpsetup/tests/subcommands/test_smoke.py' |
502 | --- lpsetup/tests/subcommands/test_smoke.py 2012-08-10 08:34:16 +0000 |
503 | +++ lpsetup/tests/subcommands/test_smoke.py 2012-08-16 10:07:21 +0000 |
504 | @@ -27,8 +27,8 @@ |
505 | # and verify that a non-error exit code is returned. |
506 | required_args = ['-f', 'Example User', '-E', 'email@example.com'] |
507 | name_args_map = { |
508 | - 'finish-init-host': [], |
509 | - 'init-host': required_args, |
510 | + 'finish-init-target': [], |
511 | + 'init-target': required_args, |
512 | 'init-lxc': required_args, |
513 | 'init-repo': [], |
514 | 'install-lxc': required_args, |
Self-review since it is mostly mechanical changes.