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

Image Streamer Client cannot be created with the OneView environment variables #183

Closed
tmiotto opened this issue Feb 17, 2017 · 7 comments
Closed

Comments

@tmiotto
Copy link
Contributor

tmiotto commented Feb 17, 2017

Scenario/Intent

I want to create my Image Streamer client only using the environment variables:

  1. ENV['ONEVIEWSDK_URL'], ENV['ONEVIEWSDK_USER'], ENV['ONEVIEWSDK_PASSWORD'] and ENV['I3S_URL']
  2. ENV['ONEVIEWSDK_TOKEN'] and ENV['I3S_URL']
    but I can't, since it won't parse the OneView environment variables to gather the token.

Environment Details

  • OneView SDK Version: 4.0.0
  • OneView Client API Version: API300
  • Ruby Version: 2.2.6
  • Platform: N/A

Steps to Reproduce

  1. With OneView User/Password
    1. Set the environment variables: ENV['ONEVIEWSDK_URL'], ENV['ONEVIEWSDK_USER'], ENV['ONEVIEWSDK_PASSWORD'] and ENV['I3S_URL'] to valid values.
    2. Create the OneviewSDK::ImageStreamer::Client.new relying on the Environment variables.
  2. With OneView Token
    1. Set the environment variables: ENV['ONEVIEWSDK_TOKEN'] and ENV['I3S_URL'] to valid values.
    2. Create the OneviewSDK::ImageStreamer::Client.new relying on the Environment variables.

Expected Result

The Image Streamer client should be created succesfully with the environment variables values.

Actual Result

It fails:

OneviewSDK::InvalidClient:
  Must set token option
@aalexmonteiro
Copy link
Contributor

@tmiotto , Could not create, because the environment variable is I3S_TOKEN. But now I see that maybe not need this environment variable, and it may just be ONEVIEWSDK_TOKEN.

@jsmartt
Copy link
Collaborator

jsmartt commented Feb 17, 2017

👍 Yeah, I think we only need 1 env variable for a token (ONEVIEWSDK_TOKEN)

@aalexmonteiro
Copy link
Contributor

So in this case this would not be a bug, but an improvement. You agree? Correct me if I'm wrong. Please. :)

@jsmartt
Copy link
Collaborator

jsmartt commented Feb 17, 2017

Yeah. This is where that warning saying that I3S is experimental and subject to change at this point. We can easily change pretty much anything still. I'd label it an improvement and/or unexpected behavior.

@tmiotto
Copy link
Contributor Author

tmiotto commented Feb 20, 2017

Regarding number 2 okay, it may be an improvement if we would just want to remove the I3S Token.

But regarding number 1, if I'm using the ENV variables user and password for OneView why would I now have to do the login and get the token to use in Image Streamer?

@aalexmonteiro
Copy link
Contributor

aalexmonteiro commented Feb 20, 2017

@tmiotto , I think I understood your question. With the change made to the i3s login mode that was recently merged into the master, this is no longer necessary. But this case, the user would have to create the i3s_client instance with the method new_i3s_client of oneview client.

So, we can thought in a solution when the user wants uses the enviroments variables with user and password. Could be something like:

# on initialize of i3s client
if ENV['ONEVIEWSDK_USER'] && ENV['ONEVIEWSDK_PASSWORD'] && ENV['I3S_URL']
   ov_client = Oneview::Client.new
   @token = ov_client.token
end

@tmiotto
Copy link
Contributor Author

tmiotto commented Feb 21, 2017

@aalexmonteiro I see...

Well then we would have:

ov_client = OneviewSDK::Client.new # Relying on ONEVIEWSDK ENV
i3s_client = ov_client.new_image_streamer_client # Relying on I3S ENV

as the expected use case.

The one I was talking is:

i3s_client = OneviewSDK::ImageStreamer::Client.new # Relying on ONEVIEWSDK and I3S ENV

that I'm okay not implementing considering the expected and unexpected use cases would be thoroughly documented in the README, so we won't have users complaining that some other ways to create the client are not working when we are expecting them to not work.

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

No branches or pull requests

3 participants