Merge lp:~corey.bryant/charms/trusty/keystone/git-ods into lp:~openstack-charmers-archive/charms/trusty/keystone/next
- Trusty Tahr (14.04)
- git-ods
- Merge into next
Status: | Merged |
---|---|
Merged at revision: | 152 |
Proposed branch: | lp:~corey.bryant/charms/trusty/keystone/git-ods |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/keystone/next |
Diff against target: |
444 lines (+152/-40) 7 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/keystone_utils.py (+32/-3) tests/basic_deployment.py (+2/-2) unit_tests/test_keystone_hooks.py (+5/-4) unit_tests/test_keystone_utils.py (+13/-3) |
To merge this branch: | bzr merge lp:~corey.bryant/charms/trusty/keystone/git-ods |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenStack Charmers | Pending | ||
Review via email: mp+257188@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 #3608 keystone-next for corey.bryant mp257188
UNIT FAIL: unit-test failed
UNIT Results (max last 2 lines):
make: *** [unit_test] Error 1
ERROR:root:Make target returned non-zero.
Full unit test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3607 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3830 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3617 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3616 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3865 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3652 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3874 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3661 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3656 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3905 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3692 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4258 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3984 keystone-next for corey.bryant mp257188
UNIT OK: passed
- 181. By Corey Bryant
-
Sync charm-helpers
- 182. By Corey Bryant
-
Add comment to fix bin symlinks
- 183. By Corey Bryant
-
Sync charm-helpers
- 184. By Corey Bryant
-
Sync charm-helpers
- 185. By Corey Bryant
-
Clone from github in deploy from source amulet tests
- 186. By Corey Bryant
-
Add libyaml-dev as base git package
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4464 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4189 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4087 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4526 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4251 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4105 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4534 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4259 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4113 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4543 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4268 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4122 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
- 187. By Corey Bryant
-
Sync charm-helpers
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #4838 keystone-next for corey.bryant mp257188
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #4518 keystone-next for corey.bryant mp257188
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #4329 keystone-next for corey.bryant mp257188
AMULET OK: passed
Build: http://
Preview Diff
1 | === modified file 'hooks/charmhelpers/contrib/openstack/utils.py' |
2 | --- hooks/charmhelpers/contrib/openstack/utils.py 2015-04-16 14:09:47 +0000 |
3 | +++ hooks/charmhelpers/contrib/openstack/utils.py 2015-05-27 13:06:53 +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-11 11:45:09 +0000 |
175 | +++ hooks/charmhelpers/contrib/python/packages.py 2015-05-27 13:06:53 +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-11 11:45:09 +0000 |
240 | +++ hooks/charmhelpers/fetch/giturl.py 2015-05-27 13:06:53 +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/keystone_utils.py' |
273 | --- hooks/keystone_utils.py 2015-05-08 11:43:00 +0000 |
274 | +++ hooks/keystone_utils.py 2015-05-27 13:06:53 +0000 |
275 | @@ -44,8 +44,15 @@ |
276 | git_install_requested, |
277 | git_clone_and_install, |
278 | git_src_dir, |
279 | + git_yaml_value, |
280 | + git_pip_venv_dir, |
281 | os_release, |
282 | - save_script_rc as _save_script_rc) |
283 | + save_script_rc as _save_script_rc |
284 | +) |
285 | + |
286 | +from charmhelpers.contrib.python.packages import ( |
287 | + pip_install, |
288 | +) |
289 | |
290 | from charmhelpers.core.strutils import ( |
291 | bool_from_string, |
292 | @@ -123,9 +130,11 @@ |
293 | |
294 | BASE_GIT_PACKAGES = [ |
295 | 'libffi-dev', |
296 | + 'libmysqlclient-dev', |
297 | 'libssl-dev', |
298 | 'libxml2-dev', |
299 | 'libxslt1-dev', |
300 | + 'libyaml-dev', |
301 | 'python-dev', |
302 | 'python-pip', |
303 | 'python-setuptools', |
304 | @@ -139,7 +148,6 @@ |
305 | # ubuntu packages that should not be installed when deploying from git |
306 | GIT_PACKAGE_BLACKLIST = [ |
307 | 'keystone', |
308 | - 'python-keystoneclient', |
309 | ] |
310 | |
311 | API_PORTS = { |
312 | @@ -1700,6 +1708,14 @@ |
313 | |
314 | def git_post_install(projects_yaml): |
315 | """Perform keystone post-install setup.""" |
316 | + http_proxy = git_yaml_value(projects_yaml, 'http_proxy') |
317 | + if http_proxy: |
318 | + pip_install('mysql-python', proxy=http_proxy, |
319 | + venv=git_pip_venv_dir(projects_yaml)) |
320 | + else: |
321 | + pip_install('mysql-python', |
322 | + venv=git_pip_venv_dir(projects_yaml)) |
323 | + |
324 | src_etc = os.path.join(git_src_dir(projects_yaml, 'keystone'), 'etc') |
325 | configs = { |
326 | 'src': src_etc, |
327 | @@ -1710,15 +1726,28 @@ |
328 | shutil.rmtree(configs['dest']) |
329 | shutil.copytree(configs['src'], configs['dest']) |
330 | |
331 | + # NOTE(coreycb): Need to find better solution than bin symlinks. |
332 | + symlinks = [ |
333 | + {'src': os.path.join(git_pip_venv_dir(projects_yaml), |
334 | + 'bin/keystone-manage'), |
335 | + 'link': '/usr/local/bin/keystone-manage'}, |
336 | + ] |
337 | + |
338 | + for s in symlinks: |
339 | + if os.path.lexists(s['link']): |
340 | + os.remove(s['link']) |
341 | + os.symlink(s['src'], s['link']) |
342 | + |
343 | render('git/logging.conf', '/etc/keystone/logging.conf', {}, perms=0o644) |
344 | |
345 | + bin_dir = os.path.join(git_pip_venv_dir(projects_yaml), 'bin') |
346 | keystone_context = { |
347 | 'service_description': 'Keystone API server', |
348 | 'service_name': 'Keystone', |
349 | 'user_name': 'keystone', |
350 | 'start_dir': '/var/lib/keystone', |
351 | 'process_name': 'keystone', |
352 | - 'executable_name': '/usr/local/bin/keystone-all', |
353 | + 'executable_name': os.path.join(bin_dir, 'keystone-all'), |
354 | 'config_files': ['/etc/keystone/keystone.conf'], |
355 | 'log_file': '/var/log/keystone/keystone.log', |
356 | } |
357 | |
358 | === modified file 'tests/basic_deployment.py' |
359 | --- tests/basic_deployment.py 2015-05-13 09:42:17 +0000 |
360 | +++ tests/basic_deployment.py 2015-05-27 13:06:53 +0000 |
361 | @@ -59,10 +59,10 @@ |
362 | openstack_origin_git = { |
363 | 'repositories': [ |
364 | {'name': 'requirements', |
365 | - 'repository': 'git://git.openstack.org/openstack/requirements', |
366 | + 'repository': 'git://github.com/openstack/requirements', |
367 | 'branch': branch}, |
368 | {'name': 'keystone', |
369 | - 'repository': 'git://git.openstack.org/openstack/keystone', |
370 | + 'repository': 'git://github.com/openstack/keystone', |
371 | 'branch': branch}, |
372 | ], |
373 | 'directory': '/mnt/openstack-git', |
374 | |
375 | === modified file 'unit_tests/test_keystone_hooks.py' |
376 | --- unit_tests/test_keystone_hooks.py 2015-04-17 12:10:54 +0000 |
377 | +++ unit_tests/test_keystone_hooks.py 2015-05-27 13:06:53 +0000 |
378 | @@ -117,10 +117,11 @@ |
379 | self.configure_installation_source.assert_called_with(repo) |
380 | self.assertTrue(self.apt_update.called) |
381 | self.apt_install.assert_called_with( |
382 | - ['haproxy', 'unison', 'python-setuptools', 'python-six', 'uuid', |
383 | - 'python-mysqldb', 'python-pip', 'libssl-dev', 'openssl', |
384 | - 'libffi-dev', 'apache2', 'pwgen', 'libxslt1-dev', |
385 | - 'python-psycopg2', 'zlib1g-dev', 'python-dev', 'libxml2-dev'], |
386 | + ['haproxy', 'unison', 'python-setuptools', 'python-keystoneclient', |
387 | + 'uuid', 'python-mysqldb', 'libmysqlclient-dev', 'libssl-dev', |
388 | + 'openssl', 'libffi-dev', 'apache2', 'python-pip', 'pwgen', |
389 | + 'python-six', 'libxslt1-dev', 'python-psycopg2', 'libyaml-dev', |
390 | + 'zlib1g-dev', 'python-dev', 'libxml2-dev'], |
391 | fatal=True) |
392 | self.git_install.assert_called_with(projects_yaml) |
393 | |
394 | |
395 | === modified file 'unit_tests/test_keystone_utils.py' |
396 | --- unit_tests/test_keystone_utils.py 2015-04-17 12:10:54 +0000 |
397 | +++ unit_tests/test_keystone_utils.py 2015-05-27 13:06:53 +0000 |
398 | @@ -42,6 +42,7 @@ |
399 | 'https', |
400 | 'is_relation_made', |
401 | 'peer_store', |
402 | + 'pip_install', |
403 | # generic |
404 | 'apt_update', |
405 | 'apt_upgrade', |
406 | @@ -656,26 +657,35 @@ |
407 | @patch.object(utils, 'git_src_dir') |
408 | @patch.object(utils, 'service_restart') |
409 | @patch.object(utils, 'render') |
410 | + @patch.object(utils, 'git_pip_venv_dir') |
411 | @patch('os.path.join') |
412 | @patch('os.path.exists') |
413 | + @patch('os.symlink') |
414 | @patch('shutil.copytree') |
415 | @patch('shutil.rmtree') |
416 | - def test_git_post_install(self, rmtree, copytree, exists, join, render, |
417 | - service_restart, git_src_dir): |
418 | + @patch('subprocess.check_call') |
419 | + def test_git_post_install(self, check_call, rmtree, copytree, symlink, |
420 | + exists, join, venv, render, service_restart, |
421 | + git_src_dir): |
422 | projects_yaml = openstack_origin_git |
423 | join.return_value = 'joined-string' |
424 | + venv.return_value = '/mnt/openstack-git/venv' |
425 | utils.git_post_install(projects_yaml) |
426 | expected = [ |
427 | call('joined-string', '/etc/keystone'), |
428 | ] |
429 | copytree.assert_has_calls(expected) |
430 | + expected = [ |
431 | + call('joined-string', '/usr/local/bin/keystone-manage'), |
432 | + ] |
433 | + symlink.assert_has_calls(expected, any_order=True) |
434 | keystone_context = { |
435 | 'service_description': 'Keystone API server', |
436 | 'service_name': 'Keystone', |
437 | 'user_name': 'keystone', |
438 | 'start_dir': '/var/lib/keystone', |
439 | 'process_name': 'keystone', |
440 | - 'executable_name': '/usr/local/bin/keystone-all', |
441 | + 'executable_name': 'joined-string', |
442 | 'config_files': ['/etc/keystone/keystone.conf'], |
443 | 'log_file': '/var/log/keystone/keystone.log', |
444 | } |
charm_lint_check #3821 keystone-next for corey.bryant mp257188
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/3821/