uranusjr commented on a change in pull request #18590:
URL: https://github.com/apache/airflow/pull/18590#discussion_r732935344
##########
File path: airflow/cli/commands/user_command.py
##########
@@ -174,12 +189,23 @@ 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 = []
+ try:
+ UserSchema(many=True).load(users_list)
+ except ValidationError as e:
+ msg = []
+ for row_num, failure in e.messages.items():
+ msg.append(f'[Item {row_num}]')
+ for key in failure:
+ msg.append(f'\t{key}: {failure[key]}')
Review comment:
```suggestion
for key, value in failure.items():
msg.append(f'\t{key}: {value}')
```
--
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]