Merge lp:~corey.bryant/charms/trusty/nova-cloud-controller/git into lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next
- Trusty Tahr (14.04)
- git
- Merge into next
Status: | Superseded |
---|---|
Proposed branch: | lp:~corey.bryant/charms/trusty/nova-cloud-controller/git |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next |
Diff against target: |
1382 lines (+956/-74) 23 files modified
.bzrignore (+1/-0) Makefile (+5/-3) README.txt (+85/-0) actions.yaml (+2/-0) actions/git_reinstall.py (+45/-0) config.yaml (+16/-0) hooks/charmhelpers/contrib/openstack/utils.py (+4/-1) hooks/nova_cc_hooks.py (+17/-6) hooks/nova_cc_utils.py (+272/-1) templates/git/nova_sudoers (+4/-0) tests/10-basic-precise-essex (+0/-10) tests/11-basic-precise-folsom (+0/-18) tests/12-basic-precise-grizzly (+0/-12) tests/13-basic-precise-havana (+0/-12) tests/16-basic-trusty-icehouse-git (+10/-0) tests/17-basic-trusty-juno (+12/-0) tests/18-basic-trusty-juno-git (+13/-0) tests/basic_deployment.py (+25/-2) unit_tests/__init__.py (+2/-0) unit_tests/test_actions_git_reinstall.py (+107/-0) unit_tests/test_nova_cc_contexts.py (+1/-3) unit_tests/test_nova_cc_hooks.py (+55/-0) unit_tests/test_nova_cc_utils.py (+280/-6) |
To merge this branch: | bzr merge lp:~corey.bryant/charms/trusty/nova-cloud-controller/git |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenStack Charmers | Pending | ||
Review via email: mp+256298@code.launchpad.net |
Commit message
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3204 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3209 nova-cloud-
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3448 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3236 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3457 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3245 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3464 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3252 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3261 nova-cloud-
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 #3517 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3305 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #3272 nova-cloud-
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [test] Error 124
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #3541 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #3329 nova-cloud-
UNIT OK: passed
- 158. By Corey Bryant
-
Sync charm-helpers
- 159. By Corey Bryant
-
Add libffi-dev, libssl-dev, and libyaml-dev to base git install packages
- 160. By Corey Bryant
-
Add nova serial proxy upstart script
- 161. By Corey Bryant
-
Generalize neutron-db-manage and quantum-db-manage executable names as they may come from /usr/local/bin when deploying from source.
- 162. By Corey Bryant
-
Merge next branch
- 163. By Corey Bryant
-
Put base packages in correct list
- 164. By Corey Bryant
-
Sync charm-helpers
- 165. By Corey Bryant
-
Sync charm-helpers
- 166. By Corey Bryant
-
Install neutorn-common as python-six conflict workaround
- 167. By Corey Bryant
-
Sync charm-helpers
- 168. By Corey Bryant
-
Drop libffi-dev, libssl-dev, and libyaml-dev.
Unmerged revisions
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2014-07-02 08:22:25 +0000 | |||
3 | +++ .bzrignore 2015-04-16 19:34:57 +0000 | |||
4 | @@ -1,2 +1,3 @@ | |||
5 | 1 | bin | 1 | bin |
6 | 2 | .coverage | 2 | .coverage |
7 | 3 | tags | ||
8 | 3 | 4 | ||
9 | === modified file 'Makefile' | |||
10 | --- Makefile 2014-09-29 21:03:48 +0000 | |||
11 | +++ Makefile 2015-04-16 19:34:57 +0000 | |||
12 | @@ -2,7 +2,7 @@ | |||
13 | 2 | PYTHON := /usr/bin/env python | 2 | PYTHON := /usr/bin/env python |
14 | 3 | 3 | ||
15 | 4 | lint: | 4 | lint: |
17 | 5 | @flake8 --exclude hooks/charmhelpers hooks unit_tests tests | 5 | @flake8 --exclude hooks/charmhelpers actions hooks unit_tests tests |
18 | 6 | @charm proof | 6 | @charm proof |
19 | 7 | 7 | ||
20 | 8 | unit_test: | 8 | unit_test: |
21 | @@ -18,8 +18,10 @@ | |||
22 | 18 | # coreycb note: The -v should only be temporary until Amulet sends | 18 | # coreycb note: The -v should only be temporary until Amulet sends |
23 | 19 | # raise_status() messages to stderr: | 19 | # raise_status() messages to stderr: |
24 | 20 | # https://bugs.launchpad.net/amulet/+bug/1320357 | 20 | # https://bugs.launchpad.net/amulet/+bug/1320357 |
27 | 21 | @juju test -v -p AMULET_HTTP_PROXY --timeout 900 \ | 21 | @juju test -v -p AMULET_HTTP_PROXY --timeout 1200 \ |
28 | 22 | 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse | 22 | 00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse \ |
29 | 23 | 16-basic-trusty-icehouse-git 17-basic-trusty-juno \ | ||
30 | 24 | 18-basic-trusty-juno-git | ||
31 | 23 | 25 | ||
32 | 24 | sync: bin/charm_helpers_sync.py | 26 | sync: bin/charm_helpers_sync.py |
33 | 25 | @$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-hooks.yaml | 27 | @$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-hooks.yaml |
34 | 26 | 28 | ||
35 | === modified file 'README.txt' | |||
36 | --- README.txt 2014-07-30 10:49:59 +0000 | |||
37 | +++ README.txt 2015-04-16 19:34:57 +0000 | |||
38 | @@ -23,3 +23,88 @@ | |||
39 | 23 | 23 | ||
40 | 24 | juju add-relation "nova-cloud-controller:pgsql-nova-db" "postgresql:db" | 24 | juju add-relation "nova-cloud-controller:pgsql-nova-db" "postgresql:db" |
41 | 25 | juju add-relation "nova-cloud-controller:pgsql-neutron-db" "postgresql:db" | 25 | juju add-relation "nova-cloud-controller:pgsql-neutron-db" "postgresql:db" |
42 | 26 | |||
43 | 27 | Deploying from source | ||
44 | 28 | ===================== | ||
45 | 29 | |||
46 | 30 | The minimum openstack-origin-git config required to deploy from source is: | ||
47 | 31 | |||
48 | 32 | openstack-origin-git: | ||
49 | 33 | "repositories: | ||
50 | 34 | - {name: requirements, | ||
51 | 35 | repository: 'git://git.openstack.org/openstack/requirements', | ||
52 | 36 | branch: stable/juno} | ||
53 | 37 | - {name: nova, | ||
54 | 38 | repository: 'git://git.openstack.org/openstack/nova', | ||
55 | 39 | branch: stable/juno}" | ||
56 | 40 | |||
57 | 41 | Note that there are only two 'name' values the charm knows about: 'requirements' | ||
58 | 42 | and 'nova'. These repositories must correspond to these 'name' values. | ||
59 | 43 | Additionally, the requirements repository must be specified first and the | ||
60 | 44 | nova repository must be specified last. All other repostories are installed | ||
61 | 45 | in the order in which they are specified. | ||
62 | 46 | |||
63 | 47 | The following is a full list of current tip repos (may not be up-to-date): | ||
64 | 48 | |||
65 | 49 | openstack-origin-git: | ||
66 | 50 | "repositories: | ||
67 | 51 | - {name: requirements, | ||
68 | 52 | repository: 'git://git.openstack.org/openstack/requirements', | ||
69 | 53 | branch: master} | ||
70 | 54 | - {name: oslo-concurrency, | ||
71 | 55 | repository: 'git://git.openstack.org/openstack/oslo.concurrency', | ||
72 | 56 | branch: master} | ||
73 | 57 | - {name: oslo-config, | ||
74 | 58 | repository: 'git://git.openstack.org/openstack/oslo.config', | ||
75 | 59 | branch: master} | ||
76 | 60 | - {name: oslo-context, | ||
77 | 61 | repository: 'git://git.openstack.org/openstack/oslo.context.git', | ||
78 | 62 | branch: master} | ||
79 | 63 | - {name: oslo-db, | ||
80 | 64 | repository: 'git://git.openstack.org/openstack/oslo.db', | ||
81 | 65 | branch: master} | ||
82 | 66 | - {name: oslo-i18n, | ||
83 | 67 | repository: 'git://git.openstack.org/openstack/oslo.i18n', | ||
84 | 68 | branch: master} | ||
85 | 69 | - {name: oslo-log, | ||
86 | 70 | repository: 'git://git.openstack.org/openstack/oslo.log', | ||
87 | 71 | branch: master} | ||
88 | 72 | - {name: oslo-messaging, | ||
89 | 73 | repository: 'git://git.openstack.org/openstack/oslo.messaging.git', | ||
90 | 74 | branch: master} | ||
91 | 75 | - {name: oslo-middleware, | ||
92 | 76 | repository': 'git://git.openstack.org/openstack/oslo.middleware.git', | ||
93 | 77 | branch: master} | ||
94 | 78 | - {name: oslo-rootwrap', | ||
95 | 79 | repository: 'git://git.openstack.org/openstack/oslo.rootwrap.git', | ||
96 | 80 | branch: master} | ||
97 | 81 | - {name: oslo-serialization, | ||
98 | 82 | repository: 'git://git.openstack.org/openstack/oslo.serialization', | ||
99 | 83 | branch: master} | ||
100 | 84 | - {name: oslo-utils, | ||
101 | 85 | repository: 'git://git.openstack.org/openstack/oslo.utils', | ||
102 | 86 | branch: master} | ||
103 | 87 | - {name: pbr, | ||
104 | 88 | repository: 'git://git.openstack.org/openstack-dev/pbr', | ||
105 | 89 | branch: master} | ||
106 | 90 | - {name: stevedore, | ||
107 | 91 | repository: 'git://git.openstack.org/openstack/stevedore.git', | ||
108 | 92 | branch: 'master'} | ||
109 | 93 | - {name: sqlalchemy-migrate, | ||
110 | 94 | repository: 'git://git.openstack.org/stackforge/sqlalchemy-migrate', | ||
111 | 95 | branch: master} | ||
112 | 96 | - {name: python-cinderclient, | ||
113 | 97 | repository: 'git://git.openstack.org/openstack/python-cinderclient.git', | ||
114 | 98 | branch: master} | ||
115 | 99 | - {name: python-glanceclient, | ||
116 | 100 | repository': 'git://git.openstack.org/openstack/python-glanceclient.git', | ||
117 | 101 | branch: master} | ||
118 | 102 | - {name: python-neutronlient, | ||
119 | 103 | repository': 'git://git.openstack.org/openstack/python-neutronclient.git', | ||
120 | 104 | branch: master} | ||
121 | 105 | - {name: keystonemiddleware, | ||
122 | 106 | repository: 'git://git.openstack.org/openstack/keystonemiddleware', | ||
123 | 107 | branch: master} | ||
124 | 108 | - {name: nova, | ||
125 | 109 | repository: 'git://git.openstack.org/openstack/nova', | ||
126 | 110 | branch: master}" | ||
127 | 26 | 111 | ||
128 | === added directory 'actions' | |||
129 | === added file 'actions.yaml' | |||
130 | --- actions.yaml 1970-01-01 00:00:00 +0000 | |||
131 | +++ actions.yaml 2015-04-16 19:34:57 +0000 | |||
132 | @@ -0,0 +1,2 @@ | |||
133 | 1 | git-reinstall: | ||
134 | 2 | description: Reinstall nova-cloud-controller from the openstack-origin-git repositories. | ||
135 | 0 | 3 | ||
136 | === added symlink 'actions/git-reinstall' | |||
137 | === target is u'git_reinstall.py' | |||
138 | === added file 'actions/git_reinstall.py' | |||
139 | --- actions/git_reinstall.py 1970-01-01 00:00:00 +0000 | |||
140 | +++ actions/git_reinstall.py 2015-04-16 19:34:57 +0000 | |||
141 | @@ -0,0 +1,45 @@ | |||
142 | 1 | #!/usr/bin/python | ||
143 | 2 | import sys | ||
144 | 3 | import traceback | ||
145 | 4 | |||
146 | 5 | sys.path.append('hooks/') | ||
147 | 6 | |||
148 | 7 | from charmhelpers.contrib.openstack.utils import ( | ||
149 | 8 | git_install_requested, | ||
150 | 9 | ) | ||
151 | 10 | |||
152 | 11 | from charmhelpers.core.hookenv import ( | ||
153 | 12 | action_set, | ||
154 | 13 | action_fail, | ||
155 | 14 | config, | ||
156 | 15 | ) | ||
157 | 16 | |||
158 | 17 | from nova_cc_utils import ( | ||
159 | 18 | git_install, | ||
160 | 19 | ) | ||
161 | 20 | |||
162 | 21 | from nova_cc_hooks import ( | ||
163 | 22 | config_changed, | ||
164 | 23 | ) | ||
165 | 24 | |||
166 | 25 | |||
167 | 26 | def git_reinstall(): | ||
168 | 27 | """Reinstall from source and restart services. | ||
169 | 28 | |||
170 | 29 | If the openstack-origin-git config option was used to install openstack | ||
171 | 30 | from source git repositories, then this action can be used to reinstall | ||
172 | 31 | from updated git repositories, followed by a restart of services.""" | ||
173 | 32 | if not git_install_requested(): | ||
174 | 33 | action_fail('openstack-origin-git is not configured') | ||
175 | 34 | return | ||
176 | 35 | |||
177 | 36 | try: | ||
178 | 37 | git_install(config('openstack-origin-git')) | ||
179 | 38 | config_changed() | ||
180 | 39 | except: | ||
181 | 40 | action_set({'traceback': traceback.format_exc()}) | ||
182 | 41 | action_fail('git-reinstall resulted in an unexpected error') | ||
183 | 42 | |||
184 | 43 | |||
185 | 44 | if __name__ == '__main__': | ||
186 | 45 | git_reinstall() | ||
187 | 0 | 46 | ||
188 | === modified file 'config.yaml' | |||
189 | --- config.yaml 2015-04-13 08:49:59 +0000 | |||
190 | +++ config.yaml 2015-04-16 19:34:57 +0000 | |||
191 | @@ -14,6 +14,22 @@ | |||
192 | 14 | Note that updating this setting to a source that is known to | 14 | Note that updating this setting to a source that is known to |
193 | 15 | provide a later version of OpenStack will trigger a software | 15 | provide a later version of OpenStack will trigger a software |
194 | 16 | upgrade. | 16 | upgrade. |
195 | 17 | |||
196 | 18 | Note that when openstack-origin-git is specified, openstack | ||
197 | 19 | specific packages will be installed from source rather than | ||
198 | 20 | from the openstack-origin repository. | ||
199 | 21 | openstack-origin-git: | ||
200 | 22 | default: | ||
201 | 23 | type: string | ||
202 | 24 | description: | | ||
203 | 25 | Specifies a YAML-formatted dictionary listing the git | ||
204 | 26 | repositories and branches from which to install OpenStack and | ||
205 | 27 | its dependencies. | ||
206 | 28 | |||
207 | 29 | Note that the installed config files will be determined based on | ||
208 | 30 | the OpenStack release of the openstack-origin option. | ||
209 | 31 | |||
210 | 32 | For more details see README.md. | ||
211 | 17 | rabbit-user: | 33 | rabbit-user: |
212 | 18 | default: nova | 34 | default: nova |
213 | 19 | type: string | 35 | type: string |
214 | 20 | 36 | ||
215 | === modified file 'hooks/charmhelpers/contrib/openstack/utils.py' | |||
216 | --- hooks/charmhelpers/contrib/openstack/utils.py 2015-04-13 08:51:41 +0000 | |||
217 | +++ hooks/charmhelpers/contrib/openstack/utils.py 2015-04-16 19:34:57 +0000 | |||
218 | @@ -524,9 +524,10 @@ | |||
219 | 524 | projects = yaml.load(projects_yaml) | 524 | projects = yaml.load(projects_yaml) |
220 | 525 | _git_validate_projects_yaml(projects, core_project) | 525 | _git_validate_projects_yaml(projects, core_project) |
221 | 526 | 526 | ||
222 | 527 | old_environ = dict(os.environ) | ||
223 | 528 | |||
224 | 527 | if 'http_proxy' in projects.keys(): | 529 | if 'http_proxy' in projects.keys(): |
225 | 528 | os.environ['http_proxy'] = projects['http_proxy'] | 530 | os.environ['http_proxy'] = projects['http_proxy'] |
226 | 529 | |||
227 | 530 | if 'https_proxy' in projects.keys(): | 531 | if 'https_proxy' in projects.keys(): |
228 | 531 | os.environ['https_proxy'] = projects['https_proxy'] | 532 | os.environ['https_proxy'] = projects['https_proxy'] |
229 | 532 | 533 | ||
230 | @@ -544,6 +545,8 @@ | |||
231 | 544 | repo_dir = _git_clone_and_install_single(repo, branch, parent_dir, | 545 | repo_dir = _git_clone_and_install_single(repo, branch, parent_dir, |
232 | 545 | update_requirements=True) | 546 | update_requirements=True) |
233 | 546 | 547 | ||
234 | 548 | os.environ = old_environ | ||
235 | 549 | |||
236 | 547 | 550 | ||
237 | 548 | def _git_validate_projects_yaml(projects, core_project): | 551 | def _git_validate_projects_yaml(projects, core_project): |
238 | 549 | """ | 552 | """ |
239 | 550 | 553 | ||
240 | === modified file 'hooks/nova_cc_hooks.py' | |||
241 | --- hooks/nova_cc_hooks.py 2015-03-31 14:56:11 +0000 | |||
242 | +++ hooks/nova_cc_hooks.py 2015-04-16 19:34:57 +0000 | |||
243 | @@ -43,7 +43,9 @@ | |||
244 | 43 | ) | 43 | ) |
245 | 44 | 44 | ||
246 | 45 | from charmhelpers.contrib.openstack.utils import ( | 45 | from charmhelpers.contrib.openstack.utils import ( |
247 | 46 | config_value_changed, | ||
248 | 46 | configure_installation_source, | 47 | configure_installation_source, |
249 | 48 | git_install_requested, | ||
250 | 47 | openstack_upgrade_available, | 49 | openstack_upgrade_available, |
251 | 48 | os_release, | 50 | os_release, |
252 | 49 | os_requires_version, | 51 | os_requires_version, |
253 | @@ -75,6 +77,7 @@ | |||
254 | 75 | disable_services, | 77 | disable_services, |
255 | 76 | do_openstack_upgrade, | 78 | do_openstack_upgrade, |
256 | 77 | enable_services, | 79 | enable_services, |
257 | 80 | git_install, | ||
258 | 78 | keystone_ca_cert_b64, | 81 | keystone_ca_cert_b64, |
259 | 79 | migrate_neutron_database, | 82 | migrate_neutron_database, |
260 | 80 | migrate_nova_database, | 83 | migrate_nova_database, |
261 | @@ -132,9 +135,12 @@ | |||
262 | 132 | def install(): | 135 | def install(): |
263 | 133 | execd_preinstall() | 136 | execd_preinstall() |
264 | 134 | configure_installation_source(config('openstack-origin')) | 137 | configure_installation_source(config('openstack-origin')) |
265 | 138 | |||
266 | 135 | apt_update() | 139 | apt_update() |
267 | 136 | apt_install(determine_packages(), fatal=True) | 140 | apt_install(determine_packages(), fatal=True) |
268 | 137 | 141 | ||
269 | 142 | git_install(config('openstack-origin-git')) | ||
270 | 143 | |||
271 | 138 | _files = os.path.join(charm_dir(), 'files') | 144 | _files = os.path.join(charm_dir(), 'files') |
272 | 139 | if os.path.isdir(_files): | 145 | if os.path.isdir(_files): |
273 | 140 | for f in os.listdir(_files): | 146 | for f in os.listdir(_files): |
274 | @@ -160,16 +166,21 @@ | |||
275 | 160 | relation_prefix='nova') | 166 | relation_prefix='nova') |
276 | 161 | 167 | ||
277 | 162 | global CONFIGS | 168 | global CONFIGS |
282 | 163 | if openstack_upgrade_available('nova-common'): | 169 | if git_install_requested(): |
283 | 164 | CONFIGS = do_openstack_upgrade() | 170 | if config_value_changed('openstack-origin-git'): |
284 | 165 | [neutron_api_relation_joined(rid=rid, remote_restart=True) | 171 | git_install(config('openstack-origin-git')) |
285 | 166 | for rid in relation_ids('neutron-api')] | 172 | else: |
286 | 173 | if openstack_upgrade_available('nova-common'): | ||
287 | 174 | CONFIGS = do_openstack_upgrade() | ||
288 | 175 | [neutron_api_relation_joined(rid=rid, remote_restart=True) | ||
289 | 176 | for rid in relation_ids('neutron-api')] | ||
290 | 167 | save_script_rc() | 177 | save_script_rc() |
291 | 168 | configure_https() | 178 | configure_https() |
292 | 169 | CONFIGS.write_all() | 179 | CONFIGS.write_all() |
293 | 170 | if console_attributes('protocol'): | 180 | if console_attributes('protocol'): |
296 | 171 | apt_update() | 181 | if not git_install_requested(): |
297 | 172 | apt_install(console_attributes('packages'), fatal=True) | 182 | apt_update() |
298 | 183 | apt_install(console_attributes('packages'), fatal=True) | ||
299 | 173 | [compute_joined(rid=rid) | 184 | [compute_joined(rid=rid) |
300 | 174 | for rid in relation_ids('cloud-compute')] | 185 | for rid in relation_ids('cloud-compute')] |
301 | 175 | for r_id in relation_ids('identity-service'): | 186 | for r_id in relation_ids('identity-service'): |
302 | 176 | 187 | ||
303 | === modified file 'hooks/nova_cc_utils.py' | |||
304 | --- hooks/nova_cc_utils.py 2015-03-31 14:56:11 +0000 | |||
305 | +++ hooks/nova_cc_utils.py 2015-04-16 19:34:57 +0000 | |||
306 | @@ -1,4 +1,5 @@ | |||
307 | 1 | import os | 1 | import os |
308 | 2 | import shutil | ||
309 | 2 | import subprocess | 3 | import subprocess |
310 | 3 | import ConfigParser | 4 | import ConfigParser |
311 | 4 | 5 | ||
312 | @@ -19,6 +20,9 @@ | |||
313 | 19 | get_host_ip, | 20 | get_host_ip, |
314 | 20 | get_hostname, | 21 | get_hostname, |
315 | 21 | get_os_codename_install_source, | 22 | get_os_codename_install_source, |
316 | 23 | git_install_requested, | ||
317 | 24 | git_clone_and_install, | ||
318 | 25 | git_src_dir, | ||
319 | 22 | is_ip, | 26 | is_ip, |
320 | 23 | os_release, | 27 | os_release, |
321 | 24 | save_script_rc as _save_script_rc) | 28 | save_script_rc as _save_script_rc) |
322 | @@ -31,6 +35,7 @@ | |||
323 | 31 | ) | 35 | ) |
324 | 32 | 36 | ||
325 | 33 | from charmhelpers.core.hookenv import ( | 37 | from charmhelpers.core.hookenv import ( |
326 | 38 | charm_dir, | ||
327 | 34 | config, | 39 | config, |
328 | 35 | log, | 40 | log, |
329 | 36 | relation_get, | 41 | relation_get, |
330 | @@ -42,13 +47,19 @@ | |||
331 | 42 | ) | 47 | ) |
332 | 43 | 48 | ||
333 | 44 | from charmhelpers.core.host import ( | 49 | from charmhelpers.core.host import ( |
334 | 50 | adduser, | ||
335 | 51 | add_group, | ||
336 | 52 | add_user_to_group, | ||
337 | 53 | mkdir, | ||
338 | 45 | service, | 54 | service, |
339 | 46 | service_start, | 55 | service_start, |
340 | 47 | service_stop, | 56 | service_stop, |
341 | 48 | service_running, | 57 | service_running, |
343 | 49 | lsb_release | 58 | lsb_release, |
344 | 50 | ) | 59 | ) |
345 | 51 | 60 | ||
346 | 61 | from charmhelpers.core.templating import render | ||
347 | 62 | |||
348 | 52 | from charmhelpers.contrib.network.ip import ( | 63 | from charmhelpers.contrib.network.ip import ( |
349 | 53 | is_ipv6 | 64 | is_ipv6 |
350 | 54 | ) | 65 | ) |
351 | @@ -72,6 +83,41 @@ | |||
352 | 72 | 'python-memcache', | 83 | 'python-memcache', |
353 | 73 | ] | 84 | ] |
354 | 74 | 85 | ||
355 | 86 | BASE_GIT_PACKAGES = [ | ||
356 | 87 | 'libxml2-dev', | ||
357 | 88 | 'libxslt1-dev', | ||
358 | 89 | 'python-dev', | ||
359 | 90 | 'python-pip', | ||
360 | 91 | 'python-setuptools', | ||
361 | 92 | 'zlib1g-dev', | ||
362 | 93 | ] | ||
363 | 94 | |||
364 | 95 | LATE_GIT_PACKAGES = [ | ||
365 | 96 | 'novnc', | ||
366 | 97 | 'spice-html5', | ||
367 | 98 | 'websockify', | ||
368 | 99 | ] | ||
369 | 100 | |||
370 | 101 | # ubuntu packages that should not be installed when deploying from git | ||
371 | 102 | GIT_PACKAGE_BLACKLIST = [ | ||
372 | 103 | 'neutron-server', | ||
373 | 104 | 'neutron-plugin-ml2', | ||
374 | 105 | 'nova-api-ec2', | ||
375 | 106 | 'nova-api-os-compute', | ||
376 | 107 | 'nova-api-os-volume', | ||
377 | 108 | 'nova-cert', | ||
378 | 109 | 'nova-conductor', | ||
379 | 110 | 'nova-consoleauth', | ||
380 | 111 | 'nova-novncproxy', | ||
381 | 112 | 'nova-objectstore', | ||
382 | 113 | 'nova-scheduler', | ||
383 | 114 | 'nova-spiceproxy', | ||
384 | 115 | 'nova-xvpvncproxy', | ||
385 | 116 | 'python-keystoneclient', | ||
386 | 117 | 'python-six', | ||
387 | 118 | 'quantum-server', | ||
388 | 119 | ] | ||
389 | 120 | |||
390 | 75 | BASE_SERVICES = [ | 121 | BASE_SERVICES = [ |
391 | 76 | 'nova-api-ec2', | 122 | 'nova-api-ec2', |
392 | 77 | 'nova-api-os-compute', | 123 | 'nova-api-os-compute', |
393 | @@ -377,6 +423,15 @@ | |||
394 | 377 | packages.extend(pkgs) | 423 | packages.extend(pkgs) |
395 | 378 | if console_attributes('packages'): | 424 | if console_attributes('packages'): |
396 | 379 | packages.extend(console_attributes('packages')) | 425 | packages.extend(console_attributes('packages')) |
397 | 426 | |||
398 | 427 | if git_install_requested(): | ||
399 | 428 | packages = list(set(packages)) | ||
400 | 429 | packages.extend(BASE_GIT_PACKAGES) | ||
401 | 430 | # don't include packages that will be installed from git | ||
402 | 431 | for p in GIT_PACKAGE_BLACKLIST: | ||
403 | 432 | if p in packages: | ||
404 | 433 | packages.remove(p) | ||
405 | 434 | |||
406 | 380 | return list(set(packages)) | 435 | return list(set(packages)) |
407 | 381 | 436 | ||
408 | 382 | 437 | ||
409 | @@ -974,3 +1029,219 @@ | |||
410 | 974 | ' main') | 1029 | ' main') |
411 | 975 | apt_update() | 1030 | apt_update() |
412 | 976 | apt_install('haproxy/trusty-backports', fatal=True) | 1031 | apt_install('haproxy/trusty-backports', fatal=True) |
413 | 1032 | |||
414 | 1033 | |||
415 | 1034 | def git_install(projects_yaml): | ||
416 | 1035 | """Perform setup, and install git repos specified in yaml parameter.""" | ||
417 | 1036 | if git_install_requested(): | ||
418 | 1037 | git_pre_install() | ||
419 | 1038 | git_clone_and_install(projects_yaml, core_project='nova') | ||
420 | 1039 | git_post_install(projects_yaml) | ||
421 | 1040 | |||
422 | 1041 | |||
423 | 1042 | def git_pre_install(): | ||
424 | 1043 | """Perform pre-install setup.""" | ||
425 | 1044 | dirs = [ | ||
426 | 1045 | '/var/lib/nova', | ||
427 | 1046 | '/var/lib/nova/buckets', | ||
428 | 1047 | '/var/lib/nova/CA', | ||
429 | 1048 | '/var/lib/nova/CA/INTER', | ||
430 | 1049 | '/var/lib/nova/CA/newcerts', | ||
431 | 1050 | '/var/lib/nova/CA/private', | ||
432 | 1051 | '/var/lib/nova/CA/reqs', | ||
433 | 1052 | '/var/lib/nova/images', | ||
434 | 1053 | '/var/lib/nova/instances', | ||
435 | 1054 | '/var/lib/nova/keys', | ||
436 | 1055 | '/var/lib/nova/networks', | ||
437 | 1056 | '/var/lib/nova/tmp', | ||
438 | 1057 | '/var/lib/neutron', | ||
439 | 1058 | '/var/lib/neutron/lock', | ||
440 | 1059 | '/var/log/nova', | ||
441 | 1060 | '/etc/neutron', | ||
442 | 1061 | '/etc/neutron/plugins', | ||
443 | 1062 | '/etc/neutron/plugins/ml2', | ||
444 | 1063 | ] | ||
445 | 1064 | |||
446 | 1065 | adduser('nova', shell='/bin/bash', system_user=True) | ||
447 | 1066 | subprocess.check_call(['usermod', '--home', '/var/lib/nova', 'nova']) | ||
448 | 1067 | add_group('nova', system_group=True) | ||
449 | 1068 | add_user_to_group('nova', 'nova') | ||
450 | 1069 | |||
451 | 1070 | adduser('neutron', shell='/bin/bash', system_user=True) | ||
452 | 1071 | add_group('neutron', system_group=True) | ||
453 | 1072 | add_user_to_group('neutron', 'neutron') | ||
454 | 1073 | |||
455 | 1074 | for d in dirs: | ||
456 | 1075 | mkdir(d, owner='nova', group='nova', perms=0755, force=False) | ||
457 | 1076 | |||
458 | 1077 | |||
459 | 1078 | def git_post_install(projects_yaml): | ||
460 | 1079 | """Perform post-install setup.""" | ||
461 | 1080 | src_etc = os.path.join(git_src_dir(projects_yaml, 'nova'), 'etc/nova') | ||
462 | 1081 | configs = [ | ||
463 | 1082 | {'src': src_etc, | ||
464 | 1083 | 'dest': '/etc/nova'}, | ||
465 | 1084 | ] | ||
466 | 1085 | |||
467 | 1086 | for c in configs: | ||
468 | 1087 | if os.path.exists(c['dest']): | ||
469 | 1088 | shutil.rmtree(c['dest']) | ||
470 | 1089 | shutil.copytree(c['src'], c['dest']) | ||
471 | 1090 | |||
472 | 1091 | render('git/nova_sudoers', '/etc/sudoers.d/nova_sudoers', {}, perms=0o440) | ||
473 | 1092 | |||
474 | 1093 | nova_cc = 'nova-cloud-controller' | ||
475 | 1094 | nova_user = 'nova' | ||
476 | 1095 | start_dir = '/var/lib/nova' | ||
477 | 1096 | nova_conf = '/etc/nova/nova.conf' | ||
478 | 1097 | nova_ec2_api_context = { | ||
479 | 1098 | 'service_description': 'Nova EC2 API server', | ||
480 | 1099 | 'service_name': nova_cc, | ||
481 | 1100 | 'user_name': nova_user, | ||
482 | 1101 | 'start_dir': start_dir, | ||
483 | 1102 | 'process_name': 'nova-api-ec2', | ||
484 | 1103 | 'executable_name': '/usr/local/bin/nova-api-ec2', | ||
485 | 1104 | 'config_files': [nova_conf], | ||
486 | 1105 | } | ||
487 | 1106 | nova_api_os_compute_context = { | ||
488 | 1107 | 'service_description': 'Nova OpenStack Compute API server', | ||
489 | 1108 | 'service_name': nova_cc, | ||
490 | 1109 | 'user_name': nova_user, | ||
491 | 1110 | 'start_dir': start_dir, | ||
492 | 1111 | 'process_name': 'nova-api-os-compute', | ||
493 | 1112 | 'executable_name': '/usr/local/bin/nova-api-os-compute', | ||
494 | 1113 | 'config_files': [nova_conf], | ||
495 | 1114 | } | ||
496 | 1115 | nova_cells_context = { | ||
497 | 1116 | 'service_description': 'Nova cells', | ||
498 | 1117 | 'service_name': nova_cc, | ||
499 | 1118 | 'user_name': nova_user, | ||
500 | 1119 | 'start_dir': start_dir, | ||
501 | 1120 | 'process_name': 'nova-cells', | ||
502 | 1121 | 'executable_name': '/usr/local/bin/nova-cells', | ||
503 | 1122 | 'config_files': [nova_conf], | ||
504 | 1123 | } | ||
505 | 1124 | nova_cert_context = { | ||
506 | 1125 | 'service_description': 'Nova cert', | ||
507 | 1126 | 'service_name': nova_cc, | ||
508 | 1127 | 'user_name': nova_user, | ||
509 | 1128 | 'start_dir': start_dir, | ||
510 | 1129 | 'process_name': 'nova-cert', | ||
511 | 1130 | 'executable_name': '/usr/local/bin/nova-cert', | ||
512 | 1131 | 'config_files': [nova_conf], | ||
513 | 1132 | } | ||
514 | 1133 | nova_conductor_context = { | ||
515 | 1134 | 'service_description': 'Nova conductor', | ||
516 | 1135 | 'service_name': nova_cc, | ||
517 | 1136 | 'user_name': nova_user, | ||
518 | 1137 | 'start_dir': start_dir, | ||
519 | 1138 | 'process_name': 'nova-conductor', | ||
520 | 1139 | 'executable_name': '/usr/local/bin/nova-conductor', | ||
521 | 1140 | 'config_files': [nova_conf], | ||
522 | 1141 | } | ||
523 | 1142 | nova_consoleauth_context = { | ||
524 | 1143 | 'service_description': 'Nova console auth', | ||
525 | 1144 | 'service_name': nova_cc, | ||
526 | 1145 | 'user_name': nova_user, | ||
527 | 1146 | 'start_dir': start_dir, | ||
528 | 1147 | 'process_name': 'nova-consoleauth', | ||
529 | 1148 | 'executable_name': '/usr/local/bin/nova-consoleauth', | ||
530 | 1149 | 'config_files': [nova_conf], | ||
531 | 1150 | } | ||
532 | 1151 | nova_console_context = { | ||
533 | 1152 | 'service_description': 'Nova console', | ||
534 | 1153 | 'service_name': nova_cc, | ||
535 | 1154 | 'user_name': nova_user, | ||
536 | 1155 | 'start_dir': start_dir, | ||
537 | 1156 | 'process_name': 'nova-console', | ||
538 | 1157 | 'executable_name': '/usr/local/bin/nova-console', | ||
539 | 1158 | 'config_files': [nova_conf], | ||
540 | 1159 | } | ||
541 | 1160 | nova_novncproxy_context = { | ||
542 | 1161 | 'service_description': 'Nova NoVNC proxy', | ||
543 | 1162 | 'service_name': nova_cc, | ||
544 | 1163 | 'user_name': nova_user, | ||
545 | 1164 | 'start_dir': start_dir, | ||
546 | 1165 | 'process_name': 'nova-novncproxy', | ||
547 | 1166 | 'executable_name': '/usr/local/bin/nova-novncproxy', | ||
548 | 1167 | 'config_files': [nova_conf], | ||
549 | 1168 | } | ||
550 | 1169 | nova_objectstore_context = { | ||
551 | 1170 | 'service_description': 'Nova object store', | ||
552 | 1171 | 'service_name': nova_cc, | ||
553 | 1172 | 'user_name': nova_user, | ||
554 | 1173 | 'start_dir': start_dir, | ||
555 | 1174 | 'process_name': 'nova-objectstore', | ||
556 | 1175 | 'executable_name': '/usr/local/bin/nova-objectstore', | ||
557 | 1176 | 'config_files': [nova_conf], | ||
558 | 1177 | } | ||
559 | 1178 | nova_scheduler_context = { | ||
560 | 1179 | 'service_description': 'Nova scheduler', | ||
561 | 1180 | 'service_name': nova_cc, | ||
562 | 1181 | 'user_name': nova_user, | ||
563 | 1182 | 'start_dir': start_dir, | ||
564 | 1183 | 'process_name': 'nova-scheduler', | ||
565 | 1184 | 'executable_name': '/usr/local/bin/nova-scheduler', | ||
566 | 1185 | 'config_files': [nova_conf], | ||
567 | 1186 | } | ||
568 | 1187 | nova_spiceproxy_context = { | ||
569 | 1188 | 'service_description': 'Nova spice proxy', | ||
570 | 1189 | 'service_name': nova_cc, | ||
571 | 1190 | 'user_name': nova_user, | ||
572 | 1191 | 'start_dir': start_dir, | ||
573 | 1192 | 'process_name': 'nova-spicehtml5proxy', | ||
574 | 1193 | 'executable_name': '/usr/local/bin/nova-spicehtml5proxy', | ||
575 | 1194 | 'config_files': [nova_conf], | ||
576 | 1195 | } | ||
577 | 1196 | nova_xvpvncproxy_context = { | ||
578 | 1197 | 'service_description': 'Nova XVPVNC proxy', | ||
579 | 1198 | 'service_name': nova_cc, | ||
580 | 1199 | 'user_name': nova_user, | ||
581 | 1200 | 'start_dir': start_dir, | ||
582 | 1201 | 'process_name': 'nova-xvpvncproxy', | ||
583 | 1202 | 'executable_name': '/usr/local/bin/nova-xvpvncproxy', | ||
584 | 1203 | 'config_files': [nova_conf], | ||
585 | 1204 | } | ||
586 | 1205 | |||
587 | 1206 | # NOTE(coreycb): Needs systemd support | ||
588 | 1207 | templates_dir = 'hooks/charmhelpers/contrib/openstack/templates' | ||
589 | 1208 | templates_dir = os.path.join(charm_dir(), templates_dir) | ||
590 | 1209 | render('git.upstart', '/etc/init/nova-api-ec2.conf', | ||
591 | 1210 | nova_ec2_api_context, perms=0o644, | ||
592 | 1211 | templates_dir=templates_dir) | ||
593 | 1212 | render('git.upstart', '/etc/init/nova-api-os-compute.conf', | ||
594 | 1213 | nova_api_os_compute_context, perms=0o644, | ||
595 | 1214 | templates_dir=templates_dir) | ||
596 | 1215 | render('git.upstart', '/etc/init/nova-cells.conf', | ||
597 | 1216 | nova_cells_context, perms=0o644, | ||
598 | 1217 | templates_dir=templates_dir) | ||
599 | 1218 | render('git.upstart', '/etc/init/nova-cert.conf', | ||
600 | 1219 | nova_cert_context, perms=0o644, | ||
601 | 1220 | templates_dir=templates_dir) | ||
602 | 1221 | render('git.upstart', '/etc/init/nova-conductor.conf', | ||
603 | 1222 | nova_conductor_context, perms=0o644, | ||
604 | 1223 | templates_dir=templates_dir) | ||
605 | 1224 | render('git.upstart', '/etc/init/nova-consoleauth.conf', | ||
606 | 1225 | nova_consoleauth_context, perms=0o644, | ||
607 | 1226 | templates_dir=templates_dir) | ||
608 | 1227 | render('git.upstart', '/etc/init/nova-console.conf', | ||
609 | 1228 | nova_console_context, perms=0o644, | ||
610 | 1229 | templates_dir=templates_dir) | ||
611 | 1230 | render('git.upstart', '/etc/init/nova-novncproxy.conf', | ||
612 | 1231 | nova_novncproxy_context, perms=0o644, | ||
613 | 1232 | templates_dir=templates_dir) | ||
614 | 1233 | render('git.upstart', '/etc/init/nova-objectstore.conf', | ||
615 | 1234 | nova_objectstore_context, perms=0o644, | ||
616 | 1235 | templates_dir=templates_dir) | ||
617 | 1236 | render('git.upstart', '/etc/init/nova-scheduler.conf', | ||
618 | 1237 | nova_scheduler_context, perms=0o644, | ||
619 | 1238 | templates_dir=templates_dir) | ||
620 | 1239 | render('git.upstart', '/etc/init/nova-spiceproxy.conf', | ||
621 | 1240 | nova_spiceproxy_context, perms=0o644, | ||
622 | 1241 | templates_dir=templates_dir) | ||
623 | 1242 | render('git.upstart', '/etc/init/nova-xvpvncproxy.conf', | ||
624 | 1243 | nova_xvpvncproxy_context, perms=0o644, | ||
625 | 1244 | templates_dir=templates_dir) | ||
626 | 1245 | |||
627 | 1246 | apt_update() | ||
628 | 1247 | apt_install(LATE_GIT_PACKAGES, fatal=True) | ||
629 | 977 | 1248 | ||
630 | === added directory 'templates/git' | |||
631 | === added file 'templates/git/nova_sudoers' | |||
632 | --- templates/git/nova_sudoers 1970-01-01 00:00:00 +0000 | |||
633 | +++ templates/git/nova_sudoers 2015-04-16 19:34:57 +0000 | |||
634 | @@ -0,0 +1,4 @@ | |||
635 | 1 | Defaults:nova !requiretty | ||
636 | 2 | |||
637 | 3 | nova ALL = (root) NOPASSWD: /usr/local/bin/nova-rootwrap /etc/nova/rootwrap.conf * | ||
638 | 4 | |||
639 | 0 | 5 | ||
640 | === removed file 'tests/10-basic-precise-essex' | |||
641 | --- tests/10-basic-precise-essex 2014-07-11 17:34:39 +0000 | |||
642 | +++ tests/10-basic-precise-essex 1970-01-01 00:00:00 +0000 | |||
643 | @@ -1,10 +0,0 @@ | |||
644 | 1 | #!/usr/bin/python | ||
645 | 2 | |||
646 | 3 | """Amulet tests on a basic nova cloud controller deployment on | ||
647 | 4 | precise-essex.""" | ||
648 | 5 | |||
649 | 6 | from basic_deployment import NovaCCBasicDeployment | ||
650 | 7 | |||
651 | 8 | if __name__ == '__main__': | ||
652 | 9 | deployment = NovaCCBasicDeployment(series='precise') | ||
653 | 10 | deployment.run_tests() | ||
654 | 11 | 0 | ||
655 | === removed file 'tests/11-basic-precise-folsom' | |||
656 | --- tests/11-basic-precise-folsom 2014-07-11 17:34:39 +0000 | |||
657 | +++ tests/11-basic-precise-folsom 1970-01-01 00:00:00 +0000 | |||
658 | @@ -1,18 +0,0 @@ | |||
659 | 1 | #!/usr/bin/python | ||
660 | 2 | |||
661 | 3 | """Amulet tests on a basic nova cloud controller deployment on | ||
662 | 4 | precise-folsom.""" | ||
663 | 5 | |||
664 | 6 | import amulet | ||
665 | 7 | from basic_deployment import NovaCCBasicDeployment | ||
666 | 8 | |||
667 | 9 | if __name__ == '__main__': | ||
668 | 10 | # NOTE(coreycb): Skipping failing test until resolved. 'nova-manage db sync' | ||
669 | 11 | # fails in shared-db-relation-changed (only fails on folsom) | ||
670 | 12 | message = "Skipping failing test until resolved" | ||
671 | 13 | amulet.raise_status(amulet.SKIP, msg=message) | ||
672 | 14 | |||
673 | 15 | deployment = NovaCCBasicDeployment(series='precise', | ||
674 | 16 | openstack='cloud:precise-folsom', | ||
675 | 17 | source='cloud:precise-updates/folsom') | ||
676 | 18 | deployment.run_tests() | ||
677 | 19 | 0 | ||
678 | === removed file 'tests/12-basic-precise-grizzly' | |||
679 | --- tests/12-basic-precise-grizzly 2014-07-11 17:34:39 +0000 | |||
680 | +++ tests/12-basic-precise-grizzly 1970-01-01 00:00:00 +0000 | |||
681 | @@ -1,12 +0,0 @@ | |||
682 | 1 | #!/usr/bin/python | ||
683 | 2 | |||
684 | 3 | """Amulet tests on a basic nova cloud controller deployment on | ||
685 | 4 | precise-grizzly.""" | ||
686 | 5 | |||
687 | 6 | from basic_deployment import NovaCCBasicDeployment | ||
688 | 7 | |||
689 | 8 | if __name__ == '__main__': | ||
690 | 9 | deployment = NovaCCBasicDeployment(series='precise', | ||
691 | 10 | openstack='cloud:precise-grizzly', | ||
692 | 11 | source='cloud:precise-updates/grizzly') | ||
693 | 12 | deployment.run_tests() | ||
694 | 13 | 0 | ||
695 | === removed file 'tests/13-basic-precise-havana' | |||
696 | --- tests/13-basic-precise-havana 2014-07-11 17:34:39 +0000 | |||
697 | +++ tests/13-basic-precise-havana 1970-01-01 00:00:00 +0000 | |||
698 | @@ -1,12 +0,0 @@ | |||
699 | 1 | #!/usr/bin/python | ||
700 | 2 | |||
701 | 3 | """Amulet tests on a basic nova cloud controller deployment on | ||
702 | 4 | precise-havana.""" | ||
703 | 5 | |||
704 | 6 | from basic_deployment import NovaCCBasicDeployment | ||
705 | 7 | |||
706 | 8 | if __name__ == '__main__': | ||
707 | 9 | deployment = NovaCCBasicDeployment(series='precise', | ||
708 | 10 | openstack='cloud:precise-havana', | ||
709 | 11 | source='cloud:precise-updates/havana') | ||
710 | 12 | deployment.run_tests() | ||
711 | 13 | 0 | ||
712 | === added file 'tests/16-basic-trusty-icehouse-git' | |||
713 | --- tests/16-basic-trusty-icehouse-git 1970-01-01 00:00:00 +0000 | |||
714 | +++ tests/16-basic-trusty-icehouse-git 2015-04-16 19:34:57 +0000 | |||
715 | @@ -0,0 +1,10 @@ | |||
716 | 1 | #!/usr/bin/python | ||
717 | 2 | |||
718 | 3 | """Amulet tests on a basic nova cloud controller git deployment on | ||
719 | 4 | trusty-icehouse.""" | ||
720 | 5 | |||
721 | 6 | from basic_deployment import NovaCCBasicDeployment | ||
722 | 7 | |||
723 | 8 | if __name__ == '__main__': | ||
724 | 9 | deployment = NovaCCBasicDeployment(series='trusty', git=True) | ||
725 | 10 | deployment.run_tests() | ||
726 | 0 | 11 | ||
727 | === added file 'tests/17-basic-trusty-juno' | |||
728 | --- tests/17-basic-trusty-juno 1970-01-01 00:00:00 +0000 | |||
729 | +++ tests/17-basic-trusty-juno 2015-04-16 19:34:57 +0000 | |||
730 | @@ -0,0 +1,12 @@ | |||
731 | 1 | #!/usr/bin/python | ||
732 | 2 | |||
733 | 3 | """Amulet tests on a basic nova cloud controller deployment on | ||
734 | 4 | trusty-juno.""" | ||
735 | 5 | |||
736 | 6 | from basic_deployment import NovaCCBasicDeployment | ||
737 | 7 | |||
738 | 8 | if __name__ == '__main__': | ||
739 | 9 | deployment = NovaCCBasicDeployment(series='trusty', | ||
740 | 10 | openstack='cloud:trusty-juno', | ||
741 | 11 | source='cloud:trusty-updates/juno') | ||
742 | 12 | deployment.run_tests() | ||
743 | 0 | 13 | ||
744 | === added file 'tests/18-basic-trusty-juno-git' | |||
745 | --- tests/18-basic-trusty-juno-git 1970-01-01 00:00:00 +0000 | |||
746 | +++ tests/18-basic-trusty-juno-git 2015-04-16 19:34:57 +0000 | |||
747 | @@ -0,0 +1,13 @@ | |||
748 | 1 | #!/usr/bin/python | ||
749 | 2 | |||
750 | 3 | """Amulet tests on a basic nova cloud controller git deployment on | ||
751 | 4 | trusty-juno.""" | ||
752 | 5 | |||
753 | 6 | from basic_deployment import NovaCCBasicDeployment | ||
754 | 7 | |||
755 | 8 | if __name__ == '__main__': | ||
756 | 9 | deployment = NovaCCBasicDeployment(series='trusty', | ||
757 | 10 | openstack='cloud:trusty-juno', | ||
758 | 11 | source='cloud:trusty-updates/juno', | ||
759 | 12 | git=True) | ||
760 | 13 | deployment.run_tests() | ||
761 | 0 | 14 | ||
762 | === modified file 'tests/basic_deployment.py' | |||
763 | --- tests/basic_deployment.py 2015-04-14 01:14:46 +0000 | |||
764 | +++ tests/basic_deployment.py 2015-04-16 19:34:57 +0000 | |||
765 | @@ -1,6 +1,8 @@ | |||
766 | 1 | #!/usr/bin/python | 1 | #!/usr/bin/python |
767 | 2 | 2 | ||
768 | 3 | import amulet | 3 | import amulet |
769 | 4 | import os | ||
770 | 5 | import yaml | ||
771 | 4 | 6 | ||
772 | 5 | from charmhelpers.contrib.openstack.amulet.deployment import ( | 7 | from charmhelpers.contrib.openstack.amulet.deployment import ( |
773 | 6 | OpenStackAmuletDeployment | 8 | OpenStackAmuletDeployment |
774 | @@ -19,9 +21,11 @@ | |||
775 | 19 | class NovaCCBasicDeployment(OpenStackAmuletDeployment): | 21 | class NovaCCBasicDeployment(OpenStackAmuletDeployment): |
776 | 20 | """Amulet tests on a basic nova cloud controller deployment.""" | 22 | """Amulet tests on a basic nova cloud controller deployment.""" |
777 | 21 | 23 | ||
779 | 22 | def __init__(self, series=None, openstack=None, source=None, stable=False): | 24 | def __init__(self, series=None, openstack=None, source=None, git=False, |
780 | 25 | stable=False): | ||
781 | 23 | """Deploy the entire test environment.""" | 26 | """Deploy the entire test environment.""" |
782 | 24 | super(NovaCCBasicDeployment, self).__init__(series, openstack, source, stable) | 27 | super(NovaCCBasicDeployment, self).__init__(series, openstack, source, stable) |
783 | 28 | self.git = git | ||
784 | 25 | self._add_services() | 29 | self._add_services() |
785 | 26 | self._add_relations() | 30 | self._add_relations() |
786 | 27 | self._configure_services() | 31 | self._configure_services() |
787 | @@ -62,9 +66,28 @@ | |||
788 | 62 | 66 | ||
789 | 63 | def _configure_services(self): | 67 | def _configure_services(self): |
790 | 64 | """Configure all of the services.""" | 68 | """Configure all of the services.""" |
791 | 69 | nova_cc_config = {} | ||
792 | 70 | if self.git: | ||
793 | 71 | branch = 'stable/' + self._get_openstack_release_string() | ||
794 | 72 | amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY') | ||
795 | 73 | openstack_origin_git = { | ||
796 | 74 | 'repositories': [ | ||
797 | 75 | {'name': 'requirements', | ||
798 | 76 | 'repository': 'git://git.openstack.org/openstack/requirements', | ||
799 | 77 | 'branch': branch}, | ||
800 | 78 | {'name': 'nova', | ||
801 | 79 | 'repository': 'git://git.openstack.org/openstack/nova', | ||
802 | 80 | 'branch': branch}, | ||
803 | 81 | ], | ||
804 | 82 | 'directory': '/mnt/openstack-git', | ||
805 | 83 | 'http_proxy': amulet_http_proxy, | ||
806 | 84 | 'https_proxy': amulet_http_proxy, | ||
807 | 85 | } | ||
808 | 86 | nova_cc_config['openstack-origin-git'] = yaml.dump(openstack_origin_git) | ||
809 | 65 | keystone_config = {'admin-password': 'openstack', | 87 | keystone_config = {'admin-password': 'openstack', |
810 | 66 | 'admin-token': 'ubuntutesting'} | 88 | 'admin-token': 'ubuntutesting'} |
812 | 67 | configs = {'keystone': keystone_config} | 89 | configs = {'nova-cloud-controller': nova_cc_config, |
813 | 90 | 'keystone': keystone_config} | ||
814 | 68 | super(NovaCCBasicDeployment, self)._configure_services(configs) | 91 | super(NovaCCBasicDeployment, self)._configure_services(configs) |
815 | 69 | 92 | ||
816 | 70 | def _initialize_tests(self): | 93 | def _initialize_tests(self): |
817 | 71 | 94 | ||
818 | === modified file 'unit_tests/__init__.py' | |||
819 | --- unit_tests/__init__.py 2013-08-02 03:42:16 +0000 | |||
820 | +++ unit_tests/__init__.py 2015-04-16 19:34:57 +0000 | |||
821 | @@ -1,2 +1,4 @@ | |||
822 | 1 | import sys | 1 | import sys |
823 | 2 | |||
824 | 3 | sys.path.append('actions/') | ||
825 | 2 | sys.path.append('hooks/') | 4 | sys.path.append('hooks/') |
826 | 3 | 5 | ||
827 | === added file 'unit_tests/test_actions_git_reinstall.py' | |||
828 | --- unit_tests/test_actions_git_reinstall.py 1970-01-01 00:00:00 +0000 | |||
829 | +++ unit_tests/test_actions_git_reinstall.py 2015-04-16 19:34:57 +0000 | |||
830 | @@ -0,0 +1,107 @@ | |||
831 | 1 | from mock import patch, MagicMock | ||
832 | 2 | |||
833 | 3 | with patch('charmhelpers.core.hookenv.config') as config: | ||
834 | 4 | config.return_value = 'nova' | ||
835 | 5 | import nova_cc_utils as utils # noqa | ||
836 | 6 | |||
837 | 7 | _reg = utils.register_configs | ||
838 | 8 | _map = utils.restart_map | ||
839 | 9 | |||
840 | 10 | utils.register_configs = MagicMock() | ||
841 | 11 | utils.restart_map = MagicMock() | ||
842 | 12 | |||
843 | 13 | with patch('nova_cc_utils.guard_map') as gmap: | ||
844 | 14 | with patch('charmhelpers.core.hookenv.config') as config: | ||
845 | 15 | config.return_value = False | ||
846 | 16 | gmap.return_value = {} | ||
847 | 17 | import git_reinstall | ||
848 | 18 | |||
849 | 19 | utils.register_configs = _reg | ||
850 | 20 | utils.restart_map = _map | ||
851 | 21 | |||
852 | 22 | from test_utils import ( | ||
853 | 23 | CharmTestCase | ||
854 | 24 | ) | ||
855 | 25 | |||
856 | 26 | TO_PATCH = [ | ||
857 | 27 | 'config', | ||
858 | 28 | ] | ||
859 | 29 | |||
860 | 30 | |||
861 | 31 | openstack_origin_git = \ | ||
862 | 32 | """repositories: | ||
863 | 33 | - {name: requirements, | ||
864 | 34 | repository: 'git://git.openstack.org/openstack/requirements', | ||
865 | 35 | branch: stable/juno} | ||
866 | 36 | - {name: nova, | ||
867 | 37 | repository: 'git://git.openstack.org/openstack/nova', | ||
868 | 38 | branch: stable/juno}""" | ||
869 | 39 | |||
870 | 40 | |||
871 | 41 | class TestnovaAPIActions(CharmTestCase): | ||
872 | 42 | |||
873 | 43 | def setUp(self): | ||
874 | 44 | super(TestnovaAPIActions, self).setUp(git_reinstall, TO_PATCH) | ||
875 | 45 | self.config.side_effect = self.test_config.get | ||
876 | 46 | |||
877 | 47 | @patch.object(git_reinstall, 'action_set') | ||
878 | 48 | @patch.object(git_reinstall, 'action_fail') | ||
879 | 49 | @patch.object(git_reinstall, 'git_install') | ||
880 | 50 | @patch.object(git_reinstall, 'config_changed') | ||
881 | 51 | def test_git_reinstall(self, config_changed, git_install, action_fail, | ||
882 | 52 | action_set): | ||
883 | 53 | self.test_config.set('openstack-origin-git', openstack_origin_git) | ||
884 | 54 | |||
885 | 55 | git_reinstall.git_reinstall() | ||
886 | 56 | |||
887 | 57 | git_install.assert_called_with(openstack_origin_git) | ||
888 | 58 | self.assertTrue(git_install.called) | ||
889 | 59 | self.assertTrue(config_changed.called) | ||
890 | 60 | self.assertFalse(action_set.called) | ||
891 | 61 | self.assertFalse(action_fail.called) | ||
892 | 62 | |||
893 | 63 | @patch.object(git_reinstall, 'action_set') | ||
894 | 64 | @patch.object(git_reinstall, 'action_fail') | ||
895 | 65 | @patch.object(git_reinstall, 'git_install') | ||
896 | 66 | @patch.object(git_reinstall, 'config_changed') | ||
897 | 67 | @patch('charmhelpers.contrib.openstack.utils.config') | ||
898 | 68 | def test_git_reinstall_not_configured(self, _config, config_changed, | ||
899 | 69 | git_install, action_fail, | ||
900 | 70 | action_set): | ||
901 | 71 | _config.return_value = None | ||
902 | 72 | |||
903 | 73 | git_reinstall.git_reinstall() | ||
904 | 74 | |||
905 | 75 | msg = 'openstack-origin-git is not configured' | ||
906 | 76 | action_fail.assert_called_with(msg) | ||
907 | 77 | self.assertFalse(git_install.called) | ||
908 | 78 | self.assertFalse(action_set.called) | ||
909 | 79 | |||
910 | 80 | @patch.object(git_reinstall, 'action_set') | ||
911 | 81 | @patch.object(git_reinstall, 'action_fail') | ||
912 | 82 | @patch.object(git_reinstall, 'git_install') | ||
913 | 83 | @patch.object(git_reinstall, 'config_changed') | ||
914 | 84 | @patch('traceback.format_exc') | ||
915 | 85 | @patch('charmhelpers.contrib.openstack.utils.config') | ||
916 | 86 | def test_git_reinstall_exception(self, _config, format_exc, | ||
917 | 87 | config_changed, git_install, action_fail, | ||
918 | 88 | action_set): | ||
919 | 89 | _config.return_value = openstack_origin_git | ||
920 | 90 | e = OSError('something bad happened') | ||
921 | 91 | git_install.side_effect = e | ||
922 | 92 | traceback = ( | ||
923 | 93 | "Traceback (most recent call last):\n" | ||
924 | 94 | " File \"actions/git_reinstall.py\", line 37, in git_reinstall\n" | ||
925 | 95 | " git_install(config(\'openstack-origin-git\'))\n" | ||
926 | 96 | " File \"/usr/lib/python2.7/dist-packages/mock.py\", line 964, in __call__\n" # noqa | ||
927 | 97 | " return _mock_self._mock_call(*args, **kwargs)\n" | ||
928 | 98 | " File \"/usr/lib/python2.7/dist-packages/mock.py\", line 1019, in _mock_call\n" # noqa | ||
929 | 99 | " raise effect\n" | ||
930 | 100 | "OSError: something bad happened\n") | ||
931 | 101 | format_exc.return_value = traceback | ||
932 | 102 | |||
933 | 103 | git_reinstall.git_reinstall() | ||
934 | 104 | |||
935 | 105 | msg = 'git-reinstall resulted in an unexpected error' | ||
936 | 106 | action_fail.assert_called_with(msg) | ||
937 | 107 | action_set.assert_called_with({'traceback': traceback}) | ||
938 | 0 | 108 | ||
939 | === modified file 'unit_tests/test_nova_cc_contexts.py' | |||
940 | --- unit_tests/test_nova_cc_contexts.py 2015-04-08 12:10:09 +0000 | |||
941 | +++ unit_tests/test_nova_cc_contexts.py 2015-04-16 19:34:57 +0000 | |||
942 | @@ -9,9 +9,7 @@ | |||
943 | 9 | from charmhelpers.core import hookenv | 9 | from charmhelpers.core import hookenv |
944 | 10 | _conf = hookenv.config | 10 | _conf = hookenv.config |
945 | 11 | hookenv.config = mock.MagicMock() | 11 | hookenv.config = mock.MagicMock() |
949 | 12 | import nova_cc_utils as _utils | 12 | import nova_cc_utils as _utils # noqa |
947 | 13 | # this assert is a double check + to avoid pep8 warning | ||
948 | 14 | assert _utils.config == hookenv.config | ||
950 | 15 | hookenv.config = _conf | 13 | hookenv.config = _conf |
951 | 16 | ##### | 14 | ##### |
952 | 17 | 15 | ||
953 | 18 | 16 | ||
954 | === modified file 'unit_tests/test_nova_cc_hooks.py' | |||
955 | --- unit_tests/test_nova_cc_hooks.py 2015-03-31 14:56:11 +0000 | |||
956 | +++ unit_tests/test_nova_cc_hooks.py 2015-04-16 19:34:57 +0000 | |||
957 | @@ -1,6 +1,7 @@ | |||
958 | 1 | from mock import MagicMock, patch, call | 1 | from mock import MagicMock, patch, call |
959 | 2 | from test_utils import CharmTestCase, patch_open | 2 | from test_utils import CharmTestCase, patch_open |
960 | 3 | import os | 3 | import os |
961 | 4 | import yaml | ||
962 | 4 | 5 | ||
963 | 5 | with patch('charmhelpers.core.hookenv.config') as config: | 6 | with patch('charmhelpers.core.hookenv.config') as config: |
964 | 6 | config.return_value = 'neutron' | 7 | config.return_value = 'neutron' |
965 | @@ -69,6 +70,8 @@ | |||
966 | 69 | 'get_iface_for_address', | 70 | 'get_iface_for_address', |
967 | 70 | 'get_netmask_for_address', | 71 | 'get_netmask_for_address', |
968 | 71 | 'update_nrpe_config', | 72 | 'update_nrpe_config', |
969 | 73 | 'git_install', | ||
970 | 74 | 'git_install_requested', | ||
971 | 72 | ] | 75 | ] |
972 | 73 | 76 | ||
973 | 74 | 77 | ||
974 | @@ -106,18 +109,70 @@ | |||
975 | 106 | self.disable_services.assert_called() | 109 | self.disable_services.assert_called() |
976 | 107 | self.cmd_all_services.assert_called_with('stop') | 110 | self.cmd_all_services.assert_called_with('stop') |
977 | 108 | 111 | ||
978 | 112 | def test_install_hook_git(self): | ||
979 | 113 | self.git_install_requested.return_value = True | ||
980 | 114 | self.determine_packages.return_value = ['foo', 'bar'] | ||
981 | 115 | self.determine_ports.return_value = [80, 81, 82] | ||
982 | 116 | repo = 'cloud:trusty-juno' | ||
983 | 117 | openstack_origin_git = { | ||
984 | 118 | 'repositories': [ | ||
985 | 119 | {'name': 'requirements', | ||
986 | 120 | 'repository': 'git://git.openstack.org/openstack/requirements', # noqa | ||
987 | 121 | 'branch': 'stable/juno'}, | ||
988 | 122 | {'name': 'nova', | ||
989 | 123 | 'repository': 'git://git.openstack.org/openstack/nova', | ||
990 | 124 | 'branch': 'stable/juno'} | ||
991 | 125 | ], | ||
992 | 126 | 'directory': '/mnt/openstack-git', | ||
993 | 127 | } | ||
994 | 128 | projects_yaml = yaml.dump(openstack_origin_git) | ||
995 | 129 | self.test_config.set('openstack-origin', repo) | ||
996 | 130 | self.test_config.set('openstack-origin-git', projects_yaml) | ||
997 | 131 | hooks.install() | ||
998 | 132 | self.git_install.assert_called_with(projects_yaml) | ||
999 | 133 | self.apt_install.assert_called_with(['foo', 'bar'], fatal=True) | ||
1000 | 134 | self.execd_preinstall.assert_called() | ||
1001 | 135 | self.disable_services.assert_called() | ||
1002 | 136 | self.cmd_all_services.assert_called_with('stop') | ||
1003 | 137 | |||
1004 | 109 | @patch.object(hooks, 'configure_https') | 138 | @patch.object(hooks, 'configure_https') |
1005 | 110 | def test_config_changed_no_upgrade(self, conf_https): | 139 | def test_config_changed_no_upgrade(self, conf_https): |
1006 | 140 | self.git_install_requested.return_value = False | ||
1007 | 111 | self.openstack_upgrade_available.return_value = False | 141 | self.openstack_upgrade_available.return_value = False |
1008 | 112 | hooks.config_changed() | 142 | hooks.config_changed() |
1009 | 113 | self.assertTrue(self.save_script_rc.called) | 143 | self.assertTrue(self.save_script_rc.called) |
1010 | 114 | 144 | ||
1011 | 145 | @patch.object(hooks, 'config_value_changed') | ||
1012 | 146 | @patch.object(hooks, 'configure_https') | ||
1013 | 147 | def test_config_changed_git(self, configure_https, config_val_changed): | ||
1014 | 148 | self.git_install_requested.return_value = True | ||
1015 | 149 | repo = 'cloud:trusty-juno' | ||
1016 | 150 | openstack_origin_git = { | ||
1017 | 151 | 'repositories': [ | ||
1018 | 152 | {'name': 'requirements', | ||
1019 | 153 | 'repository': | ||
1020 | 154 | 'git://git.openstack.org/openstack/requirements', | ||
1021 | 155 | 'branch': 'stable/juno'}, | ||
1022 | 156 | {'name': 'nova', | ||
1023 | 157 | 'repository': 'git://git.openstack.org/openstack/nova', | ||
1024 | 158 | 'branch': 'stable/juno'} | ||
1025 | 159 | ], | ||
1026 | 160 | 'directory': '/mnt/openstack-git', | ||
1027 | 161 | } | ||
1028 | 162 | projects_yaml = yaml.dump(openstack_origin_git) | ||
1029 | 163 | self.test_config.set('openstack-origin', repo) | ||
1030 | 164 | self.test_config.set('openstack-origin-git', projects_yaml) | ||
1031 | 165 | hooks.config_changed() | ||
1032 | 166 | self.git_install.assert_called_with(projects_yaml) | ||
1033 | 167 | self.assertFalse(self.do_openstack_upgrade.called) | ||
1034 | 168 | |||
1035 | 115 | @patch.object(hooks, 'cluster_joined') | 169 | @patch.object(hooks, 'cluster_joined') |
1036 | 116 | @patch.object(hooks, 'identity_joined') | 170 | @patch.object(hooks, 'identity_joined') |
1037 | 117 | @patch.object(hooks, 'neutron_api_relation_joined') | 171 | @patch.object(hooks, 'neutron_api_relation_joined') |
1038 | 118 | @patch.object(hooks, 'configure_https') | 172 | @patch.object(hooks, 'configure_https') |
1039 | 119 | def test_config_changed_with_upgrade(self, conf_https, neutron_api_joined, | 173 | def test_config_changed_with_upgrade(self, conf_https, neutron_api_joined, |
1040 | 120 | identity_joined, cluster_joined): | 174 | identity_joined, cluster_joined): |
1041 | 175 | self.git_install_requested.return_value = False | ||
1042 | 121 | self.openstack_upgrade_available.return_value = True | 176 | self.openstack_upgrade_available.return_value = True |
1043 | 122 | self.relation_ids.return_value = ['generic_rid'] | 177 | self.relation_ids.return_value = ['generic_rid'] |
1044 | 123 | _zmq_joined = self.patch('zeromq_configuration_relation_joined') | 178 | _zmq_joined = self.patch('zeromq_configuration_relation_joined') |
1045 | 124 | 179 | ||
1046 | === modified file 'unit_tests/test_nova_cc_utils.py' | |||
1047 | --- unit_tests/test_nova_cc_utils.py 2014-11-20 16:59:00 +0000 | |||
1048 | +++ unit_tests/test_nova_cc_utils.py 2015-04-16 19:34:57 +0000 | |||
1049 | @@ -127,6 +127,15 @@ | |||
1050 | 127 | '--option', 'Dpkg::Options::=--force-confdef', | 127 | '--option', 'Dpkg::Options::=--force-confdef', |
1051 | 128 | ] | 128 | ] |
1052 | 129 | 129 | ||
1053 | 130 | openstack_origin_git = \ | ||
1054 | 131 | """repositories: | ||
1055 | 132 | - {name: requirements, | ||
1056 | 133 | repository: 'git://git.openstack.org/openstack/requirements', | ||
1057 | 134 | branch: stable/juno} | ||
1058 | 135 | - {name: nova, | ||
1059 | 136 | repository: 'git://git.openstack.org/openstack/nova', | ||
1060 | 137 | branch: stable/juno}""" | ||
1061 | 138 | |||
1062 | 130 | 139 | ||
1063 | 131 | def fake_plugin_attribute(plugin, attr, net_manager): | 140 | def fake_plugin_attribute(plugin, attr, net_manager): |
1064 | 132 | if plugin in PLUGIN_ATTRIBUTES: | 141 | if plugin in PLUGIN_ATTRIBUTES: |
1065 | @@ -298,26 +307,34 @@ | |||
1066 | 298 | self.assertEquals(_proxy_page, None) | 307 | self.assertEquals(_proxy_page, None) |
1067 | 299 | 308 | ||
1068 | 300 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 309 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
1070 | 301 | def test_determine_packages_quantum(self, subcontext): | 310 | @patch.object(utils, 'git_install_requested') |
1071 | 311 | def test_determine_packages_quantum(self, git_requested, subcontext): | ||
1072 | 312 | git_requested.return_value = False | ||
1073 | 302 | self._resource_map(network_manager='quantum') | 313 | self._resource_map(network_manager='quantum') |
1074 | 303 | pkgs = utils.determine_packages() | 314 | pkgs = utils.determine_packages() |
1075 | 304 | self.assertIn('quantum-server', pkgs) | 315 | self.assertIn('quantum-server', pkgs) |
1076 | 305 | 316 | ||
1077 | 306 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 317 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
1079 | 307 | def test_determine_packages_neutron(self, subcontext): | 318 | @patch.object(utils, 'git_install_requested') |
1080 | 319 | def test_determine_packages_neutron(self, git_requested, subcontext): | ||
1081 | 320 | git_requested.return_value = False | ||
1082 | 308 | self.is_relation_made.return_value = False | 321 | self.is_relation_made.return_value = False |
1083 | 309 | self._resource_map(network_manager='neutron') | 322 | self._resource_map(network_manager='neutron') |
1084 | 310 | pkgs = utils.determine_packages() | 323 | pkgs = utils.determine_packages() |
1085 | 311 | self.assertIn('neutron-server', pkgs) | 324 | self.assertIn('neutron-server', pkgs) |
1086 | 312 | 325 | ||
1087 | 313 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 326 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
1089 | 314 | def test_determine_packages_nova_volume(self, subcontext): | 327 | @patch.object(utils, 'git_install_requested') |
1090 | 328 | def test_determine_packages_nova_volume(self, git_requested, subcontext): | ||
1091 | 329 | git_requested.return_value = False | ||
1092 | 315 | self.relation_ids.return_value = ['nova-volume-service:0'] | 330 | self.relation_ids.return_value = ['nova-volume-service:0'] |
1093 | 316 | pkgs = utils.determine_packages() | 331 | pkgs = utils.determine_packages() |
1094 | 317 | self.assertIn('nova-api-os-volume', pkgs) | 332 | self.assertIn('nova-api-os-volume', pkgs) |
1095 | 318 | 333 | ||
1096 | 319 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 334 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
1098 | 320 | def test_determine_packages_console(self, subcontext): | 335 | @patch.object(utils, 'git_install_requested') |
1099 | 336 | def test_determine_packages_console(self, git_requested, subcontext): | ||
1100 | 337 | git_requested.return_value = False | ||
1101 | 321 | self.test_config.set('console-access-protocol', 'spice') | 338 | self.test_config.set('console-access-protocol', 'spice') |
1102 | 322 | self.relation_ids.return_value = [] | 339 | self.relation_ids.return_value = [] |
1103 | 323 | pkgs = utils.determine_packages() | 340 | pkgs = utils.determine_packages() |
1104 | @@ -326,7 +343,9 @@ | |||
1105 | 326 | self.assertIn(console_pkg, pkgs) | 343 | self.assertIn(console_pkg, pkgs) |
1106 | 327 | 344 | ||
1107 | 328 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 345 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
1109 | 329 | def test_determine_packages_base(self, subcontext): | 346 | @patch.object(utils, 'git_install_requested') |
1110 | 347 | def test_determine_packages_base(self, git_requested, subcontext): | ||
1111 | 348 | git_requested.return_value = False | ||
1112 | 330 | self.relation_ids.return_value = [] | 349 | self.relation_ids.return_value = [] |
1113 | 331 | self.os_release.return_value = 'folsom' | 350 | self.os_release.return_value = 'folsom' |
1114 | 332 | pkgs = utils.determine_packages() | 351 | pkgs = utils.determine_packages() |
1115 | @@ -334,7 +353,10 @@ | |||
1116 | 334 | self.assertEquals(ex, pkgs) | 353 | self.assertEquals(ex, pkgs) |
1117 | 335 | 354 | ||
1118 | 336 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 355 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
1120 | 337 | def test_determine_packages_base_grizzly_beyond(self, subcontext): | 356 | @patch.object(utils, 'git_install_requested') |
1121 | 357 | def test_determine_packages_base_grizzly_beyond(self, git_requested, | ||
1122 | 358 | subcontext): | ||
1123 | 359 | git_requested.return_value = False | ||
1124 | 338 | self.relation_ids.return_value = [] | 360 | self.relation_ids.return_value = [] |
1125 | 339 | self.os_release.return_value = 'grizzly' | 361 | self.os_release.return_value = 'grizzly' |
1126 | 340 | pkgs = utils.determine_packages() | 362 | pkgs = utils.determine_packages() |
1127 | @@ -824,3 +846,255 @@ | |||
1128 | 824 | self.assertFalse(self.service_running.called) | 846 | self.assertFalse(self.service_running.called) |
1129 | 825 | self.assertFalse(self.service_stop.called) | 847 | self.assertFalse(self.service_stop.called) |
1130 | 826 | self.assertTrue(contexts.complete_contexts.called) | 848 | self.assertTrue(contexts.complete_contexts.called) |
1131 | 849 | |||
1132 | 850 | @patch.object(utils, 'git_install_requested') | ||
1133 | 851 | @patch.object(utils, 'git_clone_and_install') | ||
1134 | 852 | @patch.object(utils, 'git_post_install') | ||
1135 | 853 | @patch.object(utils, 'git_pre_install') | ||
1136 | 854 | def test_git_install(self, git_pre, git_post, git_clone_and_install, | ||
1137 | 855 | git_requested): | ||
1138 | 856 | projects_yaml = openstack_origin_git | ||
1139 | 857 | git_requested.return_value = True | ||
1140 | 858 | utils.git_install(projects_yaml) | ||
1141 | 859 | self.assertTrue(git_pre.called) | ||
1142 | 860 | git_clone_and_install.assert_called_with(openstack_origin_git, | ||
1143 | 861 | core_project='nova') | ||
1144 | 862 | self.assertTrue(git_post.called) | ||
1145 | 863 | |||
1146 | 864 | @patch.object(utils, 'mkdir') | ||
1147 | 865 | @patch.object(utils, 'add_user_to_group') | ||
1148 | 866 | @patch.object(utils, 'add_group') | ||
1149 | 867 | @patch.object(utils, 'adduser') | ||
1150 | 868 | @patch('subprocess.check_call') | ||
1151 | 869 | def test_git_pre_install(self, check_call, adduser, add_group, | ||
1152 | 870 | add_user_to_group, mkdir): | ||
1153 | 871 | utils.git_pre_install() | ||
1154 | 872 | expected = [ | ||
1155 | 873 | call('nova', shell='/bin/bash', system_user=True), | ||
1156 | 874 | call('neutron', shell='/bin/bash', system_user=True), | ||
1157 | 875 | ] | ||
1158 | 876 | self.assertEquals(adduser.call_args_list, expected) | ||
1159 | 877 | check_call.assert_called_with(['usermod', '--home', '/var/lib/nova', | ||
1160 | 878 | 'nova']) | ||
1161 | 879 | expected = [ | ||
1162 | 880 | call('nova', system_group=True), | ||
1163 | 881 | call('neutron', system_group=True), | ||
1164 | 882 | ] | ||
1165 | 883 | self.assertEquals(add_group.call_args_list, expected) | ||
1166 | 884 | expected = [ | ||
1167 | 885 | call('nova', 'nova'), | ||
1168 | 886 | call('neutron', 'neutron'), | ||
1169 | 887 | ] | ||
1170 | 888 | self.assertEquals(add_user_to_group.call_args_list, expected) | ||
1171 | 889 | expected = [ | ||
1172 | 890 | call('/var/lib/nova', owner='nova', | ||
1173 | 891 | group='nova', perms=0755, force=False), | ||
1174 | 892 | call('/var/lib/nova/buckets', owner='nova', | ||
1175 | 893 | group='nova', perms=0755, force=False), | ||
1176 | 894 | call('/var/lib/nova/CA', owner='nova', | ||
1177 | 895 | group='nova', perms=0755, force=False), | ||
1178 | 896 | call('/var/lib/nova/CA/INTER', owner='nova', | ||
1179 | 897 | group='nova', perms=0755, force=False), | ||
1180 | 898 | call('/var/lib/nova/CA/newcerts', owner='nova', | ||
1181 | 899 | group='nova', perms=0755, force=False), | ||
1182 | 900 | call('/var/lib/nova/CA/private', owner='nova', | ||
1183 | 901 | group='nova', perms=0755, force=False), | ||
1184 | 902 | call('/var/lib/nova/CA/reqs', owner='nova', | ||
1185 | 903 | group='nova', perms=0755, force=False), | ||
1186 | 904 | call('/var/lib/nova/images', owner='nova', | ||
1187 | 905 | group='nova', perms=0755, force=False), | ||
1188 | 906 | call('/var/lib/nova/instances', owner='nova', | ||
1189 | 907 | group='nova', perms=0755, force=False), | ||
1190 | 908 | call('/var/lib/nova/keys', owner='nova', | ||
1191 | 909 | group='nova', perms=0755, force=False), | ||
1192 | 910 | call('/var/lib/nova/networks', owner='nova', | ||
1193 | 911 | group='nova', perms=0755, force=False), | ||
1194 | 912 | call('/var/lib/nova/tmp', owner='nova', | ||
1195 | 913 | group='nova', perms=0755, force=False), | ||
1196 | 914 | call('/var/lib/neutron', owner='nova', | ||
1197 | 915 | group='nova', perms=0755, force=False), | ||
1198 | 916 | call('/var/lib/neutron/lock', owner='nova', | ||
1199 | 917 | group='nova', perms=0755, force=False), | ||
1200 | 918 | call('/var/log/nova', owner='nova', | ||
1201 | 919 | group='nova', perms=0755, force=False), | ||
1202 | 920 | call('/etc/neutron', owner='nova', | ||
1203 | 921 | group='nova', perms=0755, force=False), | ||
1204 | 922 | call('/etc/neutron/plugins', owner='nova', | ||
1205 | 923 | group='nova', perms=0755, force=False), | ||
1206 | 924 | call('/etc/neutron/plugins/ml2', owner='nova', | ||
1207 | 925 | group='nova', perms=0755, force=False), | ||
1208 | 926 | ] | ||
1209 | 927 | self.assertEquals(mkdir.call_args_list, expected) | ||
1210 | 928 | |||
1211 | 929 | @patch.object(utils, 'git_src_dir') | ||
1212 | 930 | @patch.object(utils, 'render') | ||
1213 | 931 | @patch('os.path.join') | ||
1214 | 932 | @patch('os.path.exists') | ||
1215 | 933 | @patch('shutil.copytree') | ||
1216 | 934 | @patch('shutil.rmtree') | ||
1217 | 935 | def test_git_post_install(self, rmtree, copytree, exists, join, render, | ||
1218 | 936 | git_src_dir): | ||
1219 | 937 | projects_yaml = openstack_origin_git | ||
1220 | 938 | join.return_value = 'joined-string' | ||
1221 | 939 | utils.git_post_install(projects_yaml) | ||
1222 | 940 | expected = [ | ||
1223 | 941 | call('joined-string', '/etc/nova'), | ||
1224 | 942 | ] | ||
1225 | 943 | copytree.assert_has_calls(expected) | ||
1226 | 944 | |||
1227 | 945 | nova_cc = 'nova-cloud-controller' | ||
1228 | 946 | nova_user = 'nova' | ||
1229 | 947 | start_dir = '/var/lib/nova' | ||
1230 | 948 | nova_conf = '/etc/nova/nova.conf' | ||
1231 | 949 | nova_ec2_api_context = { | ||
1232 | 950 | 'service_description': 'Nova EC2 API server', | ||
1233 | 951 | 'service_name': nova_cc, | ||
1234 | 952 | 'user_name': nova_user, | ||
1235 | 953 | 'start_dir': start_dir, | ||
1236 | 954 | 'process_name': 'nova-api-ec2', | ||
1237 | 955 | 'executable_name': '/usr/local/bin/nova-api-ec2', | ||
1238 | 956 | 'config_files': [nova_conf], | ||
1239 | 957 | } | ||
1240 | 958 | nova_api_os_compute_context = { | ||
1241 | 959 | 'service_description': 'Nova OpenStack Compute API server', | ||
1242 | 960 | 'service_name': nova_cc, | ||
1243 | 961 | 'user_name': nova_user, | ||
1244 | 962 | 'start_dir': start_dir, | ||
1245 | 963 | 'process_name': 'nova-api-os-compute', | ||
1246 | 964 | 'executable_name': '/usr/local/bin/nova-api-os-compute', | ||
1247 | 965 | 'config_files': [nova_conf], | ||
1248 | 966 | } | ||
1249 | 967 | nova_cells_context = { | ||
1250 | 968 | 'service_description': 'Nova cells', | ||
1251 | 969 | 'service_name': nova_cc, | ||
1252 | 970 | 'user_name': nova_user, | ||
1253 | 971 | 'start_dir': start_dir, | ||
1254 | 972 | 'process_name': 'nova-cells', | ||
1255 | 973 | 'executable_name': '/usr/local/bin/nova-cells', | ||
1256 | 974 | 'config_files': [nova_conf], | ||
1257 | 975 | } | ||
1258 | 976 | nova_cert_context = { | ||
1259 | 977 | 'service_description': 'Nova cert', | ||
1260 | 978 | 'service_name': nova_cc, | ||
1261 | 979 | 'user_name': nova_user, | ||
1262 | 980 | 'start_dir': start_dir, | ||
1263 | 981 | 'process_name': 'nova-cert', | ||
1264 | 982 | 'executable_name': '/usr/local/bin/nova-cert', | ||
1265 | 983 | 'config_files': [nova_conf], | ||
1266 | 984 | } | ||
1267 | 985 | nova_conductor_context = { | ||
1268 | 986 | 'service_description': 'Nova conductor', | ||
1269 | 987 | 'service_name': nova_cc, | ||
1270 | 988 | 'user_name': nova_user, | ||
1271 | 989 | 'start_dir': start_dir, | ||
1272 | 990 | 'process_name': 'nova-conductor', | ||
1273 | 991 | 'executable_name': '/usr/local/bin/nova-conductor', | ||
1274 | 992 | 'config_files': [nova_conf], | ||
1275 | 993 | } | ||
1276 | 994 | nova_consoleauth_context = { | ||
1277 | 995 | 'service_description': 'Nova console auth', | ||
1278 | 996 | 'service_name': nova_cc, | ||
1279 | 997 | 'user_name': nova_user, | ||
1280 | 998 | 'start_dir': start_dir, | ||
1281 | 999 | 'process_name': 'nova-consoleauth', | ||
1282 | 1000 | 'executable_name': '/usr/local/bin/nova-consoleauth', | ||
1283 | 1001 | 'config_files': [nova_conf], | ||
1284 | 1002 | } | ||
1285 | 1003 | nova_console_context = { | ||
1286 | 1004 | 'service_description': 'Nova console', | ||
1287 | 1005 | 'service_name': nova_cc, | ||
1288 | 1006 | 'user_name': nova_user, | ||
1289 | 1007 | 'start_dir': start_dir, | ||
1290 | 1008 | 'process_name': 'nova-console', | ||
1291 | 1009 | 'executable_name': '/usr/local/bin/nova-console', | ||
1292 | 1010 | 'config_files': [nova_conf], | ||
1293 | 1011 | } | ||
1294 | 1012 | nova_novncproxy_context = { | ||
1295 | 1013 | 'service_description': 'Nova NoVNC proxy', | ||
1296 | 1014 | 'service_name': nova_cc, | ||
1297 | 1015 | 'user_name': nova_user, | ||
1298 | 1016 | 'start_dir': start_dir, | ||
1299 | 1017 | 'process_name': 'nova-novncproxy', | ||
1300 | 1018 | 'executable_name': '/usr/local/bin/nova-novncproxy', | ||
1301 | 1019 | 'config_files': [nova_conf], | ||
1302 | 1020 | } | ||
1303 | 1021 | nova_objectstore_context = { | ||
1304 | 1022 | 'service_description': 'Nova object store', | ||
1305 | 1023 | 'service_name': nova_cc, | ||
1306 | 1024 | 'user_name': nova_user, | ||
1307 | 1025 | 'start_dir': start_dir, | ||
1308 | 1026 | 'process_name': 'nova-objectstore', | ||
1309 | 1027 | 'executable_name': '/usr/local/bin/nova-objectstore', | ||
1310 | 1028 | 'config_files': [nova_conf], | ||
1311 | 1029 | } | ||
1312 | 1030 | nova_scheduler_context = { | ||
1313 | 1031 | 'service_description': 'Nova scheduler', | ||
1314 | 1032 | 'service_name': nova_cc, | ||
1315 | 1033 | 'user_name': nova_user, | ||
1316 | 1034 | 'start_dir': start_dir, | ||
1317 | 1035 | 'process_name': 'nova-scheduler', | ||
1318 | 1036 | 'executable_name': '/usr/local/bin/nova-scheduler', | ||
1319 | 1037 | 'config_files': [nova_conf], | ||
1320 | 1038 | } | ||
1321 | 1039 | nova_spiceproxy_context = { | ||
1322 | 1040 | 'service_description': 'Nova spice proxy', | ||
1323 | 1041 | 'service_name': nova_cc, | ||
1324 | 1042 | 'user_name': nova_user, | ||
1325 | 1043 | 'start_dir': start_dir, | ||
1326 | 1044 | 'process_name': 'nova-spicehtml5proxy', | ||
1327 | 1045 | 'executable_name': '/usr/local/bin/nova-spicehtml5proxy', | ||
1328 | 1046 | 'config_files': [nova_conf], | ||
1329 | 1047 | } | ||
1330 | 1048 | nova_xvpvncproxy_context = { | ||
1331 | 1049 | 'service_description': 'Nova XVPVNC proxy', | ||
1332 | 1050 | 'service_name': nova_cc, | ||
1333 | 1051 | 'user_name': nova_user, | ||
1334 | 1052 | 'start_dir': start_dir, | ||
1335 | 1053 | 'process_name': 'nova-xvpvncproxy', | ||
1336 | 1054 | 'executable_name': '/usr/local/bin/nova-xvpvncproxy', | ||
1337 | 1055 | 'config_files': [nova_conf], | ||
1338 | 1056 | } | ||
1339 | 1057 | expected = [ | ||
1340 | 1058 | call('git/nova_sudoers', '/etc/sudoers.d/nova_sudoers', | ||
1341 | 1059 | {}, perms=0o440), | ||
1342 | 1060 | call('git.upstart', '/etc/init/nova-api-ec2.conf', | ||
1343 | 1061 | nova_ec2_api_context, perms=0o644, | ||
1344 | 1062 | templates_dir='joined-string'), | ||
1345 | 1063 | call('git.upstart', '/etc/init/nova-api-os-compute.conf', | ||
1346 | 1064 | nova_api_os_compute_context, perms=0o644, | ||
1347 | 1065 | templates_dir='joined-string'), | ||
1348 | 1066 | call('git.upstart', '/etc/init/nova-cells.conf', | ||
1349 | 1067 | nova_cells_context, perms=0o644, | ||
1350 | 1068 | templates_dir='joined-string'), | ||
1351 | 1069 | call('git.upstart', '/etc/init/nova-cert.conf', | ||
1352 | 1070 | nova_cert_context, perms=0o644, | ||
1353 | 1071 | templates_dir='joined-string'), | ||
1354 | 1072 | call('git.upstart', '/etc/init/nova-conductor.conf', | ||
1355 | 1073 | nova_conductor_context, perms=0o644, | ||
1356 | 1074 | templates_dir='joined-string'), | ||
1357 | 1075 | call('git.upstart', '/etc/init/nova-consoleauth.conf', | ||
1358 | 1076 | nova_consoleauth_context, perms=0o644, | ||
1359 | 1077 | templates_dir='joined-string'), | ||
1360 | 1078 | call('git.upstart', '/etc/init/nova-console.conf', | ||
1361 | 1079 | nova_console_context, perms=0o644, | ||
1362 | 1080 | templates_dir='joined-string'), | ||
1363 | 1081 | call('git.upstart', '/etc/init/nova-novncproxy.conf', | ||
1364 | 1082 | nova_novncproxy_context, perms=0o644, | ||
1365 | 1083 | templates_dir='joined-string'), | ||
1366 | 1084 | call('git.upstart', '/etc/init/nova-objectstore.conf', | ||
1367 | 1085 | nova_objectstore_context, perms=0o644, | ||
1368 | 1086 | templates_dir='joined-string'), | ||
1369 | 1087 | call('git.upstart', '/etc/init/nova-scheduler.conf', | ||
1370 | 1088 | nova_scheduler_context, perms=0o644, | ||
1371 | 1089 | templates_dir='joined-string'), | ||
1372 | 1090 | call('git.upstart', '/etc/init/nova-spiceproxy.conf', | ||
1373 | 1091 | nova_spiceproxy_context, perms=0o644, | ||
1374 | 1092 | templates_dir='joined-string'), | ||
1375 | 1093 | call('git.upstart', '/etc/init/nova-xvpvncproxy.conf', | ||
1376 | 1094 | nova_xvpvncproxy_context, perms=0o644, | ||
1377 | 1095 | templates_dir='joined-string'), | ||
1378 | 1096 | ] | ||
1379 | 1097 | self.assertEquals(render.call_args_list, expected) | ||
1380 | 1098 | self.assertTrue(self.apt_update.called) | ||
1381 | 1099 | self.apt_install.assert_called_with(['novnc', 'spice-html5', | ||
1382 | 1100 | 'websockify'], fatal=True) |
charm_lint_check #3416 nova-cloud- controller- next for corey.bryant mp256298
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/3416/