khalidmammadov commented on a change in pull request #18590:
URL: https://github.com/apache/airflow/pull/18590#discussion_r732640318
##########
File path: airflow/cli/commands/user_command.py
##########
@@ -174,12 +189,19 @@ def users_import(args):
print("Updated the following
users:\n\t{}".format("\n\t".join(users_updated)))
-def _import_users(users_list):
+def _import_users(users_list: List[Dict[str, Any]]):
appbuilder = cached_app().appbuilder
users_created = []
users_updated = []
for user in users_list:
+
+ try:
+ # Validate structure
+ UserSchema().load(user)
+ except ValidationError as e:
+ raise SystemExit(f"Error: Can't load user \"{user}\".
\nDetails:{e}")
Review comment:
Agreed. Added whole file validation before starting the import. Updated
tests accordingly
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]