From ec34eed97fc572a51563ee82cca54a4a774fea63 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Sun, 20 Sep 2015 23:49:35 -0400 Subject: [PATCH] Add exception message to invalid cred field This commit adds a new error message to the InvalidCredentials exception raised when creating a new credentials object. Previously it would just fail saying invalid credentials which wasn't particularly useful for debugging what about the fields passed in was invalid. The new error message will inform the user which key was the cause of the error. Change-Id: I49941321db7d6259080d706b687ac27173a3bffe --- tempest_lib/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tempest_lib/auth.py b/tempest_lib/auth.py index 47abb65..1d23d31 100644 --- a/tempest_lib/auth.py +++ b/tempest_lib/auth.py @@ -528,7 +528,8 @@ class Credentials(object): if key in self.ATTRIBUTES: setattr(self, key, attr[key]) else: - raise exceptions.InvalidCredentials + msg = '%s is not a valid attr for %s' % (key, self.__class__) + raise exceptions.InvalidCredentials(msg) def __str__(self): """Represent only attributes included in self.ATTRIBUTES"""