tox.ini: add more unit tests to Python 3.4, tests already pass thanks
to other changes.
Partially implements: blueprint trove-python3
Change-Id: Iebbf2f413153e0f91f47c3dc5671f6f20415dda9
* HTTP body type must be bytes on Python 3:
* WsgiLimiterProxy, JSONDictSerializer: encode JSON as bytes
* Use byte strings for literal HTTP bodies
* Encode explicitly HTTP body to UTF-8 on Python 3
* Fix the prototype of FakeHttplibSocket.makefile(): only the first
mode parameter is mandatory
* Replace dict.keys().sort() with sorted(dict.keys())
* tox.ini: add the following unit tests to Python 3.4:
- api/common/test_extensions.py
- api/test_versions.py
Partially implements: blueprint trove-python3
Change-Id: I175dc55424e9b5786819f08a584ac967d083db11
* Replace map() with list-comprehension to get a list on Python 3.
* Unicode dance: encode text to UTF-8 for MD5, decode Base32 from
ASCII to get text.
* tox.ini: test_designate_driver and test_datastore_versions to
Python 3.4
Partially implements: blueprint trove-python3
Change-Id: I1aa5387908b3f108487ed731cee5f7d9bbfd7d69
There are some files in trove which actually don't have main entry,
they are modules rather than scripts, hence should not have the
executable flag.
Change-Id: I08b549fd339525e29d9c3247fab87901b8bbff69
Many configuration values are hard-coded in the Trove devstack
plugin, however they would be better served letting the
user/developer decide what limits to impose.
The following variables were added to facilitate this:
TROVE_MAX_ACCEPTED_VOLUME_SIZE
TROVE_MAX_INSTANCES_PER_TENANT
TROVE_MAX_VOLUMES_PER_TENANT
TROVE_AGENT_CALL_LOW_TIMEOUT
TROVE_AGENT_CALL_HIGH_TIMEOUT
TROVE_RESIZE_TIME_OUT
TROVE_USAGE_TIMEOUT
TROVE_STATE_CHANGE_WAIT_TIME
These values are only inserted if they are set. If not set,
the Trove defaults are used instead.
Change-Id: I2c568fdfa05064682f372b996a5aebcdd4e93ef3
Avoid complex metaclass to define pkg.Package. It doesn't seem to
work on Python 3, and simpler code works too :-)
Partially implements: blueprint trove-python3
Change-Id: I880527f043fcddb11926d38b5641b3a61512e27f
* Replace the sets.Set type with builtin set type. The sets module
was removed in Python 3.
* Replace string.letters with string.ascii_letters
Note: On Python 2, string.letters is different than
string.ascii_letters if locale.setlocale() is called. Hopefully,
setlocale() is not used in Trove.
Partially implements: blueprint trove-python3
Change-Id: I47ba8ea15e0cd9481752da1bfdddf374d3146c6b
When a git branch is called trove-xxx, "tox -e pep8" fails on
checking .git/logs/refs/heads/trove-xxx. It doesn't make sense to
validate Git branches using flake8.
Simply exclude .git from flake8.
Note: [testenv:pep8] of tox.ini looks for "trove-*" to validate
contrib/trove-guestagent.
Change-Id: I7c5582282a63da8cc1b3bbb6b76a267ef894a5d7
On Python 3, imports are absolute by default. By default, OpenStack
coding style requires to use relative imports.
Fix imports two use the full "path" to relative imports.
Partially implements: blueprint trove-python3
Change-Id: I2866fdc1a39fb3a20d8384a4082ca468b57d92d3
This change is backward compatible on Python 2:
* Data encrypted with the old code can be decrypted with the new code
* Data encrypted with the new code can be decrypted with the old code
Effect on Python 2: it now is possible to encode Unicode strings
which contain non-ASCII characters. Before encode_data() failed with
UnicodeEncodeError.
Changes:
* pad_for_encryption(): replace chr() with six.int2byte() to get
bytes on Python 3.
* use byte strings in tests
* encode_data() now encodes data to UTF-8 (if it is Unicode)
* encrypt() and decrypt() now encode the encryption key to UTF-8 (if
it's Unicode)
* encrypt() now encodes data to UTF-8 (if it's Unicode), it's only
needed on Python 3 since encode_data() returns Unicode on Python 3.
* test_encode_decode_string(): test also Unicode
* Add new unit tests on encrypt() and decrypt() with known values and
hardcoded IV.
* tox.ini: add test_common_extensions and test_crypto_utils
to Python 3.4 (test_common_extensions already passed before).
Note: UTF-8 is the defacto standard encoding in OpenStack. It is
already used widely in all parts of OpenStack.
Partially implements: blueprint trove-python3
Change-Id: I8e991994698d558177580595cf2c7da93ed1e1c8
Replaced raise exc_type, exc_value, exc_tb
with six.reraise(exc_type, exc_value, exc_tb)
Used SafeConfigParser, ConfigParser from six.moves
This patch is generated by the following tool using
'raise' and 'six_moves' option for ConfigParser related
changes.
https://github.com/haypo/sixer
Command:
python sixer.py -w 'raise,six_moves' trove/
Partially implements: blueprint trove-python3
Change-Id: Id885b0f4a85a26b93849043b481549be75cfa875
For GTID replication we set the replica source (i.e. master)
to have a binlog_format of MIXED. We aren't setting this on
the replicas so they default to STATEMENT. This causes a problem
with certain "non-deterministic" functions (e.g. RAND()). This
changes replica config templates for Mysql and Percona to use
MIXED mode.
A new scenario test was introduced to validate that the
replicas have this set.
MariaDB doesn't appear to have this issue so it wasn't changed.
Scenario tests for Mysql, Percona and MariaDB were run to
validate this change.
Change-Id: I936cd9bc53a812af19653e9b5b472103fab2b6c1
Closes-bug: 1563541
Replaced basestring with six.string_types
Replaced (int, long) with six.integer_types
Replaced unicode with six.text_type
This patch is generated by the following tool using
'basestring', 'long' and 'unicode' options.
Manually replaced unicode(ex) with oslo_utils.encodeutils(ex)
https://github.com/haypo/sixer
Command:
python sixer.py -w 'basestring,long,unicode' trove/
Partially implements: blueprint trove-python3
Change-Id: I6fa42674060067663ef819247ea793ef3d8aa0da
Incorporate the changes made as a part of the cluster-root
tests introduced in review 266005:
- add test scenario for: bug 1549600
- simplify turning off unsupported root-disable tests
by introducing a single assertion hook that runs before all
related tests
- ping the datastore as root to verify it can connect
- ping after root-disable to verify it cannot connect
- add missing ping implementations to Cassandra and Redis helpers
- enable root with password tests on MySQL and related
- use the same helper method to get root credentials as
the cluster-root tests
- also assert the expected root-user-name if specified
- cleanup auxiliary backup
- add Postgres root credentials
- Skip root-cluster test on Redis
- minor cleanup
- increased the low guestagent call timeout (helps tests
run more stable).
Depends-On: I8a4321ac062b1ec565945b49dbb7c619b6da867f
Change-Id: I3fb0a8bb37fd124c22573552ff61852ead23e9a0
Related-Bug: 1529965
Related-Bug: 1549969
Related-Bug: 1549600
The Trove code is full of numerous cases where kwargs are
defaulted to CONF values. This is an error-prone
way of setting up a default value, as python sets these one
time only. This fix accounts for that.
Change-Id: Icc0858ccb2d3e2584bf6f3d1542a7d631b251ac8
Closes-Bug: 1571076
The existence of the root user (with remote access)
is used to determine whether root was ever enabled on a restored
instance.
Do not remove it, just generate a new random password for it.
Change-Id: I8a4321ac062b1ec565945b49dbb7c619b6da867f
Closes-Bug: 1549600