Merge lp:~bac/lpsetup/initrepo into lp:lpsetup
- initrepo
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | 44 |
Merged at revision: | 43 |
Proposed branch: | lp:~bac/lpsetup/initrepo |
Merge into: | lp:lpsetup |
Diff against target: |
462 lines (+86/-61) 13 files modified
lpsetup/cli.py (+2/-2) lpsetup/handlers.py (+16/-3) lpsetup/subcommands/inithost.py (+2/-2) lpsetup/subcommands/initrepo.py (+33/-2) lpsetup/subcommands/install.py (+11/-33) lpsetup/subcommands/lxcinstall.py (+2/-4) lpsetup/tests/subcommands/test_inithost.py (+1/-1) lpsetup/tests/subcommands/test_initlxc.py (+1/-1) lpsetup/tests/subcommands/test_initrepo.py (+10/-6) lpsetup/tests/subcommands/test_install.py (+2/-2) lpsetup/tests/subcommands/test_lxcinstall.py (+1/-3) lpsetup/tests/test_handlers.py (+2/-2) pre-commit.sh (+3/-0) |
To merge this branch: | bzr merge lp:~bac/lpsetup/initrepo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Poster (community) | Approve | ||
Review via email: mp+113625@code.launchpad.net |
Commit message
Rename the 'get' subcommand to 'initrepo' as it is more descriptive. Move setup_bzr_locations to init_repo. Create handle_
Description of the change
* Rename the 'get' subcommand to 'initrepo' as it is more descriptive.
* Move setup_bzr_locations to init_repo.
* Create handle_
Gary Poster (gary) : | # |
Launchpad QA Bot (lpqabot) wrote : | # |
Launchpad QA Bot (lpqabot) wrote : | # |
The attempt to merge lp:~bac/lpsetup/initrepo into lp:lpsetup failed. Below is the output from the failed tests.
/bin/sh: 1: pre-commit.sh: not found
Launchpad QA Bot (lpqabot) wrote : | # |
The attempt to merge lp:~bac/lpsetup/initrepo into lp:lpsetup failed. Below is the output from the failed tests.
/bin/sh: 1: pre-commit.sh: not found
Launchpad QA Bot (lpqabot) wrote : | # |
The attempt to merge lp:~bac/lpsetup/initrepo into lp:lpsetup failed. Below is the output from the failed tests.
/bin/sh: 1: pre-commit.sh: not found
Preview Diff
1 | === modified file 'lpsetup/cli.py' | |||
2 | --- lpsetup/cli.py 2012-07-02 20:43:36 +0000 | |||
3 | +++ lpsetup/cli.py 2012-07-06 11:32:19 +0000 | |||
4 | @@ -16,9 +16,9 @@ | |||
5 | 16 | exceptions, | 16 | exceptions, |
6 | 17 | ) | 17 | ) |
7 | 18 | from lpsetup.subcommands import ( | 18 | from lpsetup.subcommands import ( |
8 | 19 | get, | ||
9 | 20 | inithost, | 19 | inithost, |
10 | 21 | initlxc, | 20 | initlxc, |
11 | 21 | initrepo, | ||
12 | 22 | install, | 22 | install, |
13 | 23 | lxcinstall, | 23 | lxcinstall, |
14 | 24 | version, | 24 | version, |
15 | @@ -29,7 +29,7 @@ | |||
16 | 29 | ('install', install.SubCommand), | 29 | ('install', install.SubCommand), |
17 | 30 | ('inithost', inithost.SubCommand), | 30 | ('inithost', inithost.SubCommand), |
18 | 31 | ('initlxc', initlxc.SubCommand), | 31 | ('initlxc', initlxc.SubCommand), |
20 | 32 | ('get', get.SubCommand), | 32 | ('initrepo', initrepo.SubCommand), |
21 | 33 | ('lxc-install', lxcinstall.SubCommand), | 33 | ('lxc-install', lxcinstall.SubCommand), |
22 | 34 | ('version', version.SubCommand), | 34 | ('version', version.SubCommand), |
23 | 35 | ] | 35 | ] |
24 | 36 | 36 | ||
25 | === modified file 'lpsetup/handlers.py' | |||
26 | --- lpsetup/handlers.py 2012-07-02 20:43:36 +0000 | |||
27 | +++ lpsetup/handlers.py 2012-07-06 11:32:19 +0000 | |||
28 | @@ -7,7 +7,8 @@ | |||
29 | 7 | __metaclass__ = type | 7 | __metaclass__ = type |
30 | 8 | __all__ = [ | 8 | __all__ = [ |
31 | 9 | 'handle_directories', | 9 | 'handle_directories', |
33 | 10 | 'handle_lpuser', | 10 | 'handle_lpuser_as_username', |
34 | 11 | 'handle_lpuser_from_lplogin', | ||
35 | 11 | 'handle_ssh_keys', | 12 | 'handle_ssh_keys', |
36 | 12 | 'handle_testing', | 13 | 'handle_testing', |
37 | 13 | 'handle_user', | 14 | 'handle_user', |
38 | @@ -16,10 +17,12 @@ | |||
39 | 16 | 17 | ||
40 | 17 | import os | 18 | import os |
41 | 18 | import pwd | 19 | import pwd |
42 | 20 | import subprocess | ||
43 | 19 | 21 | ||
44 | 20 | from shelltoolbox import ( | 22 | from shelltoolbox import ( |
45 | 21 | bzr_whois, | 23 | bzr_whois, |
46 | 22 | get_user_home, | 24 | get_user_home, |
47 | 25 | run, | ||
48 | 23 | user_exists, | 26 | user_exists, |
49 | 24 | ) | 27 | ) |
50 | 25 | 28 | ||
51 | @@ -60,7 +63,7 @@ | |||
52 | 60 | namespace.home_dir = get_user_home(namespace.user) | 63 | namespace.home_dir = get_user_home(namespace.user) |
53 | 61 | 64 | ||
54 | 62 | 65 | ||
56 | 63 | def handle_lpuser(namespace): | 66 | def handle_lpuser_as_username(namespace): |
57 | 64 | """Handle lpuser argument. | 67 | """Handle lpuser argument. |
58 | 65 | 68 | ||
59 | 66 | If lpuser is not provided by namespace, the user name is used:: | 69 | If lpuser is not provided by namespace, the user name is used:: |
60 | @@ -70,7 +73,7 @@ | |||
61 | 70 | 73 | ||
62 | 71 | >>> import argparse | 74 | >>> import argparse |
63 | 72 | >>> namespace = argparse.Namespace(user=username, lpuser=None) | 75 | >>> namespace = argparse.Namespace(user=username, lpuser=None) |
65 | 73 | >>> handle_lpuser(namespace) | 76 | >>> handle_lpuser_as_username(namespace) |
66 | 74 | >>> namespace.lpuser == username | 77 | >>> namespace.lpuser == username |
67 | 75 | True | 78 | True |
68 | 76 | """ | 79 | """ |
69 | @@ -78,6 +81,16 @@ | |||
70 | 78 | namespace.lpuser = namespace.user | 81 | namespace.lpuser = namespace.user |
71 | 79 | 82 | ||
72 | 80 | 83 | ||
73 | 84 | def handle_lpuser_from_lplogin(namespace): | ||
74 | 85 | """Handle lpuser argument. | ||
75 | 86 | """ | ||
76 | 87 | if getattr(namespace, 'lpuser', None) is None: | ||
77 | 88 | try: | ||
78 | 89 | namespace.lpuser = run('bzr', 'launchpad-login').strip() | ||
79 | 90 | except subprocess.CalledProcessError: | ||
80 | 91 | raise ValidationError("No bzr launchpad-login set.") | ||
81 | 92 | |||
82 | 93 | |||
83 | 81 | def handle_userdata(namespace, whois=bzr_whois): | 94 | def handle_userdata(namespace, whois=bzr_whois): |
84 | 82 | """Handle full_name and email arguments. | 95 | """Handle full_name and email arguments. |
85 | 83 | 96 | ||
86 | 84 | 97 | ||
87 | === modified file 'lpsetup/subcommands/inithost.py' | |||
88 | --- lpsetup/subcommands/inithost.py 2012-07-03 18:18:24 +0000 | |||
89 | +++ lpsetup/subcommands/inithost.py 2012-07-06 11:32:19 +0000 | |||
90 | @@ -26,7 +26,7 @@ | |||
91 | 26 | 26 | ||
92 | 27 | from lpsetup import argparser | 27 | from lpsetup import argparser |
93 | 28 | from lpsetup.handlers import ( | 28 | from lpsetup.handlers import ( |
95 | 29 | handle_lpuser, | 29 | handle_lpuser_as_username, |
96 | 30 | handle_ssh_keys, | 30 | handle_ssh_keys, |
97 | 31 | handle_user, | 31 | handle_user, |
98 | 32 | handle_userdata, | 32 | handle_userdata, |
99 | @@ -166,7 +166,7 @@ | |||
100 | 166 | needs_root = True | 166 | needs_root = True |
101 | 167 | handlers = ( | 167 | handlers = ( |
102 | 168 | handle_user, | 168 | handle_user, |
104 | 169 | handle_lpuser, | 169 | handle_lpuser_as_username, |
105 | 170 | handle_userdata, | 170 | handle_userdata, |
106 | 171 | handle_ssh_keys, | 171 | handle_ssh_keys, |
107 | 172 | ) | 172 | ) |
108 | 173 | 173 | ||
109 | === renamed file 'lpsetup/subcommands/get.py' => 'lpsetup/subcommands/initrepo.py' | |||
110 | --- lpsetup/subcommands/get.py 2012-07-03 20:05:47 +0000 | |||
111 | +++ lpsetup/subcommands/initrepo.py 2012-07-06 11:32:19 +0000 | |||
112 | @@ -2,7 +2,7 @@ | |||
113 | 2 | # Copyright 2012 Canonical Ltd. This software is licensed under the | 2 | # Copyright 2012 Canonical Ltd. This software is licensed under the |
114 | 3 | # GNU Affero General Public License version 3 (see the file LICENSE). | 3 | # GNU Affero General Public License version 3 (see the file LICENSE). |
115 | 4 | 4 | ||
117 | 5 | """get subcommand: prepare source code destinations and download it.""" | 5 | """initrepo subcommand: prepare source code destinations and download it.""" |
118 | 6 | 6 | ||
119 | 7 | __metaclass__ = type | 7 | __metaclass__ = type |
120 | 8 | __all__ = [ | 8 | __all__ = [ |
121 | @@ -18,10 +18,15 @@ | |||
122 | 18 | from lpsetup.settings import ( | 18 | from lpsetup.settings import ( |
123 | 19 | CHECKOUT_DIR, | 19 | CHECKOUT_DIR, |
124 | 20 | LP_BRANCH_NAME, | 20 | LP_BRANCH_NAME, |
125 | 21 | LP_BZR_LOCATIONS, | ||
126 | 21 | LP_CHECKOUT_NAME, | 22 | LP_CHECKOUT_NAME, |
127 | 22 | LP_SSH_REPO, | 23 | LP_SSH_REPO, |
128 | 23 | ) | 24 | ) |
130 | 24 | from lpsetup.utils import call | 25 | from lpsetup.utils import ( |
131 | 26 | call, | ||
132 | 27 | ConfigParser, | ||
133 | 28 | get_file_header, | ||
134 | 29 | ) | ||
135 | 25 | 30 | ||
136 | 26 | 31 | ||
137 | 27 | def fetch(source, repository, branch_name, checkout_name): | 32 | def fetch(source, repository, branch_name, checkout_name): |
138 | @@ -37,16 +42,42 @@ | |||
139 | 37 | call('bzr', 'co', '--lightweight', branch_dir, checkout_dir) | 42 | call('bzr', 'co', '--lightweight', branch_dir, checkout_dir) |
140 | 38 | 43 | ||
141 | 39 | 44 | ||
142 | 45 | def setup_bzr_locations(lpuser, repository, template=LP_BZR_LOCATIONS): | ||
143 | 46 | """Set up bazaar locations.""" | ||
144 | 47 | context = { | ||
145 | 48 | 'checkout_dir': os.path.join(repository, LP_BRANCH_NAME), | ||
146 | 49 | 'repository': repository, | ||
147 | 50 | 'lpuser': lpuser, | ||
148 | 51 | } | ||
149 | 52 | |||
150 | 53 | bazaar_dir = os.path.expanduser('~/.bazaar') | ||
151 | 54 | mkdirs(bazaar_dir) | ||
152 | 55 | path = os.path.join(bazaar_dir, 'locations.conf') | ||
153 | 56 | parser = ConfigParser() | ||
154 | 57 | parser.read(path) | ||
155 | 58 | for section_template, options in template.items(): | ||
156 | 59 | section = section_template.format(**context) | ||
157 | 60 | if not parser.has_section(section): | ||
158 | 61 | parser.add_section(section) | ||
159 | 62 | for option, value in options.items(): | ||
160 | 63 | parser.set(section, option, value.format(**context)) | ||
161 | 64 | with open(path, 'w') as f: | ||
162 | 65 | f.write(get_file_header() + '\n') | ||
163 | 66 | parser.write(f) | ||
164 | 67 | |||
165 | 68 | |||
166 | 40 | class SubCommand(argparser.StepsBasedSubCommand): | 69 | class SubCommand(argparser.StepsBasedSubCommand): |
167 | 41 | """Get the Launchpad source""" | 70 | """Get the Launchpad source""" |
168 | 42 | 71 | ||
169 | 43 | steps = ( | 72 | steps = ( |
170 | 44 | (fetch, 'source', 'repository', 'branch_name', 'checkout_name'), | 73 | (fetch, 'source', 'repository', 'branch_name', 'checkout_name'), |
171 | 74 | (setup_bzr_locations, 'lpuser', 'repository'), | ||
172 | 45 | ) | 75 | ) |
173 | 46 | 76 | ||
174 | 47 | help = __doc__ | 77 | help = __doc__ |
175 | 48 | handlers = ( | 78 | handlers = ( |
176 | 49 | handlers.handle_user, | 79 | handlers.handle_user, |
177 | 80 | handlers.handle_lpuser_from_lplogin, | ||
178 | 50 | handlers.handle_directories, | 81 | handlers.handle_directories, |
179 | 51 | handlers.handle_source, | 82 | handlers.handle_source, |
180 | 52 | ) | 83 | ) |
181 | 53 | 84 | ||
182 | === modified file 'lpsetup/subcommands/install.py' | |||
183 | --- lpsetup/subcommands/install.py 2012-07-03 20:05:47 +0000 | |||
184 | +++ lpsetup/subcommands/install.py 2012-07-06 11:32:19 +0000 | |||
185 | @@ -6,7 +6,7 @@ | |||
186 | 6 | 6 | ||
187 | 7 | __metaclass__ = type | 7 | __metaclass__ = type |
188 | 8 | __all__ = [ | 8 | __all__ = [ |
190 | 9 | 'setup_bzr_locations', | 9 | 'setup_bzr_locations_as_root', |
191 | 10 | 'setup_launchpad', | 10 | 'setup_launchpad', |
192 | 11 | 'SubCommand', | 11 | 'SubCommand', |
193 | 12 | ] | 12 | ] |
194 | @@ -24,7 +24,10 @@ | |||
195 | 24 | ) | 24 | ) |
196 | 25 | 25 | ||
197 | 26 | from lpsetup.handlers import handle_directories | 26 | from lpsetup.handlers import handle_directories |
199 | 27 | from lpsetup.subcommands import inithost | 27 | from lpsetup.subcommands import ( |
200 | 28 | inithost, | ||
201 | 29 | initrepo, | ||
202 | 30 | ) | ||
203 | 28 | from lpsetup.settings import ( | 31 | from lpsetup.settings import ( |
204 | 29 | CHECKOUT_DIR, | 32 | CHECKOUT_DIR, |
205 | 30 | DEPENDENCIES_DIR, | 33 | DEPENDENCIES_DIR, |
206 | @@ -32,14 +35,9 @@ | |||
207 | 32 | HOSTS_FILE, | 35 | HOSTS_FILE, |
208 | 33 | LP_APACHE_MODULES, | 36 | LP_APACHE_MODULES, |
209 | 34 | LP_APACHE_ROOTS, | 37 | LP_APACHE_ROOTS, |
210 | 35 | LP_BZR_LOCATIONS, | ||
211 | 36 | LP_BRANCH_NAME, | 38 | LP_BRANCH_NAME, |
212 | 37 | ) | 39 | ) |
218 | 38 | from lpsetup.utils import ( | 40 | from lpsetup.utils import call |
214 | 39 | call, | ||
215 | 40 | ConfigParser, | ||
216 | 41 | get_file_header, | ||
217 | 42 | ) | ||
219 | 43 | 41 | ||
220 | 44 | 42 | ||
221 | 45 | def make_launchpad(user, checkout_dir, install=False): | 43 | def make_launchpad(user, checkout_dir, install=False): |
222 | @@ -99,36 +97,15 @@ | |||
223 | 99 | file_append(HOSTS_FILE, line) | 97 | file_append(HOSTS_FILE, line) |
224 | 100 | 98 | ||
225 | 101 | 99 | ||
248 | 102 | def setup_bzr_locations(user, lpuser, repository, template=LP_BZR_LOCATIONS): | 100 | def setup_bzr_locations_as_root(user, lpuser, repository): |
249 | 103 | """Set up bazaar locations.""" | 101 | with su(user): |
250 | 104 | context = { | 102 | initrepo.setup_bzr_locations(lpuser, repository) |
229 | 105 | 'checkout_dir': os.path.join(repository, LP_BRANCH_NAME), | ||
230 | 106 | 'repository': repository, | ||
231 | 107 | 'lpuser': lpuser, | ||
232 | 108 | } | ||
233 | 109 | with su(user) as env: | ||
234 | 110 | bazaar_dir = os.path.join(env.home, '.bazaar') | ||
235 | 111 | mkdirs(bazaar_dir) | ||
236 | 112 | path = os.path.join(bazaar_dir, 'locations.conf') | ||
237 | 113 | parser = ConfigParser() | ||
238 | 114 | parser.read(path) | ||
239 | 115 | for section_template, options in template.items(): | ||
240 | 116 | section = section_template.format(**context) | ||
241 | 117 | if not parser.has_section(section): | ||
242 | 118 | parser.add_section(section) | ||
243 | 119 | for option, value in options.items(): | ||
244 | 120 | parser.set(section, option, value.format(**context)) | ||
245 | 121 | with open(path, 'w') as f: | ||
246 | 122 | f.write(get_file_header() + '\n') | ||
247 | 123 | parser.write(f) | ||
251 | 124 | 103 | ||
252 | 125 | 104 | ||
253 | 126 | class SubCommand(inithost.SubCommand): | 105 | class SubCommand(inithost.SubCommand): |
254 | 127 | """Install the Launchpad environment.""" | 106 | """Install the Launchpad environment.""" |
255 | 128 | 107 | ||
256 | 129 | # The steps for "install" are a superset of the steps for "inithost". | 108 | # The steps for "install" are a superset of the steps for "inithost". |
257 | 130 | setup_bzr_locations_step = (setup_bzr_locations, | ||
258 | 131 | 'user', 'lpuser', 'repository') | ||
259 | 132 | 109 | ||
260 | 133 | @property | 110 | @property |
261 | 134 | def steps(self): | 111 | def steps(self): |
262 | @@ -138,7 +115,8 @@ | |||
263 | 138 | return ( | 115 | return ( |
264 | 139 | inithost.SubCommand.initialize_step, | 116 | inithost.SubCommand.initialize_step, |
265 | 140 | lxcinstall.SubCommand.fetch_step, | 117 | lxcinstall.SubCommand.fetch_step, |
267 | 141 | self.setup_bzr_locations_step, | 118 | (setup_bzr_locations_as_root, |
268 | 119 | 'user', 'lpuser', 'repository'), | ||
269 | 142 | inithost.SubCommand.setup_apt_step, | 120 | inithost.SubCommand.setup_apt_step, |
270 | 143 | (setup_launchpad, | 121 | (setup_launchpad, |
271 | 144 | 'user', 'dependencies_dir', 'repository', 'valid_ssh_keys'), | 122 | 'user', 'dependencies_dir', 'repository', 'valid_ssh_keys'), |
272 | 145 | 123 | ||
273 | === modified file 'lpsetup/subcommands/lxcinstall.py' | |||
274 | --- lpsetup/subcommands/lxcinstall.py 2012-07-03 20:05:47 +0000 | |||
275 | +++ lpsetup/subcommands/lxcinstall.py 2012-07-06 11:32:19 +0000 | |||
276 | @@ -37,7 +37,6 @@ | |||
277 | 37 | from lpsetup.subcommands import ( | 37 | from lpsetup.subcommands import ( |
278 | 38 | inithost, | 38 | inithost, |
279 | 39 | initlxc, | 39 | initlxc, |
280 | 40 | install, | ||
281 | 41 | ) | 40 | ) |
282 | 42 | from lpsetup.utils import ( | 41 | from lpsetup.utils import ( |
283 | 43 | call, | 42 | call, |
284 | @@ -86,8 +85,8 @@ | |||
285 | 86 | """Set up the Launchpad environment inside an LXC.""" | 85 | """Set up the Launchpad environment inside an LXC.""" |
286 | 87 | # Use ssh to call this script from inside the container. | 86 | # Use ssh to call this script from inside the container. |
287 | 88 | args = [ | 87 | args = [ |
290 | 89 | 'install', '-u', user, '-s', 'setup_apt', 'setup_launchpad', | 88 | 'install', '-u', user, '-s', 'setup_apt', 'setup_bzr_locatoins', |
291 | 90 | '-d', dependencies_dir, '-r', repository | 89 | 'setup_launchpad', '-d', dependencies_dir, '-r', repository, |
292 | 91 | ] | 90 | ] |
293 | 92 | cmd = this_command(repository, args) | 91 | cmd = this_command(repository, args) |
294 | 93 | ssh(lxc_name, cmd, key=ssh_key_path) | 92 | ssh(lxc_name, cmd, key=ssh_key_path) |
295 | @@ -154,7 +153,6 @@ | |||
296 | 154 | steps = ( | 153 | steps = ( |
297 | 155 | inithost.SubCommand.initialize_step, | 154 | inithost.SubCommand.initialize_step, |
298 | 156 | fetch_step, | 155 | fetch_step, |
299 | 157 | install.SubCommand.setup_bzr_locations_step, | ||
300 | 158 | (create_scripts, | 156 | (create_scripts, |
301 | 159 | 'lxc_name', 'ssh_key_path', 'user'), | 157 | 'lxc_name', 'ssh_key_path', 'user'), |
302 | 160 | initlxc.SubCommand.create_lxc_step + ('install_subunit',), | 158 | initlxc.SubCommand.create_lxc_step + ('install_subunit',), |
303 | 161 | 159 | ||
304 | === modified file 'lpsetup/tests/subcommands/test_inithost.py' | |||
305 | --- lpsetup/tests/subcommands/test_inithost.py 2012-06-26 18:20:23 +0000 | |||
306 | +++ lpsetup/tests/subcommands/test_inithost.py 2012-07-06 11:32:19 +0000 | |||
307 | @@ -40,7 +40,7 @@ | |||
308 | 40 | expected_arguments = get_arguments() | 40 | expected_arguments = get_arguments() |
309 | 41 | expected_handlers = ( | 41 | expected_handlers = ( |
310 | 42 | handlers.handle_user, | 42 | handlers.handle_user, |
312 | 43 | handlers.handle_lpuser, | 43 | handlers.handle_lpuser_as_username, |
313 | 44 | handlers.handle_userdata, | 44 | handlers.handle_userdata, |
314 | 45 | handlers.handle_ssh_keys, | 45 | handlers.handle_ssh_keys, |
315 | 46 | ) | 46 | ) |
316 | 47 | 47 | ||
317 | === modified file 'lpsetup/tests/subcommands/test_initlxc.py' | |||
318 | --- lpsetup/tests/subcommands/test_initlxc.py 2012-06-28 17:22:45 +0000 | |||
319 | +++ lpsetup/tests/subcommands/test_initlxc.py 2012-07-06 11:32:19 +0000 | |||
320 | @@ -46,7 +46,7 @@ | |||
321 | 46 | expected_arguments = get_arguments() | 46 | expected_arguments = get_arguments() |
322 | 47 | expected_handlers = ( | 47 | expected_handlers = ( |
323 | 48 | handlers.handle_user, | 48 | handlers.handle_user, |
325 | 49 | handlers.handle_lpuser, | 49 | handlers.handle_lpuser_as_username, |
326 | 50 | handlers.handle_userdata, | 50 | handlers.handle_userdata, |
327 | 51 | handlers.handle_ssh_keys, | 51 | handlers.handle_ssh_keys, |
328 | 52 | ) | 52 | ) |
329 | 53 | 53 | ||
330 | === renamed file 'lpsetup/tests/subcommands/test_get.py' => 'lpsetup/tests/subcommands/test_initrepo.py' | |||
331 | --- lpsetup/tests/subcommands/test_get.py 2012-07-02 19:53:45 +0000 | |||
332 | +++ lpsetup/tests/subcommands/test_initrepo.py 2012-07-06 11:32:19 +0000 | |||
333 | @@ -2,20 +2,22 @@ | |||
334 | 2 | # Copyright 2012 Canonical Ltd. This software is licensed under the | 2 | # Copyright 2012 Canonical Ltd. This software is licensed under the |
335 | 3 | # GNU Affero General Public License version 3 (see the file LICENSE). | 3 | # GNU Affero General Public License version 3 (see the file LICENSE). |
336 | 4 | 4 | ||
338 | 5 | """Tests for the get sub command.""" | 5 | """Tests for the initrepo subcommand.""" |
339 | 6 | 6 | ||
340 | 7 | import unittest | 7 | import unittest |
341 | 8 | 8 | ||
342 | 9 | from lpsetup import handlers | 9 | from lpsetup import handlers |
344 | 10 | from lpsetup.subcommands import get | 10 | from lpsetup.subcommands import initrepo |
345 | 11 | from lpsetup.tests.utils import ( | 11 | from lpsetup.tests.utils import ( |
346 | 12 | get_random_string, | 12 | get_random_string, |
347 | 13 | StepsBasedSubCommandTestMixin, | 13 | StepsBasedSubCommandTestMixin, |
348 | 14 | ) | 14 | ) |
349 | 15 | 15 | ||
350 | 16 | 16 | ||
352 | 17 | fetch_step = (get.fetch, | 17 | fetch_step = (initrepo.fetch, |
353 | 18 | ['source', 'repository', 'branch_name', 'checkout_name']) | 18 | ['source', 'repository', 'branch_name', 'checkout_name']) |
354 | 19 | setup_bzr_locations_step = (initrepo.setup_bzr_locations, | ||
355 | 20 | ['lpuser', 'repository']) | ||
356 | 19 | 21 | ||
357 | 20 | 22 | ||
358 | 21 | def get_arguments(): | 23 | def get_arguments(): |
359 | @@ -26,17 +28,19 @@ | |||
360 | 26 | ) | 28 | ) |
361 | 27 | 29 | ||
362 | 28 | 30 | ||
364 | 29 | class GetTest(StepsBasedSubCommandTestMixin, unittest.TestCase): | 31 | class InitrepoTest(StepsBasedSubCommandTestMixin, unittest.TestCase): |
365 | 30 | 32 | ||
368 | 31 | sub_command_name = 'get' | 33 | sub_command_name = 'initrepo' |
369 | 32 | sub_command_class = get.SubCommand | 34 | sub_command_class = initrepo.SubCommand |
370 | 33 | expected_arguments = get_arguments() | 35 | expected_arguments = get_arguments() |
371 | 34 | expected_handlers = ( | 36 | expected_handlers = ( |
372 | 35 | handlers.handle_user, | 37 | handlers.handle_user, |
373 | 38 | handlers.handle_lpuser_from_lplogin, | ||
374 | 36 | handlers.handle_directories, | 39 | handlers.handle_directories, |
375 | 37 | handlers.handle_source, | 40 | handlers.handle_source, |
376 | 38 | ) | 41 | ) |
377 | 39 | expected_steps = ( | 42 | expected_steps = ( |
378 | 40 | fetch_step, | 43 | fetch_step, |
379 | 44 | setup_bzr_locations_step, | ||
380 | 41 | ) | 45 | ) |
381 | 42 | needs_root = False | 46 | needs_root = False |
382 | 43 | 47 | ||
383 | === modified file 'lpsetup/tests/subcommands/test_install.py' | |||
384 | --- lpsetup/tests/subcommands/test_install.py 2012-07-03 18:13:48 +0000 | |||
385 | +++ lpsetup/tests/subcommands/test_install.py 2012-07-06 11:32:19 +0000 | |||
386 | @@ -16,7 +16,7 @@ | |||
387 | 16 | 16 | ||
388 | 17 | 17 | ||
389 | 18 | setup_bzr_locations_step = ( | 18 | setup_bzr_locations_step = ( |
391 | 19 | install.setup_bzr_locations, ['user', 'lpuser', 'repository']) | 19 | install.setup_bzr_locations_as_root, ['user', 'lpuser', 'repository']) |
392 | 20 | setup_launchpad_step = ( | 20 | setup_launchpad_step = ( |
393 | 21 | install.setup_launchpad, ['user', 'dependencies_dir', 'repository', | 21 | install.setup_launchpad, ['user', 'dependencies_dir', 'repository', |
394 | 22 | 'valid_ssh_keys']) | 22 | 'valid_ssh_keys']) |
395 | @@ -35,7 +35,7 @@ | |||
396 | 35 | expected_arguments = get_arguments() | 35 | expected_arguments = get_arguments() |
397 | 36 | expected_handlers = ( | 36 | expected_handlers = ( |
398 | 37 | handlers.handle_user, | 37 | handlers.handle_user, |
400 | 38 | handlers.handle_lpuser, | 38 | handlers.handle_lpuser_as_username, |
401 | 39 | handlers.handle_userdata, | 39 | handlers.handle_userdata, |
402 | 40 | handlers.handle_ssh_keys, | 40 | handlers.handle_ssh_keys, |
403 | 41 | handlers.handle_directories, | 41 | handlers.handle_directories, |
404 | 42 | 42 | ||
405 | === modified file 'lpsetup/tests/subcommands/test_lxcinstall.py' | |||
406 | --- lpsetup/tests/subcommands/test_lxcinstall.py 2012-07-02 21:02:57 +0000 | |||
407 | +++ lpsetup/tests/subcommands/test_lxcinstall.py 2012-07-06 11:32:19 +0000 | |||
408 | @@ -11,7 +11,6 @@ | |||
409 | 11 | from lpsetup.tests.subcommands import ( | 11 | from lpsetup.tests.subcommands import ( |
410 | 12 | test_inithost, | 12 | test_inithost, |
411 | 13 | test_initlxc, | 13 | test_initlxc, |
412 | 14 | test_install, | ||
413 | 15 | ) | 14 | ) |
414 | 16 | from lpsetup.tests.utils import ( | 15 | from lpsetup.tests.utils import ( |
415 | 17 | get_random_string, | 16 | get_random_string, |
416 | @@ -46,7 +45,7 @@ | |||
417 | 46 | expected_arguments = get_arguments() | 45 | expected_arguments = get_arguments() |
418 | 47 | expected_handlers = ( | 46 | expected_handlers = ( |
419 | 48 | handlers.handle_user, | 47 | handlers.handle_user, |
421 | 49 | handlers.handle_lpuser, | 48 | handlers.handle_lpuser_as_username, |
422 | 50 | handlers.handle_userdata, | 49 | handlers.handle_userdata, |
423 | 51 | handlers.handle_ssh_keys, | 50 | handlers.handle_ssh_keys, |
424 | 52 | handlers.handle_directories, | 51 | handlers.handle_directories, |
425 | @@ -55,7 +54,6 @@ | |||
426 | 55 | expected_steps = ( | 54 | expected_steps = ( |
427 | 56 | test_inithost.initialize_step, | 55 | test_inithost.initialize_step, |
428 | 57 | fetch_step, | 56 | fetch_step, |
429 | 58 | test_install.setup_bzr_locations_step, | ||
430 | 59 | create_scripts_step, | 57 | create_scripts_step, |
431 | 60 | create_lxc_step, | 58 | create_lxc_step, |
432 | 61 | test_initlxc.start_lxc_step, | 59 | test_initlxc.start_lxc_step, |
433 | 62 | 60 | ||
434 | === modified file 'lpsetup/tests/test_handlers.py' | |||
435 | --- lpsetup/tests/test_handlers.py 2012-07-03 18:13:48 +0000 | |||
436 | +++ lpsetup/tests/test_handlers.py 2012-07-06 11:32:19 +0000 | |||
437 | @@ -13,7 +13,7 @@ | |||
438 | 13 | from lpsetup.exceptions import ValidationError | 13 | from lpsetup.exceptions import ValidationError |
439 | 14 | from lpsetup.handlers import ( | 14 | from lpsetup.handlers import ( |
440 | 15 | handle_directories, | 15 | handle_directories, |
442 | 16 | handle_lpuser, | 16 | handle_lpuser_as_username, |
443 | 17 | handle_ssh_keys, | 17 | handle_ssh_keys, |
444 | 18 | handle_testing, | 18 | handle_testing, |
445 | 19 | handle_user, | 19 | handle_user, |
446 | @@ -97,7 +97,7 @@ | |||
447 | 97 | # If lpuser is not provided by namespace, the user name is used. | 97 | # If lpuser is not provided by namespace, the user name is used. |
448 | 98 | username = getpass.getuser() | 98 | username = getpass.getuser() |
449 | 99 | namespace = argparse.Namespace(user=username, lpuser=None) | 99 | namespace = argparse.Namespace(user=username, lpuser=None) |
451 | 100 | handle_lpuser(namespace) | 100 | handle_lpuser_as_username(namespace) |
452 | 101 | self.assertEqual(username, namespace.lpuser) | 101 | self.assertEqual(username, namespace.lpuser) |
453 | 102 | 102 | ||
454 | 103 | 103 | ||
455 | 104 | 104 | ||
456 | === added file 'pre-commit.sh' | |||
457 | --- pre-commit.sh 1970-01-01 00:00:00 +0000 | |||
458 | +++ pre-commit.sh 2012-07-06 11:32:19 +0000 | |||
459 | @@ -0,0 +1,3 @@ | |||
460 | 1 | #!/bin/bash | ||
461 | 2 | |||
462 | 3 | find . -name "*.py" | grep -v distribute_setup.py | xargs pocketlint && nosetests --with-doctest |
The attempt to merge lp:~bac/lpsetup/initrepo into lp:lpsetup failed. Below is the output from the failed tests.
/bin/sh: 1: pre-commit.sh: not found