Merge lp:~corey.bryant/charms/trusty/cinder/git-ods into lp:~openstack-charmers-archive/charms/trusty/cinder/next
- Trusty Tahr (14.04)
- git-ods
- Merge into next
Status: | Merged |
---|---|
Merged at revision: | 94 |
Proposed branch: | lp:~corey.bryant/charms/trusty/cinder/git-ods |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/cinder/next |
Diff against target: |
492 lines (+167/-42) 6 files modified
hooks/charmhelpers/contrib/openstack/utils.py (+65/-18) hooks/charmhelpers/contrib/python/packages.py (+28/-5) hooks/charmhelpers/fetch/giturl.py (+7/-5) hooks/cinder_utils.py (+48/-4) tests/basic_deployment.py (+2/-3) unit_tests/test_cinder_utils.py (+17/-7) |
To merge this branch: | bzr merge lp:~corey.bryant/charms/trusty/cinder/git-ods |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenStack Charmers | Pending | ||
Review via email: mp+257185@code.launchpad.net |
Commit message
Adds support to:
* Use a Python virtualenv when deploying from source
* Default to shallow clone for git (depth=1)
* Pass http_proxy to pip installs if specified
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3606 cinder-next for corey.bryant mp257185
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3605 cinder-next for corey.bryant mp257185
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3863 cinder-next for corey.bryant mp257185
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3650 cinder-next for corey.bryant mp257185
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3872 cinder-next for corey.bryant mp257185
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3659 cinder-next for corey.bryant mp257185
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3654 cinder-next for corey.bryant mp257185
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3903 cinder-next for corey.bryant mp257185
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3690 cinder-next for corey.bryant mp257185
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3689 cinder-next for corey.bryant mp257185
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4240 cinder-next for corey.bryant mp257185
LINT FAIL: lint-test failed
LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.
Full lint test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4256 cinder-next for corey.bryant mp257185
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3982 cinder-next for corey.bryant mp257185
UNIT OK: passed
Corey Bryant (corey.bryant) wrote : | # |
This mp adds support to:
* Use a Python virtualenv when deploying from source
* Default to shallow clone for git (depth=1)
* Pass http_proxy to pip installs if specified
- 120. By Corey Bryant
-
Sync charm-helpers
- 121. By Corey Bryant
-
Add comment to fix bin symlinks
- 122. By Corey Bryant
-
Sync charm-helpers
- 123. By Corey Bryant
-
Sync charm-helpers
- 124. By Corey Bryant
-
Clone from github in deploy from source amulet tests
- 125. By Corey Bryant
-
Install python-cephclient as part of base deploy from source packages
- 126. By Corey Bryant
-
Add libyaml-dev as base git package
- 127. By Corey Bryant
-
Add rbd.py and rados.py symlinks and drop python-cephclient
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4461 cinder-next for corey.bryant mp257185
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4186 cinder-next for corey.bryant mp257185
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4084 cinder-next for corey.bryant mp257185
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4524 cinder-next for corey.bryant mp257185
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4249 cinder-next for corey.bryant mp257185
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4103 cinder-next for corey.bryant mp257185
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4532 cinder-next for corey.bryant mp257185
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4257 cinder-next for corey.bryant mp257185
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4111 cinder-next for corey.bryant mp257185
AMULET OK: passed
Build: http://
- 128. By Corey Bryant
-
Sync charm-helpers
Preview Diff
1 | === modified file 'hooks/charmhelpers/contrib/openstack/utils.py' |
2 | --- hooks/charmhelpers/contrib/openstack/utils.py 2015-04-16 14:40:58 +0000 |
3 | +++ hooks/charmhelpers/contrib/openstack/utils.py 2015-05-27 13:06:43 +0000 |
4 | @@ -53,9 +53,13 @@ |
5 | get_ipv6_addr |
6 | ) |
7 | |
8 | +from charmhelpers.contrib.python.packages import ( |
9 | + pip_create_virtualenv, |
10 | + pip_install, |
11 | +) |
12 | + |
13 | from charmhelpers.core.host import lsb_release, mounts, umount |
14 | from charmhelpers.fetch import apt_install, apt_cache, install_remote |
15 | -from charmhelpers.contrib.python.packages import pip_install |
16 | from charmhelpers.contrib.storage.linux.utils import is_block_device, zap_disk |
17 | from charmhelpers.contrib.storage.linux.loopback import ensure_loopback_device |
18 | |
19 | @@ -497,7 +501,17 @@ |
20 | requirements_dir = None |
21 | |
22 | |
23 | -def git_clone_and_install(projects_yaml, core_project): |
24 | +def _git_yaml_load(projects_yaml): |
25 | + """ |
26 | + Load the specified yaml into a dictionary. |
27 | + """ |
28 | + if not projects_yaml: |
29 | + return None |
30 | + |
31 | + return yaml.load(projects_yaml) |
32 | + |
33 | + |
34 | +def git_clone_and_install(projects_yaml, core_project, depth=1): |
35 | """ |
36 | Clone/install all specified OpenStack repositories. |
37 | |
38 | @@ -510,23 +524,22 @@ |
39 | repository: 'git://git.openstack.org/openstack/requirements.git', |
40 | branch: 'stable/icehouse'} |
41 | directory: /mnt/openstack-git |
42 | - http_proxy: http://squid.internal:3128 |
43 | - https_proxy: https://squid.internal:3128 |
44 | + http_proxy: squid-proxy-url |
45 | + https_proxy: squid-proxy-url |
46 | |
47 | The directory, http_proxy, and https_proxy keys are optional. |
48 | """ |
49 | global requirements_dir |
50 | parent_dir = '/mnt/openstack-git' |
51 | - |
52 | - if not projects_yaml: |
53 | - return |
54 | - |
55 | - projects = yaml.load(projects_yaml) |
56 | + http_proxy = None |
57 | + |
58 | + projects = _git_yaml_load(projects_yaml) |
59 | _git_validate_projects_yaml(projects, core_project) |
60 | |
61 | old_environ = dict(os.environ) |
62 | |
63 | if 'http_proxy' in projects.keys(): |
64 | + http_proxy = projects['http_proxy'] |
65 | os.environ['http_proxy'] = projects['http_proxy'] |
66 | if 'https_proxy' in projects.keys(): |
67 | os.environ['https_proxy'] = projects['https_proxy'] |
68 | @@ -534,15 +547,19 @@ |
69 | if 'directory' in projects.keys(): |
70 | parent_dir = projects['directory'] |
71 | |
72 | + pip_create_virtualenv(os.path.join(parent_dir, 'venv')) |
73 | + |
74 | for p in projects['repositories']: |
75 | repo = p['repository'] |
76 | branch = p['branch'] |
77 | if p['name'] == 'requirements': |
78 | - repo_dir = _git_clone_and_install_single(repo, branch, parent_dir, |
79 | + repo_dir = _git_clone_and_install_single(repo, branch, depth, |
80 | + parent_dir, http_proxy, |
81 | update_requirements=False) |
82 | requirements_dir = repo_dir |
83 | else: |
84 | - repo_dir = _git_clone_and_install_single(repo, branch, parent_dir, |
85 | + repo_dir = _git_clone_and_install_single(repo, branch, depth, |
86 | + parent_dir, http_proxy, |
87 | update_requirements=True) |
88 | |
89 | os.environ = old_environ |
90 | @@ -574,7 +591,8 @@ |
91 | error_out('openstack-origin-git key \'{}\' is missing'.format(key)) |
92 | |
93 | |
94 | -def _git_clone_and_install_single(repo, branch, parent_dir, update_requirements): |
95 | +def _git_clone_and_install_single(repo, branch, depth, parent_dir, http_proxy, |
96 | + update_requirements): |
97 | """ |
98 | Clone and install a single git repository. |
99 | """ |
100 | @@ -587,7 +605,8 @@ |
101 | |
102 | if not os.path.exists(dest_dir): |
103 | juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch)) |
104 | - repo_dir = install_remote(repo, dest=parent_dir, branch=branch) |
105 | + repo_dir = install_remote(repo, dest=parent_dir, branch=branch, |
106 | + depth=depth) |
107 | else: |
108 | repo_dir = dest_dir |
109 | |
110 | @@ -598,7 +617,12 @@ |
111 | _git_update_requirements(repo_dir, requirements_dir) |
112 | |
113 | juju_log('Installing git repo from dir: {}'.format(repo_dir)) |
114 | - pip_install(repo_dir) |
115 | + if http_proxy: |
116 | + pip_install(repo_dir, proxy=http_proxy, |
117 | + venv=os.path.join(parent_dir, 'venv')) |
118 | + else: |
119 | + pip_install(repo_dir, |
120 | + venv=os.path.join(parent_dir, 'venv')) |
121 | |
122 | return repo_dir |
123 | |
124 | @@ -621,16 +645,27 @@ |
125 | os.chdir(orig_dir) |
126 | |
127 | |
128 | +def git_pip_venv_dir(projects_yaml): |
129 | + """ |
130 | + Return the pip virtualenv path. |
131 | + """ |
132 | + parent_dir = '/mnt/openstack-git' |
133 | + |
134 | + projects = _git_yaml_load(projects_yaml) |
135 | + |
136 | + if 'directory' in projects.keys(): |
137 | + parent_dir = projects['directory'] |
138 | + |
139 | + return os.path.join(parent_dir, 'venv') |
140 | + |
141 | + |
142 | def git_src_dir(projects_yaml, project): |
143 | """ |
144 | Return the directory where the specified project's source is located. |
145 | """ |
146 | parent_dir = '/mnt/openstack-git' |
147 | |
148 | - if not projects_yaml: |
149 | - return |
150 | - |
151 | - projects = yaml.load(projects_yaml) |
152 | + projects = _git_yaml_load(projects_yaml) |
153 | |
154 | if 'directory' in projects.keys(): |
155 | parent_dir = projects['directory'] |
156 | @@ -640,3 +675,15 @@ |
157 | return os.path.join(parent_dir, os.path.basename(p['repository'])) |
158 | |
159 | return None |
160 | + |
161 | + |
162 | +def git_yaml_value(projects_yaml, key): |
163 | + """ |
164 | + Return the value in projects_yaml for the specified key. |
165 | + """ |
166 | + projects = _git_yaml_load(projects_yaml) |
167 | + |
168 | + if key in projects.keys(): |
169 | + return projects[key] |
170 | + |
171 | + return None |
172 | |
173 | === modified file 'hooks/charmhelpers/contrib/python/packages.py' |
174 | --- hooks/charmhelpers/contrib/python/packages.py 2015-03-13 13:00:03 +0000 |
175 | +++ hooks/charmhelpers/contrib/python/packages.py 2015-05-27 13:06:43 +0000 |
176 | @@ -17,8 +17,11 @@ |
177 | # You should have received a copy of the GNU Lesser General Public License |
178 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
179 | |
180 | +import os |
181 | +import subprocess |
182 | + |
183 | from charmhelpers.fetch import apt_install, apt_update |
184 | -from charmhelpers.core.hookenv import log |
185 | +from charmhelpers.core.hookenv import charm_dir, log |
186 | |
187 | try: |
188 | from pip import main as pip_execute |
189 | @@ -51,11 +54,15 @@ |
190 | pip_execute(command) |
191 | |
192 | |
193 | -def pip_install(package, fatal=False, upgrade=False, **options): |
194 | +def pip_install(package, fatal=False, upgrade=False, venv=None, **options): |
195 | """Install a python package""" |
196 | - command = ["install"] |
197 | + if venv: |
198 | + venv_python = os.path.join(venv, 'bin/pip') |
199 | + command = [venv_python, "install"] |
200 | + else: |
201 | + command = ["install"] |
202 | |
203 | - available_options = ('proxy', 'src', 'log', "index-url", ) |
204 | + available_options = ('proxy', 'src', 'log', 'index-url', ) |
205 | for option in parse_options(options, available_options): |
206 | command.append(option) |
207 | |
208 | @@ -69,7 +76,10 @@ |
209 | |
210 | log("Installing {} package with options: {}".format(package, |
211 | command)) |
212 | - pip_execute(command) |
213 | + if venv: |
214 | + subprocess.check_call(command) |
215 | + else: |
216 | + pip_execute(command) |
217 | |
218 | |
219 | def pip_uninstall(package, **options): |
220 | @@ -94,3 +104,16 @@ |
221 | """Returns the list of current python installed packages |
222 | """ |
223 | return pip_execute(["list"]) |
224 | + |
225 | + |
226 | +def pip_create_virtualenv(path=None): |
227 | + """Create an isolated Python environment.""" |
228 | + apt_install('python-virtualenv') |
229 | + |
230 | + if path: |
231 | + venv_path = path |
232 | + else: |
233 | + venv_path = os.path.join(charm_dir(), 'venv') |
234 | + |
235 | + if not os.path.exists(venv_path): |
236 | + subprocess.check_call(['virtualenv', venv_path]) |
237 | |
238 | === modified file 'hooks/charmhelpers/fetch/giturl.py' |
239 | --- hooks/charmhelpers/fetch/giturl.py 2015-03-13 13:00:03 +0000 |
240 | +++ hooks/charmhelpers/fetch/giturl.py 2015-05-27 13:06:43 +0000 |
241 | @@ -45,14 +45,16 @@ |
242 | else: |
243 | return True |
244 | |
245 | - def clone(self, source, dest, branch): |
246 | + def clone(self, source, dest, branch, depth=None): |
247 | if not self.can_handle(source): |
248 | raise UnhandledSource("Cannot handle {}".format(source)) |
249 | |
250 | - repo = Repo.clone_from(source, dest) |
251 | - repo.git.checkout(branch) |
252 | + if depth: |
253 | + Repo.clone_from(source, dest, branch=branch, depth=depth) |
254 | + else: |
255 | + Repo.clone_from(source, dest, branch=branch) |
256 | |
257 | - def install(self, source, branch="master", dest=None): |
258 | + def install(self, source, branch="master", dest=None, depth=None): |
259 | url_parts = self.parse_url(source) |
260 | branch_name = url_parts.path.strip("/").split("/")[-1] |
261 | if dest: |
262 | @@ -63,7 +65,7 @@ |
263 | if not os.path.exists(dest_dir): |
264 | mkdir(dest_dir, perms=0o755) |
265 | try: |
266 | - self.clone(source, dest_dir, branch) |
267 | + self.clone(source, dest_dir, branch, depth) |
268 | except GitCommandError as e: |
269 | raise UnhandledSource(e.message) |
270 | except OSError as e: |
271 | |
272 | === modified file 'hooks/cinder_utils.py' |
273 | --- hooks/cinder_utils.py 2015-04-15 15:19:27 +0000 |
274 | +++ hooks/cinder_utils.py 2015-05-27 13:06:43 +0000 |
275 | @@ -5,6 +5,10 @@ |
276 | from collections import OrderedDict |
277 | from copy import copy |
278 | |
279 | +from charmhelpers.contrib.python.packages import ( |
280 | + pip_install, |
281 | +) |
282 | + |
283 | from charmhelpers.core.hookenv import ( |
284 | charm_dir, |
285 | config, |
286 | @@ -69,6 +73,8 @@ |
287 | git_install_requested, |
288 | git_clone_and_install, |
289 | git_src_dir, |
290 | + git_yaml_value, |
291 | + git_pip_venv_dir, |
292 | os_release, |
293 | ) |
294 | |
295 | @@ -94,8 +100,12 @@ |
296 | SCHEDULER_PACKAGES = ['cinder-scheduler'] |
297 | |
298 | BASE_GIT_PACKAGES = [ |
299 | + 'libffi-dev', |
300 | + 'libmysqlclient-dev', |
301 | + 'libssl-dev', |
302 | 'libxml2-dev', |
303 | 'libxslt1-dev', |
304 | + 'libyaml-dev', |
305 | 'lvm2', |
306 | 'python-dev', |
307 | 'python-pip', |
308 | @@ -564,6 +574,16 @@ |
309 | |
310 | def git_post_install(projects_yaml): |
311 | """Perform cinder post-install setup.""" |
312 | + http_proxy = git_yaml_value(projects_yaml, 'http_proxy') |
313 | + base_packages = ['mysql-python'] |
314 | + for pkg in base_packages: |
315 | + if http_proxy: |
316 | + pip_install(pkg, proxy=http_proxy, |
317 | + venv=git_pip_venv_dir(projects_yaml)) |
318 | + else: |
319 | + pip_install(pkg, |
320 | + venv=git_pip_venv_dir(projects_yaml)) |
321 | + |
322 | src_etc = os.path.join(git_src_dir(projects_yaml, 'cinder'), 'etc/cinder') |
323 | configs = { |
324 | 'src': src_etc, |
325 | @@ -574,6 +594,29 @@ |
326 | shutil.rmtree(configs['dest']) |
327 | shutil.copytree(configs['src'], configs['dest']) |
328 | |
329 | + # NOTE(coreycb): Need to find better solution than bin symlinks. |
330 | + symlinks = [ |
331 | + {'src': os.path.join(git_pip_venv_dir(projects_yaml), |
332 | + 'bin/cinder-manage'), |
333 | + 'link': '/usr/local/bin/cinder-manage'}, |
334 | + {'src': os.path.join(git_pip_venv_dir(projects_yaml), |
335 | + 'bin/cinder-rootwrap'), |
336 | + 'link': '/usr/local/bin/cinder-rootwrap'}, |
337 | + # NOTE(coreycb): This is ugly but couldn't find pypi package that |
338 | + # installs rbd.py and rados.py. |
339 | + {'src': '/usr/lib/python2.7/dist-packages/rbd.py', |
340 | + 'link': os.path.join(git_pip_venv_dir(projects_yaml), |
341 | + 'lib/python2.7/site-packages/rbd.py')}, |
342 | + {'src': '/usr/lib/python2.7/dist-packages/rados.py', |
343 | + 'link': os.path.join(git_pip_venv_dir(projects_yaml), |
344 | + 'lib/python2.7/site-packages/rados.py')}, |
345 | + ] |
346 | + |
347 | + for s in symlinks: |
348 | + if os.path.lexists(s['link']): |
349 | + os.remove(s['link']) |
350 | + os.symlink(s['src'], s['link']) |
351 | + |
352 | render('cinder.conf', '/etc/cinder/cinder.conf', {}, owner='cinder', |
353 | group='cinder', perms=0o644) |
354 | render('git/cinder_tgt.conf', '/etc/tgt/conf.d', {}, owner='cinder', |
355 | @@ -585,13 +628,14 @@ |
356 | |
357 | os.chmod('/etc/sudoers.d', 0o750) |
358 | |
359 | + bin_dir = os.path.join(git_pip_venv_dir(projects_yaml), 'bin') |
360 | cinder_api_context = { |
361 | 'service_description': 'Cinder API server', |
362 | 'service_name': 'Cinder', |
363 | 'user_name': 'cinder', |
364 | 'start_dir': '/var/lib/cinder', |
365 | 'process_name': 'cinder-api', |
366 | - 'executable_name': '/usr/local/bin/cinder-api', |
367 | + 'executable_name': os.path.join(bin_dir, 'cinder-api'), |
368 | 'config_files': ['/etc/cinder/cinder.conf'], |
369 | 'log_file': '/var/log/cinder/cinder-api.log', |
370 | } |
371 | @@ -602,7 +646,7 @@ |
372 | 'user_name': 'cinder', |
373 | 'start_dir': '/var/lib/cinder', |
374 | 'process_name': 'cinder-backup', |
375 | - 'executable_name': '/usr/local/bin/cinder-backup', |
376 | + 'executable_name': os.path.join(bin_dir, 'cinder-backup'), |
377 | 'config_files': ['/etc/cinder/cinder.conf'], |
378 | 'log_file': '/var/log/cinder/cinder-backup.log', |
379 | } |
380 | @@ -613,7 +657,7 @@ |
381 | 'user_name': 'cinder', |
382 | 'start_dir': '/var/lib/cinder', |
383 | 'process_name': 'cinder-scheduler', |
384 | - 'executable_name': '/usr/local/bin/cinder-scheduler', |
385 | + 'executable_name': os.path.join(bin_dir, 'cinder-scheduler'), |
386 | 'config_files': ['/etc/cinder/cinder.conf'], |
387 | 'log_file': '/var/log/cinder/cinder-scheduler.log', |
388 | } |
389 | @@ -624,7 +668,7 @@ |
390 | 'user_name': 'cinder', |
391 | 'start_dir': '/var/lib/cinder', |
392 | 'process_name': 'cinder-volume', |
393 | - 'executable_name': '/usr/local/bin/cinder-volume', |
394 | + 'executable_name': os.path.join(bin_dir, 'cinder-volume'), |
395 | 'config_files': ['/etc/cinder/cinder.conf'], |
396 | 'log_file': '/var/log/cinder/cinder-volume.log', |
397 | } |
398 | |
399 | === modified file 'tests/basic_deployment.py' |
400 | --- tests/basic_deployment.py 2015-04-16 21:31:48 +0000 |
401 | +++ tests/basic_deployment.py 2015-05-27 13:06:43 +0000 |
402 | @@ -80,11 +80,10 @@ |
403 | openstack_origin_git = { |
404 | 'repositories': [ |
405 | {'name': 'requirements', |
406 | - 'repository': |
407 | - 'git://git.openstack.org/openstack/requirements', |
408 | + 'repository': 'git://github.com/openstack/requirements', |
409 | 'branch': branch}, |
410 | {'name': 'cinder', |
411 | - 'repository': 'git://git.openstack.org/openstack/cinder', |
412 | + 'repository': 'git://github.com/openstack/cinder', |
413 | 'branch': branch}, |
414 | ], |
415 | 'directory': '/mnt/openstack-git', |
416 | |
417 | === modified file 'unit_tests/test_cinder_utils.py' |
418 | --- unit_tests/test_cinder_utils.py 2015-04-13 17:42:38 +0000 |
419 | +++ unit_tests/test_cinder_utils.py 2015-05-27 13:06:43 +0000 |
420 | @@ -572,6 +572,7 @@ |
421 | @patch.object(cinder_utils, 'git_src_dir') |
422 | @patch.object(cinder_utils, 'service_restart') |
423 | @patch.object(cinder_utils, 'render') |
424 | + @patch.object(cinder_utils, 'pip_install') |
425 | @patch('os.path.join') |
426 | @patch('os.path.exists') |
427 | @patch('shutil.copytree') |
428 | @@ -580,24 +581,33 @@ |
429 | @patch('grp.getgrnam') |
430 | @patch('os.chown') |
431 | @patch('os.chmod') |
432 | - def test_git_post_install(self, chmod, chown, grp, pwd, rmtree, copytree, |
433 | - exists, join, render, service_restart, |
434 | - git_src_dir): |
435 | + @patch('os.symlink') |
436 | + def test_git_post_install(self, symlink, chmod, chown, grp, pwd, rmtree, |
437 | + copytree, exists, join, pip_install, render, |
438 | + service_restart, git_src_dir): |
439 | projects_yaml = openstack_origin_git |
440 | join.return_value = 'joined-string' |
441 | cinder_utils.git_post_install(projects_yaml) |
442 | + pip_install('mysql-python', venv='joined-string') |
443 | expected = [ |
444 | call('joined-string', '/etc/cinder'), |
445 | ] |
446 | copytree.assert_has_calls(expected) |
447 | |
448 | + expected = [ |
449 | + call('joined-string', '/usr/local/bin/cinder-manage'), |
450 | + call('/usr/lib/python2.7/dist-packages/rbd.py', 'joined-string'), |
451 | + call('/usr/lib/python2.7/dist-packages/rados.py', 'joined-string'), |
452 | + ] |
453 | + symlink.assert_has_calls(expected, any_order=True) |
454 | + |
455 | cinder_api_context = { |
456 | 'service_description': 'Cinder API server', |
457 | 'service_name': 'Cinder', |
458 | 'user_name': 'cinder', |
459 | 'start_dir': '/var/lib/cinder', |
460 | 'process_name': 'cinder-api', |
461 | - 'executable_name': '/usr/local/bin/cinder-api', |
462 | + 'executable_name': 'joined-string', |
463 | 'config_files': ['/etc/cinder/cinder.conf'], |
464 | 'log_file': '/var/log/cinder/cinder-api.log', |
465 | } |
466 | @@ -608,7 +618,7 @@ |
467 | 'user_name': 'cinder', |
468 | 'start_dir': '/var/lib/cinder', |
469 | 'process_name': 'cinder-backup', |
470 | - 'executable_name': '/usr/local/bin/cinder-backup', |
471 | + 'executable_name': 'joined-string', |
472 | 'config_files': ['/etc/cinder/cinder.conf'], |
473 | 'log_file': '/var/log/cinder/cinder-backup.log', |
474 | } |
475 | @@ -619,7 +629,7 @@ |
476 | 'user_name': 'cinder', |
477 | 'start_dir': '/var/lib/cinder', |
478 | 'process_name': 'cinder-scheduler', |
479 | - 'executable_name': '/usr/local/bin/cinder-scheduler', |
480 | + 'executable_name': 'joined-string', |
481 | 'config_files': ['/etc/cinder/cinder.conf'], |
482 | 'log_file': '/var/log/cinder/cinder-scheduler.log', |
483 | } |
484 | @@ -630,7 +640,7 @@ |
485 | 'user_name': 'cinder', |
486 | 'start_dir': '/var/lib/cinder', |
487 | 'process_name': 'cinder-volume', |
488 | - 'executable_name': '/usr/local/bin/cinder-volume', |
489 | + 'executable_name': 'joined-string', |
490 | 'config_files': ['/etc/cinder/cinder.conf'], |
491 | 'log_file': '/var/log/cinder/cinder-volume.log', |
492 | } |
charm_lint_check #3819 cinder-next for corey.bryant mp257185
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/3819/