Skip to content

Commit

Permalink
refactor: handle of accountIds in json_module
Browse files Browse the repository at this point in the history
  • Loading branch information
Romazes committed Sep 19, 2024
1 parent 7ca79fc commit 6564fc5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lean/models/json_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,21 @@ def config_build(self,
logger.info(f'The account ID: {user_provide_account_id}')
inner_config._value = user_provide_account_id
else:
raise ValueError(f"The account ID '{user_provide_account_id}' "
f"you provided is not valid in the configuration '{inner_config._id}'."
f"Please double-check the account ID and try again.")
raise ValueError(f"The provided account id '{user_provide_account_id} is not valid, "
f"available: {api_account_ids}")
if api_account_ids and len(api_account_ids) > 0:
if len(api_account_ids) == 1:
logger.info(f'The account ID: {api_account_ids[0]}')
inner_config._value = api_account_ids[0]
else:
inner_config._input_method = "choice"
inner_config._choices = api_account_ids
inner_config._value = inner_config.ask_user_for_input(inner_config._input_default,
logger,
hide_input=hide_input)
break
continue
elif isinstance(configuration, AccountIdsConfiguration) and inner_config._input_method != "choice":
elif isinstance(configuration, AccountIdsConfiguration):
continue

property_name = self.convert_lean_key_to_variable(configuration._id)
Expand Down

0 comments on commit 6564fc5

Please sign in to comment.