Skip to content

Invalid connection settings not throwing reasonable exceptions #196

Description

@nuwang

Having invalid connection settings such as a None value for subscription_id in Azure, does not throw a reasonable exception.

E.g. the error thrown is as follows

  File "/Users/Nuwan/work/djcloudbridge/djcloudbridge/domain_model.py", line 50, in get_cloud_provider
    config)
  File "/Users/Nuwan/work/djcloudbridge/venv/lib/python3.6/site-packages/cloudbridge/cloud/factory.py", line 142, in create_provider
    return provider_class(config)
  File "/Users/Nuwan/work/djcloudbridge/venv/lib/python3.6/site-packages/cloudbridge/cloud/providers/azure/provider.py", line 52, in __init__
    'storacc' + self.subscription_id[-6:] +
TypeError: 'NoneType' object is not subscriptable

The ideal behaviour is to accept an empty Config without errors, because sometimes, the config settings may come from a boto config for example. but for provider.authenticate() and any connection related methods to throw an appropriate error, like InvalidProviderSetting or similar. If the setting is definitely invalid, then we can throw an InvalidProviderSetting even earlier, during provider instantiation itself.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions