tempest: Allow the old-style name project name

Tempest renamed a config option from the auth section called
"admin_tenant_name" to "admin_project_name".
To be able to run the magnum tempest tests with an older
version of tempest, also check for "admin_tenant_name" if
"admin_project_name" is not available.

Change-Id: I39de0978f36fd04ce1959d3904f1da55370e13aa
This commit is contained in:
Thomas Bechtold 2016-07-07 17:37:17 +02:00
parent cb99c64614
commit 40e341d767
1 changed files with 19 additions and 2 deletions

View File

@ -10,8 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import warnings
from tempest import config
from oslo_config import cfg
CONF = config.CONF
@ -24,7 +27,14 @@ class Config(object):
def set_admin_creds(cls, config):
cls.admin_user = CONF.auth.admin_username
cls.admin_passwd = CONF.auth.admin_password
cls.admin_tenant = CONF.auth.admin_project_name
# NOTE(toabctl): also allow the old style tempest definition
try:
cls.admin_tenant = CONF.auth.admin_project_name
except cfg.NoSuchOptError:
cls.admin_tenant = CONF.auth.admin_tenant_name
warnings.warn("the config option 'admin_tenant_name' from the "
"'auth' section is deprecated. Please switch "
"to 'admin_project_name'.")
@classmethod
def set_user_creds(cls, config):
@ -36,7 +46,14 @@ class Config(object):
# check Ia5132c5cb32355d6f26b8acdd92a0e55a2c19f41
cls.user = CONF.auth.admin_username
cls.passwd = CONF.auth.admin_password
cls.tenant = CONF.auth.admin_project_name
# NOTE(toabctl): also allow the old style tempest definition
try:
cls.tenant = CONF.auth.admin_project_name
except cfg.NoSuchOptError:
cls.tenant = CONF.auth.admin_tenant_name
warnings.warn("the config option 'admin_tenant_name' from the "
"'auth' section is deprecated. Please switch "
"to 'admin_project_name'.")
@classmethod
def set_auth_version(cls, config):