4471 Commits

Author SHA1 Message Date
ChangBo Guo(gcb)
50618882d5 Replace safe_utils.getcallargs with inspect.getcallargs
safe_utils.getcallargs was written to support python2.6 which did not
have inspect.getcallargs.  Now that support for python2.6 has been
dropped it should be replaced with inspect.getcallargs.

Note:The interface that safe_utils.getcallargs provides did not match
inspect.getcallargs around the handling of the self parameter needing to
be passed in. It should be brought inline with inspect.getcallargs so
that it can be dropped. Nova fixed in 2910d75b28afd909af3b4ac392729ac3d5e64b65.

Change-Id: I2fbec0cc4d43b2fc424460b176bf26700f05f44a
2016-04-19 19:38:58 +08:00
Jenkins
aa0c3c6f9a Merge "Imported Translations from Zanata" 2016-04-16 13:22:01 +00:00
OpenStack Proposal Bot
d12a32bde9 Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I8f2d79efe27319f1de70440e5740f25da4ffd430
2016-04-16 06:11:46 +00:00
Ihar Hrachyshka
85dcf71f22 Introduce fixture to enforce sorted order for object changes
In unit tests, sometimes you want to compare that JSON representation of
an object is identical to a JSON blob. Sadly, it may not work for
objects with changes made, since those changes are represented in the
object as a set, and hence end up in unstable order in JSON blobs.

To facilitate smooth object representation comparison for objects using
__eq__, this fixture enforces sorting for object changes.

Note: this code is directly ripped from Nova tree, with tiny
modifications:

https://git.openstack.org/cgit/openstack/nova/tree/nova/tests/fixtures.py?id=dd36b6474ee9d70636fd4bc5f30237de2151fc45#n571
https://git.openstack.org/cgit/openstack/nova/tree/nova/tests/unit/test_fixtures.py?id=dd36b6474ee9d70636fd4bc5f30237de2151fc45#n425

Co-Authored-By: Dan Smith <dansmith@redhat.com>
Change-Id: Ib24eea4af863078d39f8969a7890b5d9d2e11405
Closes-Bug: #1552676
2016-04-15 08:50:12 +02:00
OpenStack Proposal Bot
761b9d75f3 Updated from global requirements
Change-Id: Ib150725d5b0f6d7c7fcfd900b0ee1bb526a27ff5
2016-04-13 12:47:46 +00:00
OpenStack Proposal Bot
50ac4b7534 Updated from global requirements
Change-Id: Ib775074436896499b6a1b968b82e8476e1e2327f
2016-04-08 00:32:25 +00:00
OpenStack Proposal Bot
09a39be1da Updated from global requirements
Change-Id: I3585f39beb13f9fa9c5a3574684085cab8da85d2
2016-04-07 17:13:32 +00:00
Jenkins
60e1bdf588 Merge "Add BaseEnumField valid_values introspection" 2016-04-06 16:08:08 +00:00
OpenStack Proposal Bot
480cae47ed Updated from global requirements
Change-Id: Ica07d628433b2e09117a5010b6d00b55b0f1531a
2016-04-05 13:41:53 +00:00
OpenStack Proposal Bot
3d188b8953 Updated from global requirements
Change-Id: I5241d69651ad4a157aac58b8be944c9f34f02559
2016-04-02 16:16:36 +00:00
Miguel Angel Ajo
0c7ec37d3a Add BaseEnumField valid_values introspection
The new class property allows introspection of the valid values,
used to ease testing by random field generation.

Change-Id: I749bc0acea4947450b4c02dca932a05a7a4ad534
2016-03-17 14:29:59 +00:00
Matt Riedemann
788e3d08f7 Use primitive type name in ValueError for Object field coerce failure
When the Object field coerce method doesn't get an object, the
type put into the ValueError message is the empty string, which is
not useful.

This change uses the type name from the value so the error has
useful details.

Change-Id: I45386cfda17243a82864780da1701d3b35432ae0
Closes-Bug: #1552480
2016-03-08 14:48:21 -05:00
Graham Hayes
c459d5e9a9 Update formatting for example statemachine field
Change-Id: I6432a5b8b05e6b9fa57ac1af9a43d29f38b416d5
2016-03-03 12:38:11 +00:00
Andrew Laski
15d96379aa Remove the executable bit from files
These files do not need to be executable so let's remove that
permission.

Change-Id: Id1e84e3c4f8e35e483c0eacc73c79b8dc3628c8b
2016-02-29 14:13:37 -05:00
OpenStack Proposal Bot
e6c275a3fe Updated from global requirements
Change-Id: If4f5f5ee999cc0cd7d29daad56feb8a219b61c91
2016-02-26 01:52:42 +00:00
OpenStack Proposal Bot
e87bca4637 Updated from global requirements
Change-Id: I69153d1ed2e0dd1ae8394dbaf7cd40e6c293e936
1.7.0
2016-02-24 08:36:39 +00:00
Jenkins
83342c274f Merge "Fix messages in exceptions raised due to invalid state transitions" 2016-02-23 20:10:40 +00:00
OpenStack Proposal Bot
57114f77fd Updated from global requirements
Change-Id: I0e98220ab7856b6cb9a88bc3225e7956fb9d6847
2016-02-20 21:59:49 +00:00
OpenStack Proposal Bot
7be5865e8b Updated from global requirements
Change-Id: I1201ce8332af4e093e055f4f80ac6ca9003ab103
1.6.0
2016-02-11 14:50:41 +00:00
OpenStack Proposal Bot
f773c29a42 Updated from global requirements
Change-Id: I4da7f7621daa9b35f7ee84132979bd2af14c64bb
2016-02-10 21:58:23 +00:00
Jenkins
13b7e943c5 Merge "Make sure functions in child object registries work" 1.5.0 2016-02-05 03:07:12 +00:00
Graham Hayes
c6adc63632 Deprecate current UUIDField behaviour
Change-Id: Ic7a62eec8f92de282fcf265d86f76d9c86dbc7fc
2016-02-04 08:15:08 -08:00
Sam Betts
4867c2d18d Make sure functions in child object registries work
This patch ensures that the VersionedObjectRegistry.__new__ function
always returns the correct class thats being created so that overridden
functions are applied correctly, when using a subclassed object
registry. Without this patch when using multiple child object registries
only the first child's overridden functions work correctly.

Change-Id: I11fef67b5bd16377086027d72f8e417c2221b5b4
Closes-Bug: #1536113
2016-02-03 16:47:07 +00:00
Dan Smith
b16584c6af Fix messages in exceptions raised due to invalid state transitions
The recently-added FakeStateMachineField raises exceptions with strings
that have improper grammar, such as:

  FooObject's are not allowed transition out of ERROR state to ACTIVE ...

In addition to the grammar issue, the field's name in the object is not
provided which may make it very difficult to debug.

Finally, the tests for this field did not actually validate the string
of the exception.

This patch corrects the strings, includes the field name, and makes the
test actually validate that the output looks like we expect.

Change-Id: I7bee955fba15b9570416518b16ac64181bf7e320
2016-01-29 16:33:07 -08:00
Jenkins
8e5a40a977 Merge "Add ability to pass args/kwargs to obj_class init" 2016-01-29 21:09:43 +00:00
Akihiro Motoki
f641d59129 Update translation setup
Follow new infra setup for translations, see spec
http://specs.openstack.org/openstack-infra/infra-specs/specs/translation_setup.html
for full details.

This basically renames
oslo.versionedobjects/locale/oslo.versionedobjects.pot to
oslo_versionedobjects/locale/oslo_versionedobjects.pot. For this we need to update
setup.cfg.

Update also domain name in _i18n.py.

Change-Id: Idf4612ca6833b516576e169ad9ff0d111d75112e
2016-01-30 00:27:03 +09:00
OpenStack Proposal Bot
abe18bdc9b Updated from global requirements
Change-Id: I837c4a95a79d2285d121b277f149231cb0ba17bb
2016-01-26 23:28:12 +00:00
Ryan Rossiter
905799e580 Add ability to pass args/kwargs to obj_class init
Because some subobjects of VersionedObject my require arguments to be
passed into __init__(), there needs to be a way for the
test_compatibility_routines() fixture to pass required args/kwargs to
init on certain objects. This change adds the ability to pass 2 mappings
to test_compatibility_routines, one for args and one for kwargs.

The key of each mapping is the object class that needs the special init
args. The value in the args dict will be a list of arguments to pass
(becomes *args), and the value in the kwargs dict is a list of kwargs
to pass (becomes **kwargs). If there is no key defined, the default
value of the args dict is [], and the default of kwargs is {}. *[] is
the equivalent of sending no arguments, and **{} is the equivalent of
not sending kwargs.

Change-Id: I62646b99adca47a9c9fe0f466f7a23ac8fa4553e
Related-Bug: #1537882
2016-01-26 16:49:06 +00:00
Jenkins
1249da8675 Merge "Use oslo_utils for tupleizing versions" 2016-01-25 03:29:32 +00:00
Jenkins
39e36aed68 Merge "Added a state machine field" 2016-01-24 22:03:08 +00:00
OpenStack Proposal Bot
7182ed5190 Updated from global requirements
Change-Id: I42441fa4dc0e1ad47f8d909869ae83ca7c01ca30
2016-01-23 10:35:06 +00:00
Graham Hayes
18b5c6a66c Added a state machine field
This will allow objects to enforce the correct flow on
this field.

Change-Id: Id574c818f942fadffa3bf0b0a991fe13ea340bdb
2016-01-22 13:32:40 -08:00
Ryan Rossiter
a912b8f661 Use oslo_utils for tupleizing versions
The VersionedObjectRegistry had a helper method in it, _vers_tuple(),
that converted an object's string version to a tuple.
oslo_utils.version_utils does that for us, so this changes over
_vers_tuple() to return version_utils's result. The inline function was
left to save on horizontal space (2 calls of convert_version_to_tuple()
in an inequality starts looking ugly really quick).

Change-Id: I69777ed2c0486996c63ef592325a5757c0b4b0b3
2016-01-22 17:24:30 +00:00
Martin Hickey
37005c310e Add temporary registry pattern to VersionedObjectRegistry
There is a temp registry pattern [1] where you can backup the object
registry, register a class locally, and then restore the original
registry. This could be used for test objects that do not need to be
registered permanently but will have calls which lookup registration.
The FakeResource object in patch [2] is such a use case.

This change is to wrap the pattern rather than accessing
oslo.versionedobjects library internals.

[1] https://review.openstack.org/#/c/243826/4/cinder/test.py
[2] https://review.openstack.org/#/c/258026/

Change-Id: I02036becb32f8d3d11170c71e14e0a2db55d1f76
2016-01-22 11:07:32 +00:00
OpenStack Proposal Bot
6e801d1c03 Updated from global requirements
Change-Id: If742bb118492ea579ab55982d1f720be4523a1a2
1.4.0
2016-01-18 22:45:14 +00:00
Jenkins
43fbf9b110 Merge "Move compare_obj to the fixture module for external consumption" 2016-01-18 04:45:12 +00:00
OpenStack Proposal Bot
c448d0b58b Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: If6ad2432a5e3ff0936076fb8350ce46b155c6bf8
2016-01-17 06:05:43 +00:00
OpenStack Proposal Bot
b58f864315 Updated from global requirements
Change-Id: I8b56ce0767399dfccaddb48965a3b2b5a2a9df1b
2016-01-16 03:31:33 +00:00
Matt Riedemann
bca1f6059b Move compare_obj to the fixture module for external consumption
Nova has a copy of compare_obj and Cinder needs to start using the
same thing, so move compare_obj to the fixture module so other projects
that are already using oslo.versionedobjects fixtures can re-use this.

The if check at the beginning of the function was changed over because
one of the unit tests uncovered a case with undesirable failing.

Co-Authored-By: Ryan Rossiter <rlrossit@us.ibm.com>
Change-Id: I0bcfa7d4f501bd69b6343e4d719e98eb32a5a5cd
2016-01-15 22:28:24 +00:00
Jenkins
686585fd64 Merge "Fix MACAddress coerce method to validate string first" 1.3.0 2016-01-07 16:56:45 +00:00
OpenStack Proposal Bot
9449f16970 Updated from global requirements
Change-Id: I06caf5181c866b5ccf877360750e7476c09aa3be
2016-01-06 23:18:51 +00:00
Jenkins
48d7ef9b17 Merge "Updated from global requirements" 2016-01-04 14:54:11 +00:00
Moshe Levi
d1bcb9e329 Fix MACAddress coerce method to validate string first
This patch update the coerce method to verify
that value is a string before doing value.lower().

Change-Id: I6ee61c33e8fe2cc6f4a5384151bea6373c04397d
2016-01-04 00:23:46 +02:00
OpenStack Proposal Bot
0b62d3a90e Updated from global requirements
Change-Id: I2ebc2c9ff5cf0603725d838081cf058ce6d8064a
2016-01-01 20:32:21 +00:00
Chaozhe.Chen
56d225372d Remove meaningless default value in __get__()
In function object.__get__(self, instance, owner), owner is always
the owner class, while instance is the instance that the attribute
was accessed through, or None when the attribute is accessed through
the owner. Setting owner default value makes no sense.
refer to:
http://python-reference.readthedocs.org/en/latest/docs/dunderdsc/get.html#get

Change-Id: I74c2105f3100711b62171db65bc0656393adf2b8
2015-12-23 00:30:37 +08:00
Jenkins
ad299becec Merge "Added checking compat using manifest backports" 1.2.0 2015-12-19 03:19:01 +00:00
Jenkins
1d8c647902 Merge "Fixed nondeterministicness of extra_data test" 2015-12-18 20:21:50 +00:00
Ryan Rossiter
442ddcaeab Added checking compat using manifest backports
The original test_compatibility_routines() only called
obj_to_primitive() without the version manifest, which means the fixture
could not be used to test compatibility routines on manifest backports.
This adds a kwarg to test_compatibility_routines() that allows users to
specify if they want to use the version manifest in the calls to
obj_to_primitive().

Change-Id: I1ef6eed1c79a2f2fc8967518a8a3d09e89ab64e3
2015-12-16 15:24:31 +00:00
Ryan Rossiter
4bf749510c Fixed nondeterministicness of extra_data test
I guess I reused classes a little too much when testing the fingerprint
generation, because the fingerprint being generated out of the used
class was nondeterministic because something else was changing on the
class before/during the fingerprint generation. So now there is a class
created only for the test, and the fingerprint is generated on that
object (with only extra data to correctly isolate what's being tested).

Change-Id: I6ba68fa0a03546b93f0f983f86fde886976b7569
2015-12-15 19:38:10 +00:00
OpenStack Proposal Bot
a4843cd4af Updated from global requirements
Change-Id: I602fbb19eeb642ac45378369dab7becc374dbe75
2015-12-15 18:59:25 +00:00