Skip to content

Conversation

@allmightyspiff
Copy link
Member

@allmightyspiffallmightyspiff commented Nov 27, 2018

slcli config setup would error out if the endpoint you selected was not xmlrpc, or if you had an exiting endpoint that was REST and picked xmlrpc.

This change should fix that.

fixes#1074

Copy link
Contributor

@acamacho82acamacho82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't reproduce the errors reported before but it seems that not all commands work as with the XMLRPC endpoint, for example:

REST:

$ slcli image list --private :....:......:......:............:.........: : id : name : type : visibility : account : :....:......:......:............:.........: :....:......:......:............:.........: 

XMLRPC:

$ slcli image list --private :.........:...............................................:...........:............:.........: : id : name : type : visibility : account : :.........:...............................................:...........:............:.........: : 11111111: AJCB-TESTIMPO01 : ISO Image : Private : ####### : : 2222222 : AJCB-VSI54786469-localdisk : System : Private : ####### : : 3333333 : Ajcb0Image1111111111 : System : Private : ####### : : 3333333 : Ajcb0Image2A2A2A : System : Private : ####### : : 4444444 : Ajcb0Image3D3D3D3D : None : Private : ####### : : 5555555 : testTemplate : System : Private : ####### : :.........:...............................................:...........:............:.........: 

@allmightyspiff
Copy link
MemberAuthor

To generate this error, on the master branch, your config needs to have the rest endpoint set.

(py3) ~/Code/softlayer-python>> master $> grep -i "^endpoint" ~/.softlayer endpoint_url = https://api.softlayer.com/rest/v3.1/ (py3) ~/Code/softlayer-python>>maste $> ./slcli config setup Username [myusername]: API Key or Password [myapikeyhere]: Endpoint (public|private|custom) [public]: Timeout [60.0]: An unexpected error has occured: Traceback (most recent call last): File "/Users/christopher/Code/softlayer-python/SoftLayer/CLI/core.py", line 182, in main cli.main(**kwargs) File "/Users/christopher/.virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Users/christopher/.virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/christopher/.virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/christopher/.virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/christopher/.virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/Users/christopher/.virtualenvs/py3/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func return ctx.invoke(f, obj, *args, **kwargs) File "/Users/christopher/.virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/Users/christopher/Code/softlayer-python/SoftLayer/CLI/config/setup.py", line 52, in cli api_key = get_api_key(env.client, username, secret) File "/Users/christopher/Code/softlayer-python/SoftLayer/CLI/config/setup.py", line 26, in get_api_key client['Account'].getCurrentUser() File "/Users/christopher/Code/softlayer-python/SoftLayer/API.py", line 387, in call_handler return self(name, *args, **kwargs) File "/Users/christopher/Code/softlayer-python/SoftLayer/API.py", line 355, in call return self.client.call(self.name, name, *args, **kwargs) File "/Users/christopher/Code/softlayer-python/SoftLayer/API.py", line 263, in call return self.transport(request) File "/Users/christopher/Code/softlayer-python/SoftLayer/transports.py", line 436, in __call__ call.result = self.transport(call) File "/Users/christopher/Code/softlayer-python/SoftLayer/transports.py", line 382, in __call__ result = json.loads(resp.text) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Feel free to report this error as it is likely a bug: https://github.com/softlayer/softlayer-python/issues The following snippet should be able to reproduce the error 

slcli image list is already something known to not work with rest: #962, even though it does get data back...

@acamacho82
Copy link
Contributor

sorry, I wanted to say I tested your fix and I couldn't reproduce that errors again. I think this can be merged once the failed unittest has been fixed

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 89.846% when pulling 5dc451f on allmightyspiff:1074 into 42cd438 on softlayer:master.

@allmightyspiffallmightyspiff merged commit c925e58 into softlayer:masterNov 28, 2018
@allmightyspiffallmightyspiff deleted the 1074 branch August 31, 2020 22:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected Error occured when writing SL settings to "/home/vagrant/.softlayer"

3 participants

@allmightyspiff@acamacho82@coveralls