threefoldtecharchive / 0-templates

0-robot templates
Apache License 2.0
1 stars 1 forks source link

failed to create s3 service #166

Closed ramezsaeed closed 6 years ago

ramezsaeed commented 6 years ago
In [1]: demo.deploy_n(1,'kristof-farm', 20000, 16, 4)
[Wed17 12:19] - s3.py             :151 :j.s3demo             - INFO     - install zerotier client
[Wed17 12:19] - s3.py             :154 :j.s3demo             - INFO     - install s3 service
[Wed17 12:19] - ZeroRobotManager.py:176 :j.zerorobot          - ERROR    - fail to create service: Invalid nsName
---------------------------------------------------------------------------
ServiceNotFoundError                      Traceback (most recent call last)
/opt/code/github/threefoldtech/0-robot/zerorobot/dsl/ZeroRobotManager.py in find_or_create(self, template_uid, service_name, data, public)
    209         try:
--> 210             return self.get(template_uid=template_uid, name=service_name)
    211         except ServiceNotFoundError:

/opt/code/github/threefoldtech/0-robot/zerorobot/dsl/ZeroRobotManager.py in get(self, **kwargs)
    127         elif i <= 0:
--> 128             raise ServiceNotFoundError("service not found: query was: %s" % str(kwargs))
    129         return results[0]

ServiceNotFoundError: "service not found: query was: {'name': 's3_demo_0', 'template_uid': 'github.com/threefoldtech/0-templates/s3/0.0.1'}"

During handling of the above exception, another exception occurred:

HTTPError                                 Traceback (most recent call last)
/opt/code/github/threefoldtech/0-robot/zerorobot/dsl/ZeroRobotManager.py in create(self, template_uid, service_name, data, public)
    160         try:
--> 161             new_service, resp = self._client.api.services.createService(req)
    162         except HTTPError as err:

/opt/code/github/threefoldtech/0-robot/JumpscaleZrobot/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/threefoldtech/0-robot/JumpscaleZrobot/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/threefoldtech/0-robot/JumpscaleZrobot/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: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:6600/services

During handling of the above exception, another exception occurred:

ServiceCreateError                        Traceback (most recent call last)
/opt/code/github/threefoldtech/demo/demo.py in <module>()
----> 1 demo.deploy_n(1,'kristof-farm', 20000, 16, 4)

/opt/code/github/threefoldtech/demo/demo.py in deploy_n(self, n, farm, size, data, parity, login, password)
     28             name = 's3_demo_%d' % i
     29             self.s3[name] = S3Manager(self, name)
---> 30             tasks.append(self.s3[name].deploy(farm, size=size, data=data, parity=parity, login=login, password=password))
     31         return tasks
     32 

/opt/code/github/threefoldtech/demo/s3.py in deploy(self, farm, size, data, parity, login, password)
    162             'minioLogin': login,
    163             'minioPassword': password}
--> 164         self._service = self.dm_robot.services.find_or_create('s3', self.name, data=s3_data)
    165         return self._service.schedule_action('install')
    166 

/opt/code/github/threefoldtech/0-robot/zerorobot/dsl/ZeroRobotManager.py in find_or_create(self, template_uid, service_name, data, public)
    210             return self.get(template_uid=template_uid, name=service_name)
    211         except ServiceNotFoundError:
--> 212             return self.create(template_uid=template_uid, service_name=service_name, data=data, public=public)
    213 
    214 

/opt/code/github/threefoldtech/0-robot/zerorobot/dsl/ZeroRobotManager.py in create(self, template_uid, service_name, data, public)
    175             logger = j.logger.get('zerorobot')
    176             logger.error('fail to create service: %s' % e['message'])
--> 177             raise ServiceCreateError(e['message'], err)
    178 
    179         return self._instantiate(new_service)

ServiceCreateError: Invalid nsName: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:6600/services

this is the only thing I can see on zrobot server logs

[Wed17 15:11] - pywsgi.py         :1183:j.zerorobot          - INFO     - ::1 - - [2018-10-17 15:11:05] "GET /services?name=zt&template_uid=github.com%2Fthreefoldtech%2F0-templates%2Fzerotier_client%2F0.0.1 HTTP/1.1" 200 367 0.020625
[Wed17 15:11] - pywsgi.py         :1183:j.zerorobot          - INFO     - ::1 - - [2018-10-17 15:11:05] "GET /templates HTTP/1.1" 200 9164 0.005791
[Wed17 15:11] - pywsgi.py         :1183:j.zerorobot          - INFO     - ::1 - - [2018-10-17 15:11:05] "GET /services?name=s3_demo_3&template_uid=github.com%2Fthreefoldtech%2F0-templates%2Fs3%2F0.0.1 HTTP/1.1" 200 109 0.020782
[Wed17 15:11] - pywsgi.py         :1183:j.zerorobot          - INFO     - ::1 - - [2018-10-17 15:11:05] "POST /services HTTP/1.1" 500 167 0.124032

service data

root@ubuntu:/opt/var/data/zrobot/zrobot_data/github.com/threefoldtech/0-templates/s3/s3_demo_0/25198eaa-58dc-4ed5-b5f1-d005e63770b9# cat data.yaml 
dataShards: 16
farmerIyoOrg: kristof-farm
master:
    address: ''
    name: ''
    node: ''
    url: ''
masterNodes: []
mgmtNic:
    id: 9bee8941b5b57903
    ztClient: zt
minioBlockSize: 1048576
minioLogin: admin
minioPassword: adminadmin
minioUrls:
    public: ''
    storage: ''
namespaces: []
nsName: ''
nsPassword: ''
parityShards: 4
storageSize: 20000
storageType: hdd
tlog:
    address: ''
    name: ''
    node: ''
    url: ''
zaibon commented 6 years ago

Christophe de Carvalho, [18.10.18 12:47] [In reply to Ramez Saeed] ServiceCreateError: Invalid nsName: 500 Server Error

You need to provide the nsName in the service data.

This is needed since: https://github.com/threefoldtech/0-templates/commit/b86a4876d61c1c29f18f760b40a630a3aed72f92

ramezsaeed commented 6 years ago

https://gist.github.com/john-kheir/d83888e153ebeffaaa93f04f59128538

zaibon commented 6 years ago

@ramezsaeed this error should be fixed by https://github.com/threefoldtech/0-robot/commit/8140f3443fb3a681fc789ddba1e2ed5b950d5c89 and https://github.com/threefoldtech/0-templates/commit/a8ae28e66466114cc2ae63a363ea152497d7430b