slipstream / SlipStreamClient

SlipStream Python client
Apache License 2.0
1 stars 4 forks source link

get and assemble UserInfo from corresponding CIMI resources #387

Closed konstan closed 6 years ago

konstan commented 6 years ago

Connected to #385

0xbase12 commented 6 years ago

I have this in the logs. my test instance. I have the cimi connectors but not visible to users. Perhaps it's related to how you retrieve them. Could you have a look

 2018-02-20T07:40:04.825+0000 WARNING com.sixsq.slipstream.util.SscljProxy request ResourceException: Not Found
        with request: method=GET, resource=api/, object=null, authnInfo=super ADMIN, queryParameters=[], mediaType=application/json
        with status: Not Found (404) - Not Found
        with content: {
  "status" : 404,
  "message" : "unknown resource",
  "resource-id" : "/api/"
}
konstan commented 6 years ago

The resource accessed with GET is resource=api/. An actual cimi resource (collection or instance) is missing in the request. Can you provide more logs to get the context where/when the call is made?

0xbase12 commented 6 years ago

I see nothing more in the logs. It happen when I start a service testing deployment. Probably when orchestrator retrieve the configuration

0xbase12 commented 6 years ago

: 2018-02-20T08:33:00Z : 
ERROR: Error executing node, with detail: Not Found
Traceback (most recent call last):
  File "/opt/slipstream/client/lib/slipstream/executors/MachineExecutor.py", line 106, in _execute_state
    getattr(self, method_name)()
  File "/opt/slipstream/client/lib/slipstream/util.py", line 119, in overrided_func
    return func(self, *args, **kwargs)
  File "/opt/slipstream/client/lib/slipstream/executors/node/NodeDeploymentExecutor.py", line 49, in onProvisioning
    self._add_ssh_pubkey(self.node_instance.get_username())
  File "/opt/slipstream/client/lib/slipstream/executors/node/NodeDeploymentExecutor.py", line 183, in _add_ssh_pubkey
    append_ssh_pubkey_to_authorized_keys(self._get_user_ssh_pubkey(), login_user)
  File "/opt/slipstream/client/lib/slipstream/executors/node/NodeDeploymentExecutor.py", line 186, in _get_user_ssh_pubkey
    return self.wrapper.get_user_ssh_pubkey()
  File "/opt/slipstream/client/lib/slipstream/wrappers/BaseWrapper.py", line 239, in get_user_ssh_pubkey
    userInfo = self._get_user_info('')
  File "/opt/slipstream/client/lib/slipstream/wrappers/BaseWrapper.py", line 602, in _get_user_info
    self._user_info = self._ss_client.get_user_info(cloud_service_name)
  File "/opt/slipstream/client/lib/slipstream/SlipStreamHttpClient.py", line 127, in get_user_info
    connector_conf = self._get_connector_conf(cloud_qualifier)
  File "/opt/slipstream/client/lib/slipstream/SlipStreamHttpClient.py", line 113, in _get_connector_conf
    accept='application/json')
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 128, in get
    resp = self._call(url, 'GET', accept=accept, retry=retry)
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 249, in _call
    resp = _handle_response(resp)
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 226, in _handle_response
    return _handle4xx(resp)
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 176, in _handle4xx
    raise clientEx
NotFoundError: Not Found

: 2018-02-20T08:33:00Z : 
ERROR: Failing... Exception <class 'slipstream.exceptions.Exceptions.NotFoundError'> with detail: Not Found
Traceback (most recent call last):
  File "/opt/slipstream/client/lib/slipstream/executors/MachineExecutor.py", line 106, in _execute_state
    getattr(self, method_name)()
  File "/opt/slipstream/client/lib/slipstream/util.py", line 119, in overrided_func
    return func(self, *args, **kwargs)
  File "/opt/slipstream/client/lib/slipstream/executors/node/NodeDeploymentExecutor.py", line 49, in onProvisioning
    self._add_ssh_pubkey(self.node_instance.get_username())
  File "/opt/slipstream/client/lib/slipstream/executors/node/NodeDeploymentExecutor.py", line 183, in _add_ssh_pubkey
    append_ssh_pubkey_to_authorized_keys(self._get_user_ssh_pubkey(), login_user)
  File "/opt/slipstream/client/lib/slipstream/executors/node/NodeDeploymentExecutor.py", line 186, in _get_user_ssh_pubkey
    return self.wrapper.get_user_ssh_pubkey()
  File "/opt/slipstream/client/lib/slipstream/wrappers/BaseWrapper.py", line 239, in get_user_ssh_pubkey
    userInfo = self._get_user_info('')
  File "/opt/slipstream/client/lib/slipstream/wrappers/BaseWrapper.py", line 602, in _get_user_info
    self._user_info = self._ss_client.get_user_info(cloud_service_name)
  File "/opt/slipstream/client/lib/slipstream/SlipStreamHttpClient.py", line 127, in get_user_info
    connector_conf = self._get_connector_conf(cloud_qualifier)
  File "/opt/slipstream/client/lib/slipstream/SlipStreamHttpClient.py", line 113, in _get_connector_conf
    accept='application/json')
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 128, in get
    resp = self._call(url, 'GET', accept=accept, retry=retry)
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 249, in _call
    resp = _handle_response(resp)
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 226, in _handle_response
    return _handle4xx(resp)
  File "/opt/slipstream/client/lib/slipstream/HttpClient.py", line 176, in _handle4xx
    raise clientEx
NotFoundError: Not Found
konstan commented 6 years ago

@0xbase12 fixed in f33178c

Now looking at the issue with login to Orch from SS instance.

konstan commented 6 years ago

@0xbase12 I can login w/o issues into orch from SS.

[root@machinebca3881f-dfb2-453a-b96f-98ff2a36e827 ~]# ssh -i /opt/slipstream/server/.ssh/id_rsa root@185.19.29.243 true
The authenticity of host '185.19.29.243 (185.19.29.243)' can't be established.
ECDSA key fingerprint is SHA256:NFgrT2+ryEQwPSd6MVXlzOuGKSjjNKcxIU2V+Ff++UM.
ECDSA key fingerprint is MD5:56:f6:6a:6e:ee:14:04:7c:04:ae:79:75:d9:a0:51:0b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '185.19.29.243' (ECDSA) to the list of known hosts.
[root@machinebca3881f-dfb2-453a-b96f-98ff2a36e827 ~]#

I also see that the pub key is provided to CLI during the run (orch) provisioning with __SLIPSTREAM_SSH_PUB_KEY.

 2018-02-20T12:22:35.610+0000 INFO com.sixsq.slipstream.util.ProcessUtils execGetOutputAsArray Calling: sh -c /usr/bin/exoscale-run-instances --native-contextualization 'linux-only' --zone 'CH-GVA-2' --disk-size '10G' --instance-type 'Micro' --security-groups 'slipstream_managed' --login-username '' --username 'xxx' --image-id 'Linux Ubuntu 14.04 LTS 64-bit' --network-type 'Public'
 2018-02-20T12:22:35.610+0000 FINE com.sixsq.slipstream.util.ProcessUtils execGetOutputAsArray   with the following environment: {SLIPSTREAM_CLOUD=exoscale, CLOUDCONNECTOR_PYTHON_MODULENAME=slipstream_exoscale.ExoscaleClientCloud, SLIPSTREAM_VERBOSITY_LEVEL=1, SLIPSTREAM_SERVICEURL=https://159.100.242.196, SLIPSTREAM_BUNDLE_URL=https://159.100.242.196/downloads/slipstreamclient.tgz, __SLIPSTREAM_SSH_PUB_KEY=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLKkm99nWF6diJUpo5LskB4STwuWPN2GryuhTRfuS+bQcfXqjJMmbakb2eQ+7iTS1lw91PKnbDF4+HBeOexjRFIM+qTL7O2a3VRDHbQ+vpUVj5Iwd3Uok7qOnj0Qh6rA9RmsoDh+mtaOJ6ByZLHoB22ZsMACzQkNYcwsq7Du9NQtOrnO9Y95taq3mDMKhLW8S46YZafqfJ9n+Yvvn4H9dGZY7pJ5eCWrTnJxL7tATJgOgaOuiJQfifSiYSox412dy9SxNjo1F9AucAN26wquca4hKyhG7+81zkmxOUW/3iQGAEx2JsyEPT5CVadF+A3DRWP0QH9RkTKyAQGGEF3nAL root@machinebca3881f-dfb2-453a-b96f-98ff2a36e827
, SLIPSTREAM_USERNAME=test, SLIPSTREAM_API_SECRET=secret, SLIPSTREAM_NODE_INSTANCE_NAME=orchestrator-exoscale-ch-gva, IS_ORCHESTRATOR=True, SLIPSTREAM_BOOTSTRAP_BIN=https://159.100.242.196/downloads/slipstream.bootstrap, SLIPSTREAM_API_KEY=credential/cffe492c-8b3f-4b58-acb3-c3eab4b2a60b, SLIPSTREAM_DIID=6504e411-cfe6-47de-9647-5ab26f6cb0cb, SLIPSTREAM_CONNECTOR_INSTANCE=exoscale-ch-gva, CLOUDCONNECTOR_BUNDLE_URL=https://159.100.242.196/downloads/exoscaleclient.tgz, __SLIPSTREAM_CLOUD_PASSWORD=yyy}

Can you check this again on your side please?

konstan commented 6 years ago

@0xbase12 Please don't redo the tests. I might have been testing with an old slipstreamclient.tgz. I'll update you.