Closed dougmbaya closed 9 years ago
Hey,
That looks like a bad assumption on our part. The usernames our team have with most providers don't include an @
symbol. Do you think it makes sense to split the username and organisation on just the last @
?
I think we could add an "If" logic as such that the algorithm can detect that the username is an email address and act accordingly by only slicing starting from the 2nd "@" ?
I've raised a pull request against fog/fog (linked above) which should fix it.
If you'd like to test it out you can do the following:
➜ govuk git clone git@github.com:fog/fog.git
➜ govuk cd fog
➜ fog git:(master) git fetch origin pull/3229/head:pr-3229
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
From github.com:fog/fog
* [new ref] refs/pull/3229/head -> pr-3229
➜ fog git:(master) git co pr-3229
Switched to branch 'pr-3229'
➜ fog git:(pr-3229) cd ../vcloud-core
➜ vcloud-core git:(master) ✗ export VCLOUD_TOOLS_DEV_FOG_LOCAL=true
➜ vcloud-core git:(master) ✗ bundle
Resolving dependencies...
…
Using fog (1.24.0) from source at ../fog
Using vcloud-core (0.13.0) from source at .
Using vcloud-tools-tester (0.2.0)
Your bundle is complete!
It was installed into /Users/dcarley/vendor/bundle
➜ vcloud-core git:(master) ✗ eval $(FOG_CREDENTIAL=skyscape b vcloud-login)
/Users/dcarley/vendor/bundle/gems/fog-core-1.24.0/lib/fog/core/version.rb:2: warning: already initialized constant VERSION
vCloud password:
This is my fault, I did consider email addresses as usernames but omitted to pass a parameter to join()
to add back the '@
' (as @dcarley did in fog/fog#3229 - thanks!).
@dcarley's pull request (fog/fog#3229) has been merged. Once a new version of Fog is released, I'll release a new version of vCloud Core and the other vCloud Tools which depend on it.
fog/fog#3229 was released upstream as Fog version 1.25.0. I've raised a PR to bump our dependency to that version: https://github.com/gds-operations/vcloud-core/pull/142
All of the vCloud Tools have now been re-released to depend on vCloud Core 0.16.0, which supports usernames containing email addresses. Thanks for reporting this @dougmbaya.
There seem to be a logic error in the compute file, specifically in the "check_session_matches_credentials(session_org, session_user)" function. vCloud API take credentials in the form of user@domain.com@organization but returns authentication token named user@domain.com.
The "fog_credential_user = @vcloud_director_username.split('@')[0...-1].join" removes both @ symboles witch returns userDomain.com instead of user@domain.com forcing the application to fail for token name mismatch.
Here is the exact error:
FOG_CREDENTIAL specified is for user 'usernameDomain.com' but your current session is for 'username@domain.com'. You should generate a new FOG_VCLOUD_TOKEN.
Any idea?