فهرست منبع

Redact connection info schema validation errors in worker.

Nashwan Azhari 7 سال پیش
والد
کامیت
357fe2271d
2فایلهای تغییر یافته به همراه12 افزوده شده و 4 حذف شده
  1. 1 4
      coriolis/schemas.py
  2. 11 0
      coriolis/worker/rpc/server.py

+ 1 - 4
coriolis/schemas.py

@@ -54,11 +54,8 @@ def validate_value(val, schema, format_checker=None):
     try:
         jsonschema.validate(val, schema, format_checker=format_checker)
     except jsonschema.exceptions.ValidationError as ex:
-        LOG.debug("Schema validation failed: %s", ex)
-        # Don't pass the value in the exception to avoid including sensitive
-        # data (e.g. passwords)
         raise exception.SchemaValidationException(
-            "Schema validation failed")
+            "Schema validation failed: %s" % str(ex))
 
 
 def validate_string(json_string, schema):

+ 11 - 0
coriolis/worker/rpc/server.py

@@ -307,7 +307,18 @@ class WorkerServerEndpoint(object):
         is_valid = True
         message = None
         try:
+            schemas.validate_value(
+                secret_connection_info, provider.get_connection_info_schema())
             provider.validate_connection(ctxt, secret_connection_info)
+        except exception.SchemaValidationException as ex:
+            LOG.debug("Connection info schema validation failed: %s", ex)
+            is_valid = False
+            message = (
+                "Schema validation for the provided connection parameters has "
+                "failed. Please ensure that you have included all the "
+                "necessary connection parameters and they are all properly "
+                "formatted for the '%s' Coriolis plugin in use." % (
+                    platform_name))
         except exception.ConnectionValidationException as ex:
             is_valid = False
             message = str(ex)