ObjectVersionChecker gathers a group of relevant data with which it then
generates a fingerprint. This change adds a callable to get_hashes() to
provide the object class, which the callable can then use to gather more
data upon which it wants the fingerprint to be generated. This allows
end users to version on more than just fields and methods.
Change-Id: Ibbaaf926d50693ed0ddd96132542830dba75a285
This change adds testing infra for the fixture module, and starts out by
adding tests for the ObjectVersionChecker fixture.
Change-Id: I3057cbba6eddaddea2d8287e3f1a21eaf31104fc
PEP-0274 introduced dict comprehensions to replace dict constructor
with a sqeuence of key-pairs[1], these are benefits:
First, it makes the code look neater.
Second, it gains a micro-optimization.
We dropped python 2.6 support, we can leverage this now.
Note: This commit doesn't handle dict constructor with kwargs.
[1]http://legacy.python.org/dev/peps/pep-0274/
Change-Id: Ifca656d516809a6a52cf15bac3f6361e8d83aa58
This patch adds another field type definition to o.vo for a MAC Address.
Change-Id: Iee44223e5eff5565cc5e02571e5a96bb29490925
Co-authored-by: Dan Berrange <berrange@redhat.com>
* Remove skipsdist : Needs to be set only if
sdist is expensive
* Remove usedevelop : only needed when skipsdist
is set to True
* Remove install_command : We can just use the
default, we don't need to override
* Remove setenv : We can just use the default as
we don't need any extra environment variables
Change-Id: Idb0a475054743fa716c7948e974a7268862c74c7
When __repr__ returns an unicode object, python will
try to encode it with the default encoding scheme
which is ascii in general. So __repr__ needs to make
sure its return value is properly encoded.
Change-Id: Ifdb8c073474a917207a48fc5af5a340e87f66fc4
Closes-Bug: #1514325
This adds some warnings and comments when we encounter unsupported
IndirectionAPI methods for manifest-based operations.
Change-Id: I9a75d887723a0fd375041dfcba37108ae032b3bd
This follows the object_backport_versions() change by also making the
class action calls pass a version manifest. This is done in a compatible
way by first trying the new method, and if unsupported, falling back
to the original method.
No tests are changed here specifically to demonstrate that they are
undisturbed by this change. Proper tests are next.
Change-Id: If9a158fbd345b56b26ebbe2a0733db55f4929ea1
This is the logical continuation of a previous change:
I27b8a13dadc11b78c890b54eaeb9eb728125977a. That skipped the
equivalent change for the list objects, which this adds.
Change-Id: I6af7e792cc68ec1349026beee200494bae528625
There are objects that define a String field to hold a serialized json
blob and that blob can have sensitive information in it (tokens,
passwords, etc). When the object is logged, repr will log that sensitive
information. This puts a burden on the code that's doing the logging to
remember to sanitize the object's string form before logging it.
It'd be simpler and cleaner to just have a field type that extends
String so it's the same in all respects except for when it's
stringified. So in SensitiveString's stringify method it just masks the
password on the field value before returning it.
And no SensitiveString does not play an acoustic guitar at your local
coffee shop, he's actually super tough and emotionally walled up, that's
why he doesn't like exposing too much information about himself in the
logs.
Closes-Bug: #1321785
Change-Id: I56466eb8b5d8000ef010f2015f453a9e74dc66b8
Previously, we required any child object version bump to come with a
bump to any objects that included it as a parent. That allowed us to use
the version of the object at the top of a tree to determine whether we
should do a backport as part of a to_primitive operation. With manifests,
that's no longer the case. So, if we have been requested a version other
than the current one, OR if we have a manifest, we need to run the make-
compatible step. We will end up doing this all the tiem now, but it should
be very quick if nothing needs backporting.
Change-Id: I27b8a13dadc11b78c890b54eaeb9eb728125977a
VersionedObject is a container so having __contains__ implemented is
nice when your object class doesn't extend VersionedObjectDictCompat.
Since you can't use the VersionedObjectDictCompat mixin without the
VersionedObject base class we just move the __contains__ method rather
than copy it.
This came up in I95e543415b881603bb997ae0e159017c03e58a53 because:
if 'disk_format' in image_meta:
is prettier than:
if image_meta.obj_attr_is_set('disk_format'):
--
test_contains is updated to use MyOwnedObject since we need a test class
that is a VersionedObject but does not have VersionedObjectDictCompat and
it needs to be a class that defines at least one field.
Change-Id: I4f03c8e9e7827aa45225c9cfd83966ac4f01e503