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 2022/08/21 15:52:41 UTC

[GitHub] [airflow] chenglongyan opened a new pull request, #25854: Add roles delete command to cli

chenglongyan opened a new pull request, #25854:
URL: https://github.com/apache/airflow/pull/25854

   closes: #15318
   
   Screenshoot:
   ---
   ![image](https://user-images.githubusercontent.com/2135242/185799545-c3c9b034-e589-4913-8568-6739d29b48f7.png)
   
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+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 a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] uranusjr commented on a diff in pull request #25854: Add roles delete command to cli

Posted by GitBox <gi...@apache.org>.
uranusjr commented on code in PR #25854:
URL: https://github.com/apache/airflow/pull/25854#discussion_r952124722


##########
airflow/cli/commands/role_command.py:
##########
@@ -47,6 +47,16 @@ def roles_create(args):
     print(f"Added {len(args.role)} role(s)")
 
 
+@cli_utils.action_cli
+@suppress_logs_and_warning
+def roles_delete(args):
+    """Deletes role in DB"""
+    appbuilder = cached_app().appbuilder
+    for role_name in args.role:
+        appbuilder.sm.delete_role(role_name)

Review Comment:
   This crashes if `role_name` does not exist so you need to validate before passing the value in.



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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk merged pull request #25854: Add roles delete command to cli

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #25854:
URL: https://github.com/apache/airflow/pull/25854


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] uranusjr commented on pull request #25854: Add roles delete command to cli

Posted by GitBox <gi...@apache.org>.
uranusjr commented on PR #25854:
URL: https://github.com/apache/airflow/pull/25854#issuecomment-1225556723

   Logic looks good to me from a quick glance. Can you add a test for this?


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] chenglongyan commented on pull request #25854: Add roles delete command to cli

Posted by GitBox <gi...@apache.org>.
chenglongyan commented on PR #25854:
URL: https://github.com/apache/airflow/pull/25854#issuecomment-1225907252

   Added unit tests.
   
   > Logic looks good to me from a quick glance. Can you add a test for this?
   
   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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