| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python3 enforces the distinction between byte strings
far more rigorously than Python 2 does; binary data
cannot be automatically coerced to or from text data.
Use six to provide a fake file object for textual data.
It provides an alias for StringIO.StringIO in python2
and io.StringIO in python3
Change-Id: I65897bb0cca2cbeb5819a769b98645c9eb066401
Signed-off-by: Chuck Short <chuck.short@canonical.com>
|
|
|
|
|
|
|
| |
flake8 is pluggable and handles pep8 and pyflakes, as well as configuration
through tox.ini. It also removes the need for flakes.py.
Change-Id: If5f7d8ad348b4fb8119fa4ec7b5e9d17bdc72a39
|
|
|
|
|
|
| |
One code change, rest are in headers
Change-Id: I73f59681358629e1ad74e49d3d3ca13fcb5c2eb1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
depth of 3, but there is at least on case in Nova (Security
group Rules) which requires a depth beyond this.
https://bugs.launchpad.net/nova/+bug/1118608
Specifically security_group_rule_get_by_security_group
returns a set of rules which have the structure:
rule -> grantee_group -> Instance -> Instance_type
Rather than just bumping the depth limit, which might break some
other user of to_primitive we make it a specific parameter that
defaults to the current value but can be over-ridden when
required and log a warning when the depth is exceeded
Change-Id: I1eaebd484e20cb2eae09a693289709973de9943c
|
|
|
|
|
|
|
|
|
|
|
|
| |
In preparation for having nova.db.api not return any sqlalchemy objects.
nova.db.api will return only primitives, except for datetime.datetime
objects.
Uses functools.partial to make code DRYING
Partially implements bp db-api-cleanup
Change-Id: I9980d8c4e20b05bbe734cf90ac209e4e7e89befb
|
|
|
|
|
|
|
|
|
| |
Using the BaseTestCase across the tests in the tree lets us put in log
fixtures and consistently handle mox and stubout.
Part of blueprint grizzly-testtools.
Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On the path to testr migration, we need to replace the unittest base classes
with testtools.
Replace tearDown with addCleanup, addCleanup is more resilient than tearDown.
The fixtures library has excellent support for managing and cleaning
tempfiles. Use it.
Replace skip_ with testtools.skipTest
Part of blueprint grizzly-testtools.
Change-Id: I45e11bbb1ff9b31f3278d3b016737dcb7850cd98
|
|
|
|
| |
Change-Id: I3e35230dd2d96ab9f5a8c11b9ec1cd8d2d00e347
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change jsonutils.to_primitive() to increase the recursion depth counter
when calling to_primitive() on the result of iteritems() from the
current element. Previously, the only time the counter was increased
was when converting the __dict__ from an object. The iteritems() case
risks cycles, as well.
I hit a problem with this when trying to call to_primitive on an
instance of nova.db.sqlalchemy.models.Instance. An Instance includes a
reference to InstanceInfoCache, which has a reference back to the
Instance. Without this change, to_primitive() would raise an exception
for an Instance due to excessive recursion.
Related to nova blueprint no-db-messaging.
Change-Id: Ifb878368d97e92ab6c361a4dd5f5ab2e68fc16e2
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch updates the jsonutils.to_primitive() test case for when an
object has an iteritems() method. The previous implementation was
mostly a copy of another test and didn't actually test calling
iteritems() at all. Now it does.
This is used by NovaBase in nova.db.sqlalchemy.models.
Related to nova blueprint no-db-messaging.
Change-Id: Ie1d71b859219392ab35b82dd3c7932b30e759c89
|
|
|
|
|
|
|
|
|
|
|
| |
This patch updates jsonutils.to_primitive() to use timeutils.strtime()
to convert a datimetime object to a string instead of just using str().
This ensures that we can easily convert the string back to a datetime
using timeutils.parse_strtime().
Required for the nova blueprint no-db-messaging.
Change-Id: I725b333695930e12e2832378102514326fec639c
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes bug #1017765
After version 3.3.2, the anyjson library will throw a KeyError if
filedecoder isn't present. The filedecoder is just like the decoder
except it takes a file instead of a string, like json.load() instead
of json.loads().
Change-Id: I7bd012a7b4afa9b1ec987c3e6393cc922b5dadff
|
|
|
|
|
|
|
|
|
| |
Fixes bug 1010124
Convert xmlrpclib.DateTime types to datetime so they can be serialized
without creating an exception.
Change-Id: Ifcab69ad81d39d7f4066df5c71c6ab6734fb1fab
|
|
This patch creates a new module, jsonutils. It is based on some code
from nova.utils that is used by nova.rpc. It is being added to
openstack-common as another step toward being able to eventually move
nova.rpc to openstack-common.
This module provides a few things:
1) A handy function for getting an object down to something that can
be JSON serialized. See to_primitive().
2) Wrappers around loads() and dumps(). The dumps() wrapper will
automatically use to_primitive() for you if needed.
3) This sets up anyjson to use the loads() and dumps() wrappers if
anyjson is available.
Change-Id: I41e5759360d515ed53defe69f3e8247aafbcc83a
|