Last active
July 25, 2018 10:52
-
-
Save 0xIslamTaha/23454440af1fdeb79008a11ae13e0540 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [61]: robot.services.names | |
Out[61]: | |
{'newWorker2': robot://main/github.com/zero-os/0-templates/zerotier_client/0.0.1?name=newWorker2&guid=0d03ed00-092e-45d3-b6a3-9acc7a007f00, | |
'vm001': robot://main/github.com/jumpscale/digital_me/vm/0.0.1?name=vm001&guid=cf0d9edf-e263-4978-a3b0-5bbf1c0d6e8c} | |
In [62]: robot.services.find_or_create('github.com/zero-os/0-templates/zerotier_client/0.0.1', 'myZTClient', {'token':'MyuDhfUYxCkc8eCH8cA4bt4WMgR6saWT'}) | |
--------------------------------------------------------------------------- | |
ServiceNotFoundError Traceback (most recent call last) | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in find_or_create(self, template_uid, service_name, data, public) | |
203 try: | |
--> 204 return self.get(template_uid=template_uid, name=service_name) | |
205 except ServiceNotFoundError: | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in get(self, **kwargs) | |
122 elif i <= 0: | |
--> 123 raise ServiceNotFoundError("service not found: query was: %s" % str(kwargs)) | |
124 return results[0] | |
ServiceNotFoundError: "service not found: query was: {'name': 'myZTClient', 'template_uid': 'github.com/zero-os/0-templates/zerotier_client/0.0.1'}" | |
During handling of the above exception, another exception occurred: | |
HTTPError Traceback (most recent call last) | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in create(self, template_uid, service_name, data, public) | |
155 try: | |
--> 156 new_service, resp = self._client.api.services.createService(req) | |
157 except HTTPError as err: | |
/opt/code/github/zero-os/0-robot/JumpScale9Zrobot/clients/zerorobot/client/services_service.py in createService(self, data, headers, query_params, content_type) | |
212 uri = self.client.base_url + "/services" | |
--> 213 resp = self.client.post(uri, data, headers, query_params, content_type) | |
214 try: | |
/opt/code/github/zero-os/0-robot/JumpScale9Zrobot/clients/zerorobot/client/http_client.py in post(self, uri, data, headers, params, content_type) | |
61 def post(self, uri, data, headers, params, content_type): | |
---> 62 return self._handle_data(uri, data, headers, params, content_type, self.session.post) | |
63 | |
/opt/code/github/zero-os/0-robot/JumpScale9Zrobot/clients/zerorobot/client/http_client.py in _handle_data(self, uri, data, headers, params, content_type, method) | |
57 res = method(uri, json=data, headers=headers, params=params) | |
---> 58 res.raise_for_status() | |
59 return res | |
/usr/local/lib/python3.5/dist-packages/requests/models.py in raise_for_status(self) | |
938 if http_error_msg: | |
--> 939 raise HTTPError(http_error_msg, response=self) | |
940 | |
HTTPError: 409 Client Error: CONFLICT for url: http://localhost:6600/services | |
During handling of the above exception, another exception occurred: | |
ServiceConflictError Traceback (most recent call last) | |
/usr/local/bin/js9 in <module>() | |
----> 1 robot.services.find_or_create('github.com/zero-os/0-templates/zerotier_client/0.0.1', 'myZTClient', {'token':'MyuDhfUYxCkc8eCH8cA4bt4WMgR6saWT'}) | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in find_or_create(self, template_uid, service_name, data, public) | |
204 return self.get(template_uid=template_uid, name=service_name) | |
205 except ServiceNotFoundError: | |
--> 206 return self.create(template_uid=template_uid, service_name=service_name, data=data, public=public) | |
207 | |
208 | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in create(self, template_uid, service_name, data, public) | |
161 if err.response.status_code == 409: | |
162 if code == 409: | |
--> 163 raise ServiceConflictError(msg, None) | |
164 if code == 4090: | |
165 raise TemplateConflictError(msg) | |
ServiceConflictError: a service with name 'myZTClient' already exists | |
In [63]: robot.services.names | |
Out[63]: | |
{'newWorker2': robot://main/github.com/zero-os/0-templates/zerotier_client/0.0.1?name=newWorker2&guid=0d03ed00-092e-45d3-b6a3-9acc7a007f00, | |
'vm001': robot://main/github.com/jumpscale/digital_me/vm/0.0.1?name=vm001&guid=cf0d9edf-e263-4978-a3b0-5bbf1c0d6e8c} | |
In [64]: robot.services.get(name='myZTClient') | |
--------------------------------------------------------------------------- | |
ServiceNotFoundError Traceback (most recent call last) | |
/usr/local/bin/js9 in <module>() | |
----> 1 robot.services.get(name='myZTClient') | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in get(self, **kwargs) | |
121 raise TooManyResults("%d services found" % i) | |
122 elif i <= 0: | |
--> 123 raise ServiceNotFoundError("service not found: query was: %s" % str(kwargs)) | |
124 return results[0] | |
125 | |
ServiceNotFoundError: "service not found: query was: {'name': 'myZTClient'}" | |
In [65]: robot.services.create('github.com/zero-os/0-templates/zerotier_client/0.0.1', 'myZTClient', {'token':'MyuDhfUYxCkc8eCH8cA4bt4WMgR6saWT'}) | |
--------------------------------------------------------------------------- | |
HTTPError Traceback (most recent call last) | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in create(self, template_uid, service_name, data, public) | |
155 try: | |
--> 156 new_service, resp = self._client.api.services.createService(req) | |
157 except HTTPError as err: | |
/opt/code/github/zero-os/0-robot/JumpScale9Zrobot/clients/zerorobot/client/services_service.py in createService(self, data, headers, query_params, content_type) | |
212 uri = self.client.base_url + "/services" | |
--> 213 resp = self.client.post(uri, data, headers, query_params, content_type) | |
214 try: | |
/opt/code/github/zero-os/0-robot/JumpScale9Zrobot/clients/zerorobot/client/http_client.py in post(self, uri, data, headers, params, content_type) | |
61 def post(self, uri, data, headers, params, content_type): | |
---> 62 return self._handle_data(uri, data, headers, params, content_type, self.session.post) | |
63 | |
/opt/code/github/zero-os/0-robot/JumpScale9Zrobot/clients/zerorobot/client/http_client.py in _handle_data(self, uri, data, headers, params, content_type, method) | |
57 res = method(uri, json=data, headers=headers, params=params) | |
---> 58 res.raise_for_status() | |
59 return res | |
/usr/local/lib/python3.5/dist-packages/requests/models.py in raise_for_status(self) | |
938 if http_error_msg: | |
--> 939 raise HTTPError(http_error_msg, response=self) | |
940 | |
HTTPError: 409 Client Error: CONFLICT for url: http://localhost:6600/services | |
During handling of the above exception, another exception occurred: | |
ServiceConflictError Traceback (most recent call last) | |
/usr/local/bin/js9 in <module>() | |
----> 1 robot.services.create('github.com/zero-os/0-templates/zerotier_client/0.0.1', 'myZTClient', {'token':'MyuDhfUYxCkc8eCH8cA4bt4WMgR6saWT'}) | |
/opt/code/github/zero-os/0-robot/zerorobot/dsl/ZeroRobotManager.py in create(self, template_uid, service_name, data, public) | |
161 if err.response.status_code == 409: | |
162 if code == 409: | |
--> 163 raise ServiceConflictError(msg, None) | |
164 if code == 4090: | |
165 raise TemplateConflictError(msg) | |
ServiceConflictError: a service with name 'myZTClient' already exists | |
In [66]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment