272 Commits

Author SHA1 Message Date
Julien Danjou
e632f76e96 Include original exception in ClassNotFound exception
By doing this, we allow the error messages to be more useful. When an import
of a class fails because of a missing module dependency, it would have fail
that way for example:

$ nova-manage
Traceback (most recent call last):
  File "./bin/nova-manage", line 84, in <module>
    from nova import image
  File "/home/jd/Work/src/nova/nova/image/__init__.py", line 22, in <module>
    from nova.image import glance
  File "/home/jd/Work/src/nova/nova/image/glance.py", line 42, in <module>
    GlanceClient = utils.import_class('glance.client.Client')
  File "/home/jd/Work/src/nova/nova/utils.py", line 66, in import_class
    raise exception.ClassNotFound(class_name=class_str)
nova.exception.ClassNotFound: Class Client could not be found

This does not help the user, since it indicates the class Client cannot be
found, even if it is actually found but fail to import.

With this commit, the error message is better:
nova-manage
Traceback (most recent call last):
  File "./bin/nova-manage", line 84, in <module>
    from nova import image
  File "/home/jd/Work/src/nova/nova/image/__init__.py", line 22, in <module>
    from nova.image import glance
  File "/home/jd/Work/src/nova/nova/image/glance.py", line 42, in <module>
    GlanceClient = utils.import_class('glance.client.Client')
  File "/home/jd/Work/src/nova/nova/utils.py", line 66, in import_class
    raise exception.ClassNotFound(class_name=class_str, exception=exc)
nova.exception.ClassNotFound: Class Client could not be found: No module named kombu.connection

This helps to know that in this kombu is missing.

It would probably even better to rename ClassNotFound to
ClassCannotBeImported or something like that too.

Change-Id: I4100d931a0a825fa0729d5467d2f9268fdd2a261
Signed-off-by: Julien Danjou <julien.danjou@enovance.com>
2011-10-10 09:55:37 +02:00
Rick Harris
7f33611c19 Fixing tests 2011-09-21 15:59:40 -05:00
Josh Kearney
466c5ad651 Fixed unit tests with some minor refactoring. 2011-09-20 15:21:06 -05:00
Rick Harris
49c012d233 Adding progress 2011-09-14 23:11:03 +00:00
Tushar Patil
b2b69a423b Fixed review comments 2011-09-02 11:00:33 -07:00
Tushar Patil
8409af0f95 Fix for LP Bug #838251 2011-08-31 17:06:15 -07:00
Nachi Ueno
71e19faa0c Removed blank line 2011-08-23 08:51:44 -07:00
Nachi Ueno
0ea7bdf78b Merged with trunk 2011-08-23 08:46:55 -07:00
Nachi Ueno
6a7075b6d8 Fixed typo and docstring and example class name 2011-08-23 08:07:25 -07:00
Tushar Patil
ea0635f407 Merged from trunk,resolved conflicts and fixed broken unit tests due to changes in the extensions which now include ProjectMapper 2011-08-22 16:35:09 -07:00
Nachi Ueno
6d2f8203bf Fixed conflict with branch 2011-08-22 14:45:18 -07:00
Nachi Ueno
808ed1e6ed Added Test Code, doc string, and fixed pip-requiresw 2011-08-22 14:24:37 -07:00
William Wolf
3ea4a282d4 merge with trunk 2011-08-22 08:28:12 -04:00
Nachi Ueno
43d47f5a9f Fixed typo 2011-08-19 14:22:53 -07:00
Nachi Ueno
ac59605d2e Merged with trunkw 2011-08-19 13:25:49 -07:00
Nachi Ueno
82a1346485 Added monkey patching notification code function
w
2011-08-19 12:30:55 -07:00
Tushar Patil
e2a242fd55 Merged from trunk 2011-08-19 10:08:46 -07:00
Sandy Walsh
3c959d8890 Fixes primitive with builtins, modules, etc 2011-08-19 10:01:25 -07:00
William Wolf
2ea0693903 merge with trunk 2011-08-19 09:54:05 -04:00
Vishvananda Ishaya
f3af277911 Make all services use the same launching strategy 2011-08-17 16:25:53 -07:00
Tushar Patil
7bcbb7381d Merged with trunk and fixed broken unit testcases 2011-08-12 12:29:24 -07:00
William Wolf
d435f76a47 merge from trunk 2011-08-11 15:49:58 -04:00
Thierry Carrez
c031275174 * Removes rogue direct usage of subprocess module by proper utils.execute calls
* Adds a run_as_root parameter to utils.execute, that prefixes your command with FLAG.root_helper (which defaults to 'sudo')
* Turns all sudo calls into run_as_root=True calls
* Update fakes accordingly
* Replaces usage of "sudo -E" and "addl_env" parameter into passing environment in the command (allows it to be compatible with alternative sudo_helpers)
* Additionally, forces close_fds=True on all utils.execute calls, since it's a more secure default
2011-08-11 12:34:04 +00:00
William Wolf
5250aa7d9e tenant_id -> project_id 2011-08-10 15:47:22 -04:00
Tushar Patil
efca65b98c Merged with trunk 2011-08-09 16:26:12 -07:00
Thierry Carrez
ef63c85c8e Rename sudo_helper FLAG into root_helper 2011-08-09 14:11:15 +01:00
Thierry Carrez
34930a48dc Command args can be a tuple, convert them to list 2011-08-09 13:30:06 +01:00
Thierry Carrez
140eb4d1d0 Fix usage of sudo -E and addl_env in dnsmasq/radvd calls, remove addl_env support, fix fake_execute allowed kwargs 2011-08-09 12:21:28 +01:00
Thierry Carrez
a36757e183 Use close_fds by default since it's good for you 2011-08-09 12:05:05 +01:00
Thierry Carrez
48911f8b7e Fix ajaxterm's use of shell=True, prevent vmops.py from running its own version of utils.execute 2011-08-09 11:22:32 +01:00
Naveed Massjouni
c1a325a439 Merge from trunk. 2011-08-08 20:25:31 -04:00
Naveed Massjouni
68e533f90d Fixing a bug in nova.utils.novadir() 2011-08-08 20:23:15 -04:00
Tushar Patil
1b9b09eaf8 Resolve conflicts and fixed broken unit testcases 2011-08-08 12:20:06 -07:00
Thierry Carrez
f76cdf25ca Add run_as_root parameter to utils.execute, uses new sudo_helper FLAG to prefix command 2011-08-05 14:33:12 +02:00
Thierry Carrez
b3ec4e762f Remove spurious direct use of subprocess 2011-08-05 14:02:55 +02:00
Matthew Hooker
625450bac5 Remove instances of the "diaper pattern"
Anywhere "except:" occurs, I tried to replace it with an explicit except on
known error types. If none were known, Except was used.

In the process I've been able to unearth a few evasive bugs and clean up some
adjacent code.
2011-08-03 19:17:08 -04:00
Sandy Walsh
c228f4befa While we currently trap JSON encoding exceptions and bail out, for error notification it's more important that *some* form of the message gets out. So, we take complex notification payloads and convert them to something we know can be expressed in JSON. 2011-08-02 11:23:11 +00:00
Tushar Patil
b356fab4ac Merged with trunk 2011-07-29 14:36:30 -07:00
Sandy Walsh
19e53d51fe made the whole instance handling thing optional 2011-07-29 12:09:17 -07:00
Sandy Walsh
30de08a73b added instance support to to_primitive and tests 2011-07-29 07:05:27 -07:00
Vishvananda Ishaya
e60419c8cd change context to maintain exact time, store roles, use ids instead of objects and use a uuid for request_id 2011-07-21 22:46:36 +00:00
Tushar Patil
6bb9635606 add optional parameter networks to the Create server OS API 2011-07-11 13:34:39 -07:00
Trey Morris
f7db9b85b6 trunk merge with migration renumbering 2011-06-30 14:20:59 -05:00
Chris Behrens
e713b530de fix issue of recurse_zones not being converted to bool properly
add bool_from_str util call
add test for bool_from_str
slight rework of min/max_count check
2011-06-29 15:22:56 -07:00
Trey Morris
7eb14a9dd6 merged trunk 2011-06-29 16:44:42 -05:00
Trey Morris
a2a15e69b5 merged trunk, fixed the floating_ip fixed_ip exception stupidity 2011-06-29 12:58:10 -05:00
Monsyne Dragon
058876052f This adds system usage notifications using the notifications framework.
These are designed to feed an external billing or similar system that subscribes to the nova feed and does the analysis.
2011-06-28 20:53:45 +00:00
Monsyne Dragon
a62f3f155c Refactored usage generation 2011-06-28 20:37:05 +00:00
Brian Lamar
7b82ac0491 pep8 fix 2011-06-28 10:43:25 -04:00
Trey Morris
64d88de6dc trunk merge, getting fierce.. 2011-06-27 16:48:03 -05:00