HewlettPackard / oneview-chef

This project is no longer being developed and has limited support. In the near future this repository will be fully deprecated. Please consider using other OneView projects, such as Terraform and Ansible Collection
https://supermarket.chef.io/cookbooks/oneview
Apache License 2.0
17 stars 15 forks source link

Global client config #90

Closed jsmartt closed 7 years ago

jsmartt commented 7 years ago

Scenario/Intent

I'd like to be able to set the client object once and then all resources that don't set the client property will use that as a default.

Environment Details

Steps to Reproduce

[If you are filing an issue, what are the things we need to do in order to reproduce your problem? How are you using this cookbook or any resources it includes?]

Expected Result

Set the client object once and everything that doesn't override it will use that as a default.

Actual Result

You have to pass in a client object for EVERY resource

jsmartt commented 7 years ago

Also, it should use the environment variables that the SDK defines; so a user may never have to define a client in their code.

tmiotto commented 7 years ago

I think the ENV variables may not be safest and not the simplest option for storing multiple clients. The main use case we came up for the client's use was storing and retrieving them from databags. The client is just exposed in the examples for demonstration purposes.

jsmartt commented 7 years ago

Well, you'd only be able to use the ENV variables for a single default client. Anything else would need to use another method. I think we can still recommend using a secure method like an encrypted databag or secrets management solution (e.g., Hashicorp Vault). What I'm trying to accomplish with ENV variables is a consistent pattern in both the SDK and the cookbook. If we do this, we'll also make it much easier for people to run the examples, and we can even use the examples internally as more of an integration test.