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:31:22 UTC

[GitHub] [airflow] XD-DENG opened a new pull request #12370: Reject 'connections add' CLI request if URI provided is invalid

XD-DENG opened a new pull request #12370:
URL: https://github.com/apache/airflow/pull/12370


   Closes https://github.com/apache/airflow/issues/12369
   
   - Reject the request is the URI is invalid
   - The validity is decided by availability of both 'scheme' and 'netloc' in the parse result
   
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [airflow] XD-DENG merged pull request #12370: Reject 'connections add' CLI request if URI provided is invalid

Posted by GitBox <gi...@apache.org>.
XD-DENG merged pull request #12370:
URL: https://github.com/apache/airflow/pull/12370


   


----------------------------------------------------------------
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



[GitHub] [airflow] github-actions[bot] commented on pull request #12370: Reject 'connections add' CLI request if URI provided is invalid

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12370:
URL: https://github.com/apache/airflow/pull/12370#issuecomment-727283026


   The PR should be OK to be merged with just subset of tests as it does not modify Core of Airflow. The committers might merge it or can add a label 'full tests needed' and re-run it to run all tests if they see it is needed!


----------------------------------------------------------------
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



[GitHub] [airflow] github-actions[bot] commented on pull request #12370: Reject 'connections add' CLI request if URI provided is invalid

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12370:
URL: https://github.com/apache/airflow/pull/12370#issuecomment-727264238


   [The Workflow run](https://github.com/apache/airflow/actions/runs/363589390) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
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