Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional/hidden configuration fields are actually required by client classes #13

Closed
mikattack opened this issue Apr 14, 2017 · 2 comments

Comments

@mikattack
Copy link

The documentation states:

Since config is a dict, you can also build it manually and check it with config.validate_config()

So I create a simple dictionary similar to this:

{
    "user" = ...,
    "tenancy" = ...,
    "fingerprint" = ...,
    "key_file" = ...,
    "region" = ...
}

That dictionary passes the validate_config() check.

However, when attempting to create a VirtualNetworkClient I get a KeyError for pass_phrase.

After looking at the oraclebmc/config.py and oraclebmc/core/virtual_network_client.py source code, it appears that client code makes the assumption that all configuration dictionaries have these optional fields populated. Configurations loaded with config.from_file() automatically pre-populate these fields. But synthetic ones obviously do not.

The client classes should validate whether these optional values are present in the configuration before assigning them in their constructors.

@priteshkp
Copy link
Member

Thanks for the report, Alex. I'll have somebody take a look.

@jodoglevy
Copy link
Member

Looks like the error is coming from https://github.com/oracle/bmcs-python-sdk/blob/master/oraclebmc/core/virtual_network_client.py#L25, for the reasons you mentioned above (we only merge configs from a file with the default config (https://github.com/oracle/bmcs-python-sdk/blob/master/oraclebmc/config.py#L36), not any synthetic configs. I'll file an internal issue to track, should be relatively simple to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants