Merge lp:~soren/nova/include-test-extensions into lp:~hudson-openstack/nova/trunk
- include-test-extensions
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Soren Hansen | ||||
Approved revision: | 893 | ||||
Merged at revision: | 903 | ||||
Proposed branch: | lp:~soren/nova/include-test-extensions | ||||
Merge into: | lp:~hudson-openstack/nova/trunk | ||||
Diff against target: |
51 lines (+26/-8) 2 files modified
nova/api/openstack/extensions.py (+11/-8) nova/tests/api/openstack/extensions/__init__.py (+15/-0) |
||||
To merge this branch: | bzr merge lp:~soren/nova/include-test-extensions | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sandy Walsh (community) | Approve | ||
Dan Prince (community) | Approve | ||
Vish Ishaya (community) | Approve | ||
Jay Pipes (community) | Approve | ||
Review via email: mp+55146@code.launchpad.net |
This proposal supersedes a proposal from 2011-03-25.
Commit message
Toss an __init__ in the test extensions dir. This gets it included in the tarball.
Make extensions code ignore modules whose name starts with '_'.
Warn if an extension doesn't define a class or factory by the right name.
Description of the change
Resubmitting, since it's suddenly more of an actual patch.
Sandy Walsh (sandy-walsh) wrote : Posted in a previous version of this proposal | # |
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal | # |
lgtm.
OpenStack Infra (hudson-openstack) wrote : Posted in a previous version of this proposal | # |
The attempt to merge lp:~soren/nova/include-test-extensions into lp:nova failed. Below is the output from the failed tests.
AccountsTest
test_
test_
test_
test_
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token OK
test_
test_
test_no_user OK
test_
TestFunctional
test_
test_
TestLimiter
test_
LimiterTest
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
ActionExtensionTest
test_
test_
test_
ExtensionContro
test_
test_index ERROR
ExtensionManage
test_
ResourceExtensi
test_
test_
test_
ResponseExtensi
test_
test_
TestFaults
test_
test_raise ...
Soren Hansen (soren) wrote : Posted in a previous version of this proposal | # |
:(
OpenStack Infra (hudson-openstack) wrote : Posted in a previous version of this proposal | # |
The attempt to merge lp:~soren/nova/include-test-extensions into lp:nova failed. Below is the output from the failed tests.
AccountsTest
test_
test_
test_
test_
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token OK
test_
test_
test_no_user OK
test_
TestFunctional
test_
test_
TestLimiter
test_
LimiterTest
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
ActionExtensionTest
test_
test_
test_
ExtensionContro
test_
test_index ERROR
ExtensionManage
test_
ResourceExtensi
test_
test_
test_
ResponseExtensi
test_
test_
TestFaults
test_
test_raise ...
OpenStack Infra (hudson-openstack) wrote : Posted in a previous version of this proposal | # |
The attempt to merge lp:~soren/nova/include-test-extensions into lp:nova failed. Below is the output from the failed tests.
AccountsTest
test_
test_
test_
test_
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token OK
test_
test_
test_no_user OK
test_
TestFunctional
test_
test_
TestLimiter
test_
LimiterTest
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
ActionExtensionTest
test_
test_
test_
ExtensionContro
test_
test_index ERROR
ExtensionManage
test_
ResourceExtensi
test_
test_
test_
ResponseExtensi
test_
test_
TestFaults
test_
test_raise ...
Soren Hansen (soren) wrote : Posted in a previous version of this proposal | # |
This makes *no* sense to me.
OpenStack Infra (hudson-openstack) wrote : Posted in a previous version of this proposal | # |
The attempt to merge lp:~soren/nova/include-test-extensions into lp:nova failed. Below is the output from the failed tests.
AccountsTest
test_
test_
test_
test_
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token OK
test_
test_
test_no_user OK
test_
TestFunctional
test_
test_
TestLimiter
test_
LimiterTest
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
ActionExtensionTest
test_
test_
test_
ExtensionContro
test_
test_index ERROR
ExtensionManage
test_
ResourceExtensi
test_
test_
test_
ResponseExtensi
test_
test_
TestFaults
test_
test_raise ...
Soren Hansen (soren) wrote : Posted in a previous version of this proposal | # |
Stab in the dark: Added contents (license and copyright) to the file. Trying again.
OpenStack Infra (hudson-openstack) wrote : Posted in a previous version of this proposal | # |
The attempt to merge lp:~soren/nova/include-test-extensions into lp:nova failed. Below is the output from the failed tests.
AccountsTest
test_
test_
test_
test_
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token OK
test_
test_
test_no_user OK
test_
TestFunctional
test_
test_
TestLimiter
test_
LimiterTest
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
ActionExtensionTest
test_
test_
test_
ExtensionContro
test_
test_index ERROR
ExtensionManage
test_
ResourceExtensi
test_
test_
test_
ResponseExtensi
test_
test_
TestFaults
test_
test_raise ...
termie (termie) wrote : Posted in a previous version of this proposal | # |
neat bug
Soren Hansen (soren) wrote : Posted in a previous version of this proposal | # |
Ok, I *swear* I ran the test suite before uploading this. I'm *almost*
sure I even ran it in the right directory.
Jay Pipes (jaypipes) wrote : | # |
funny little bug. good patience tracking this down.
Sandy Walsh (sandy-walsh) wrote : | # |
Is the try-except block still required? If so, which operation throws the AttributeError?
LOG.warn(_('Did not find expected name "%(ext_name)" in %(ext_path)s') % locals())
If load_source fails the entire service fails, correct? (not really related to this patch, but still a concern)
Personally I think I'd rather see an except Exception, e: to log the failure and press on. But others may disagree?
Soren Hansen (soren) wrote : | # |
> Personally I think I'd rather see an except Exception, e: to log the failure
> and press on. But others may disagree?
Personally, to be frank, I don't give a crap. I'm just trying to get usable tarballs again. Just tell me what to do, I'll do it.
Vish Ishaya (vishvananda) wrote : | # |
I vote for getting this in as is. Soren has been fighting with this one for far too long
Soren Hansen (soren) wrote : | # |
> I vote for getting this in as is. Soren has been fighting with this one for
> far too long
Admittedly, most of the wait has been my fault, but thanks for the approve nonetheless.
Dan Prince (dan-prince) wrote : | # |
Hey Soren,
Sorry that I missed this in my initial extensions work BTW. Didn't realize we needed the extra __init__.py files for tarball happiness, etc.
Anyway. Just tried your branch.
Got a pep8 error:
[dan.prince@
nova/api/
Dan Prince (dan-prince) wrote : | # |
Otherwise this looks good to me. Anxious to have PPA working again too!
Sandy Walsh (sandy-walsh) wrote : | # |
/me caves to the pressure :)
Soren Hansen (soren) wrote : | # |
/me applies JIT pep8
OpenStack Infra (hudson-openstack) wrote : | # |
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.
Preview Diff
1 | === modified file 'nova/api/openstack/extensions.py' |
2 | --- nova/api/openstack/extensions.py 2011-03-21 18:00:39 +0000 |
3 | +++ nova/api/openstack/extensions.py 2011-03-28 20:23:27 +0000 |
4 | @@ -317,16 +317,19 @@ |
5 | LOG.audit(_('Loading extension file: %s'), f) |
6 | mod_name, file_ext = os.path.splitext(os.path.split(f)[-1]) |
7 | ext_path = os.path.join(self.path, f) |
8 | - if file_ext.lower() == '.py': |
9 | + if file_ext.lower() == '.py' and not mod_name.startswith('_'): |
10 | mod = imp.load_source(mod_name, ext_path) |
11 | ext_name = mod_name[0].upper() + mod_name[1:] |
12 | - try: |
13 | - new_ext = getattr(mod, ext_name)() |
14 | - self._check_extension(new_ext) |
15 | - self.extensions[new_ext.get_alias()] = new_ext |
16 | - except AttributeError as ex: |
17 | - LOG.exception(_("Exception loading extension: %s"), |
18 | - unicode(ex)) |
19 | + new_ext_class = getattr(mod, ext_name, None) |
20 | + if not new_ext_class: |
21 | + LOG.warn(_('Did not find expected name ' |
22 | + '"%(ext_name)" in %(file)s'), |
23 | + {'ext_name': ext_name, |
24 | + 'file': ext_path}) |
25 | + continue |
26 | + new_ext = new_ext_class() |
27 | + self._check_extension(new_ext) |
28 | + self.extensions[new_ext.get_alias()] = new_ext |
29 | |
30 | |
31 | class ResponseExtension(object): |
32 | |
33 | === added file 'nova/tests/api/openstack/extensions/__init__.py' |
34 | --- nova/tests/api/openstack/extensions/__init__.py 1970-01-01 00:00:00 +0000 |
35 | +++ nova/tests/api/openstack/extensions/__init__.py 2011-03-28 20:23:27 +0000 |
36 | @@ -0,0 +1,15 @@ |
37 | +# vim: tabstop=4 shiftwidth=4 softtabstop=4 |
38 | + |
39 | +# Copyright 2011 OpenStack LLC |
40 | +# |
41 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
42 | +# not use this file except in compliance with the License. You may obtain |
43 | +# a copy of the License at |
44 | +# |
45 | +# http://www.apache.org/licenses/LICENSE-2.0 |
46 | +# |
47 | +# Unless required by applicable law or agreed to in writing, software |
48 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
49 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
50 | +# License for the specific language governing permissions and limitations |
51 | +# under the License. |
sure