diff options
| author | Tushar Patil <tushar.vitthal.patil@gmail.com> | 2011-08-22 16:35:09 -0700 |
|---|---|---|
| committer | Tushar Patil <tushar.vitthal.patil@gmail.com> | 2011-08-22 16:35:09 -0700 |
| commit | 4ded14d0d8fb4ec1bbc14255e90cbaae0626997f (patch) | |
| tree | f7e8d93de30560ed16ff8811dabf3d45fec77250 /nova/utils.py | |
| parent | 94b3055ade678a80d88b5e8ee8c3491c7bce95a2 (diff) | |
| parent | 71f039b936aabb7381b0423e743da65f1475fb35 (diff) | |
| download | nova-4ded14d0d8fb4ec1bbc14255e90cbaae0626997f.tar.gz nova-4ded14d0d8fb4ec1bbc14255e90cbaae0626997f.tar.xz nova-4ded14d0d8fb4ec1bbc14255e90cbaae0626997f.zip | |
Merged from trunk,resolved conflicts and fixed broken unit tests due to changes in the extensions which now include ProjectMapper
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/nova/utils.py b/nova/utils.py index 08821ebee..fc4bbd53b 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -295,7 +295,7 @@ EASIER_PASSWORD_SYMBOLS = ('23456789' # Removed: 0, 1 def usage_from_instance(instance_ref, **kw): usage_info = dict( - tenant_id=instance_ref['project_id'], + project_id=instance_ref['project_id'], user_id=instance_ref['user_id'], instance_id=instance_ref['id'], instance_type=instance_ref['instance_type']['name'], @@ -547,11 +547,17 @@ def to_primitive(value, convert_instances=False, level=0): Therefore, convert_instances=True is lossy ... be aware. """ - if inspect.isclass(value): - return unicode(value) + nasty = [inspect.ismodule, inspect.isclass, inspect.ismethod, + inspect.isfunction, inspect.isgeneratorfunction, + inspect.isgenerator, inspect.istraceback, inspect.isframe, + inspect.iscode, inspect.isbuiltin, inspect.isroutine, + inspect.isabstract] + for test in nasty: + if test(value): + return unicode(value) if level > 3: - return [] + return '?' # The try block may not be necessary after the class check above, # but just in case ... |
