[Kimchi-devel] [PATCH 1/4] Remove any WOK error message from Kimchi

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Tue Oct 20 16:44:15 UTC 2015


Reviewed-By: Paulo Vital <pvital at linux.vnet.ibm.com>

On Mon, 2015-10-19 at 19:10 -0200, Aline Manera wrote:
> The error messages are grouped by domain. Each plugin has its own
> group of
> messages defined by the root application.
> That means Kimchi does not have access to Wok messages and vice
> versa.
> 
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>  src/wok/plugins/kimchi/i18n.py        | 1 +
>  src/wok/plugins/kimchi/tests/utils.py | 7 +++----
>  src/wok/plugins/kimchi/utils.py       | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/wok/plugins/kimchi/i18n.py
> b/src/wok/plugins/kimchi/i18n.py
> index e9be6af..1f615df 100644
> --- a/src/wok/plugins/kimchi/i18n.py
> +++ b/src/wok/plugins/kimchi/i18n.py
> @@ -271,6 +271,7 @@ messages = {
>      "KCHPKGUPD0004E": _("There is no compatible package manager for
> this system."),
>      "KCHPKGUPD0005E": _("There is a package manager instance running
> in the system."),
> 
> +    "KCHUTILS0001E": _("Invalid Kimchi URI %(uri)s."),
>      "KCHUTILS0003E": _("Unable to choose a virtual machine name"),
> 
>      "KCHVMSTOR0002E": _("Invalid storage type. Types supported:
> 'cdrom', 'disk'"),
> diff --git a/src/wok/plugins/kimchi/tests/utils.py
> b/src/wok/plugins/kimchi/tests/utils.py
> index ecaa87f..5329324 100644
> --- a/src/wok/plugins/kimchi/tests/utils.py
> +++ b/src/wok/plugins/kimchi/tests/utils.py
> @@ -37,7 +37,7 @@ from lxml import etree
>  import wok.server
>  from wok.config import config, PluginPaths
>  from wok.auth import User, USER_NAME, USER_GROUPS, USER_ROLES, tabs
> -from wok.exception import NotFoundError, OperationFailed
> +from wok.exception import NotFoundError
>  from wok.utils import wok_log
> 
>  from wok.plugins.kimchi import mockmodel
> @@ -204,9 +204,8 @@ class FakeUser(User):
>      def authenticate(username, password, service="passwd"):
>          try:
>              return mockmodel.fake_user[username] == password
> -        except KeyError, e:
> -            raise OperationFailed("WOKAUTH0001E", {'username':
> 'username',
> -                                                   'code':
> e.message})
> +        except KeyError:
> +            raise cherrypy.HTTPError(500, "Authentication failed")
> 
> 
>  def patch_auth(sudo=True):
> diff --git a/src/wok/plugins/kimchi/utils.py
> b/src/wok/plugins/kimchi/utils.py
> index 2480362..92ca83a 100644
> --- a/src/wok/plugins/kimchi/utils.py
> +++ b/src/wok/plugins/kimchi/utils.py
> @@ -27,7 +27,7 @@ def _uri_to_name(collection, uri):
>      expr = '/plugins/kimchi/%s/(.*?)$' % collection
>      m = re.match(expr, uri)
>      if not m:
> -        raise InvalidParameter("WOKUTILS0001E", {'uri': uri})
> +        raise InvalidParameter("KCHUTILS0001E", {'uri': uri})
>      return m.group(1)
> 
> 




More information about the Kimchi-devel mailing list