Fix AttributeError in api example snippets tests

Change I3f020b6bcb1b9bf6d18a3b4f738c13cccd1bbff8 in
python-troveclient 2.11.0 changed the
troveclient.compat.client._logger variable to be a LOG
variable.

I have no idea how this hasn't been breaking the Trove
API examples CI job since python-troveclient 2.11.0 was
released. Maybe it has an no one has noticed or cared to
fix it.

Anyway, this adds hasattr checking in the test code to
set the log level on the correct variable based on which
version of troveclient is being used.

Also - no idea why setting the log level in the client
for these API tests is even necessary, but this dates back
to a change in 2014 so who knows. Not me.

--

This also fixes bug 1708171 by making nova run in
singleconductor mode so the affinity/anti-affinity
scheduling tests work. Trove CI is blocked by both
changes so they have to go together.

Change-Id: Iaf00fc55336a8049c8303b8fa2849df2366115e6
Closes-Bug: #1708190
Closes-Bug: #1708171
This commit is contained in:
Matt Riedemann 2017-08-02 11:46:16 -04:00
parent fa171bd3e9
commit 0fb67d459b
2 changed files with 10 additions and 1 deletions

View File

@ -71,3 +71,8 @@ TROVE_DEVSTACK_FILES=${TROVE_DEVSTACK_DIR}/files
TROVE_WSGI_DIR=${TROVE_WSGI_DIR:-/var/www/trove}
enable_service trove tr-api tr-tmgr tr-cond
# Trove CI tests server group anti-affinity policies and therefore needs
# Nova to use a single MQ for the computes to talk to the scheduler.
CELLSV2_SETUP=singleconductor

View File

@ -33,7 +33,11 @@ from trove.tests.config import CONFIG
from trove.tests.examples.client import JsonClient
from trove.tests.examples.client import SnippetWriter
trove_client._logger.setLevel(logging.CRITICAL)
# troveclient.compat.client._logger was changed to LOG in 2.11.0
if hasattr(trove_client, '_logger'):
trove_client._logger.setLevel(logging.CRITICAL)
elif hasattr(trove_client, 'LOG'):
trove_client.LOG.setLevel(logging.CRITICAL)
FAKE_INFO = {'m': 30, 's': 0, 'uuid': 'abcdef00-aaaa-aaaa-aaaa-bbbbbbbbbbbb'}
EXAMPLE_BACKUP_ID = "a9832168-7541-4536-b8d9-a8a9b79cf1b4"