Skip to content

Unhandled exception when no country code for user (and no default in config) #18

Closed
@adorton-adobe

Description

@adorton-adobe

When no default country code is specified in the config file, the script will crash with an unhandled exception when creating a user with a blank country code.

2017-02-13 11:13:19 26645 ERROR main - Unhandled exception
Traceback (most recent call last):
  File "/home/adorton/.pex/install/user_sync-1.0-py2-none-any.whl.93526b61b26b84904dc82e42af6e4e60d8bd70d9/user_sync-1.0-py2-none-any.whl/user_sync/app.py", line 261, in main
    begin_work(config_loader)
  File "/home/adorton/.pex/install/user_sync-1.0-py2-none-any.whl.93526b61b26b84904dc82e42af6e4e60d8bd70d9/user_sync-1.0-py2-none-any.whl/user_sync/app.py", line 167, in begin_work
    rule_processor.run(directory_groups, directory_connector, dashboard_connectors)
  File "/home/adorton/.pex/install/user_sync-1.0-py2-none-any.whl.93526b61b26b84904dc82e42af6e4e60d8bd70d9/user_sync-1.0-py2-none-any.whl/user_sync/rules.py", line 93, in run
    self.process_dashboard_users(dashboard_connectors)
  File "/home/adorton/.pex/install/user_sync-1.0-py2-none-any.whl.93526b61b26b84904dc82e42af6e4e60d8bd70d9/user_sync-1.0-py2-none-any.whl/user_sync/rules.py", line 189, in process_dashboard_users
    self.add_dashboard_user(user_key, dashboard_connectors)
  File "/home/adorton/.pex/install/user_sync-1.0-py2-none-any.whl.93526b61b26b84904dc82e42af6e4e60d8bd70d9/user_sync-1.0-py2-none-any.whl/user_sync/rules.py", line 389, in add_dashboard_user
    dashboard_connectors.get_owning_connector().send_commands(commands, callback)
  File "/home/adorton/.pex/install/user_sync-1.0-py2-none-any.whl.93526b61b26b84904dc82e42af6e4e60d8bd70d9/user_sync-1.0-py2-none-any.whl/user_sync/connector/dashboard.py", line 120, in send_commands
    action = action_manager.create_action(commands)
  File "/home/adorton/.pex/install/user_sync-1.0-py2-none-any.whl.93526b61b26b84904dc82e42af6e4e60d8bd70d9/user_sync-1.0-py2-none-any.whl/user_sync/connector/dashboard.py", line 243, in create_action
    command_function(**command_param)
  File "/home/adorton/.pex/install/umapi_client-2.0.2-py2.py3-none-any.whl.78eb80b1f5c32494273374a205db3c5917772c76/umapi_client-2.0.2-py2.py3-none-any.whl/umapi_client/functional.py", line 175, in create
    raise ValueError("You must specify country when creating a Federated ID")
ValueError: You must specify country when creating a Federated ID
2017-02-13 11:13:19 26645 INFO main - ========== End Run (Total time: 0:00:11) ===================

It would probably be better to handle the error by writing an error message to the log and continuing the sync process. Crashing the script could prevent valid users from being created (e.g. if those users come after an invalid user in a list of users to create).

If a customer opts to not provide a default country code, logging instances of users with no country code will allow them to use their logs to identify user records that need to be fixed in their directory systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions