-
Notifications
You must be signed in to change notification settings - Fork 192
IBMid Authentication support #1447
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing
- ✔️ $ slcli config setup --auth=cloud_key
- ✔️ $ slcli config setup --auth classic_key
- ❌ $ slcli config setup --auth sso
Endpoint (public|private|custom) [https://api.softlayer.com/rest/v3.1]:
Get a one-time code from https://identity-1.us-south.iam.cloud.ibm.com/identity/passcode to proceed.
Open the URL in the default browser? [Y/n] [Y]: n
One-time code: code-test
An unexpected error has occured:
Traceback (most recent call last):
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/CLI/core.py", line 209, in main
cli.main(**kwargs)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/CLI/config/setup.py", line 83, in cli
username, api_key = sso_login(env)
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/CLI/config/setup.py", line 255, in sso_login
client = SoftLayer.API.IAMClient(config_file=env.config_file)
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/API.py", line 178, in __init__
timeout=self.settings['softlayer'].getint('timeout'),
File "/usr/lib/python3.6/configparser.py", line 1283, in get
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 819, in getint
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 809, in _get_conv
**kwargs)
File "/usr/lib/python3.6/configparser.py", line 803, in _get
return conv(self.get(section, option, **kwargs))
ValueError: invalid literal for int() with base 10: '30.0'
- ❌ $ slcli config setup --auth ibmid
Endpoint (public|private|custom) [https://api.softlayer.com/rest/v3.1]:
Email: [email protected]
Password:
An unexpected error has occured:
Traceback (most recent call last):
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/CLI/core.py", line 209, in main
cli.main(**kwargs)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/.../lib/python3.6/site-packages/Click-7.0-py3.6.egg/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/CLI/config/setup.py", line 74, in cli
username, api_key = ibmid_login(env)
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/CLI/config/setup.py", line 153, in ibmid_login
client = SoftLayer.API.IAMClient(config_file=env.config_file)
File "/home/.../lib/python3.6/site-packages/SoftLayer-5.9.3-py3.6.egg/SoftLayer/API.py", line 178, in __init__
timeout=self.settings['softlayer'].getint('timeout'),
File "/usr/lib/python3.6/configparser.py", line 1283, in get
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 819, in getint
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 809, in _get_conv
**kwargs)
File "/usr/lib/python3.6/configparser.py", line 803, in _get
return conv(self.get(section, option, **kwargs))
ValueError: invalid literal for int() with base 10: '30.0'
As a workaround, changing the value in the file "~/.softlayer" from timeout = 30.0
to timeout = 30
, then failed tests work as expected.
- OS ubuntu 18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and It is working well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Allows for using an IBMid when using
config setup
.Testing
slcli config setup --ibmid
Will let you login with the Username/Password that you can login to cloud.ibm.com with (unless you have an @ibm.com email, then use --sso)
slcli config setup --sso
Lets you login with your SSO Token, will prompt the user to open a webpage to get the token
slcli config setup --cloud_key
Uses a IBM Cloud API key to login
slcli config setup --classic_key
Old behavior, uses classic API keys. Can still use the old SL password as well.
The IBMid setups will still create an SL API key for the user at the end though.