You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/11/14 20:32:34 UTC

[GitHub] [airflow] XD-DENG commented on a change in pull request #12370: Reject 'connections add' CLI request if URI provided is invalid

XD-DENG commented on a change in pull request #12370:
URL: https://github.com/apache/airflow/pull/12370#discussion_r523460199



##########
File path: airflow/cli/commands/connection_command.py
##########
@@ -177,16 +185,19 @@ def connections_add(args):
     missing_args = []
     invalid_args = []
     if args.conn_uri:
+        if not _valid_uri(args.conn_uri):
+            msg = f'The URI provided to --conn-uri is invalid: {args.conn_uri}'
+            raise SystemExit(msg)
         for arg in alternative_conn_specs:
             if getattr(args, arg) is not None:
                 invalid_args.append(arg)
     elif not args.conn_type:
         missing_args.append('conn-uri or conn-type')
     if missing_args:
-        msg = 'The following args are required to add a connection:' + f' {missing_args!r}'
+        msg = f'The following args are required to add a connection: {missing_args!r}'

Review comment:
       This line and line 200 are not really related to this PR's scope. But fixing them is too minor and maybe not worth creating separate PR for them. So fixing them together here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org