threefoldtecharchive / jumpscaleX_archived

Apache License 2.0
1 stars 6 forks source link

zos client: error when getting a container through clients.zos containers #636

Closed robvanmieghem closed 5 years ago

robvanmieghem commented 5 years ago
JSX> zos.client.container.list()
{'1': {'cpu': 0.012695364610000934, 'rss': 6447104, 'vms': 338259968, 'swap': 0, 'container': {'arguments': {'root': 'https://hub.grid.tf/tf-autobuilder/threefoldtech-0-robot-autostart-development.flist', 'mount': {'/var/cache/zrobot/config': '/opt/code/local/stdorg/config', '/var/cache/zrobot/data': '/opt/var/data/zrobot/zrobot_data', '/var/cache/zrobot/jsconfig': '/root/jumpscale/cfg', '/var/cache/zrobot/ssh': '/root/.ssh', '/var/run/redis.sock': '/tmp/redis.sock'}, 'host_network': False, 'identity': '', 'nics': [{'type': 'default', 'id': '', 'hwaddr': '', 'config': {'dhcp': False, 'cidr': '', 'gateway': '', 'dns': None}, 'monitor': False, 'state': 'configured'}], 'port': {'6600': 6600}, 'privileged': False, 'hostname': '', 'storage': 'zdb://hub.grid.tf:9900', 'name': 'zrobot', 'tags': ['zrobot'], 'env': {'HOME': '/root', 'LANG': 'C.UTF-8', 'LC_ALL': 'C.UTF-8'}, 'cgroups': [['devices', 'corex']], 'config': None}, 'root': '/mnt/containers/1', 'pid': 515}}, '2': {'cpu': 0, 'rss': 5922816, 'vms': 270069760, 'swap': 0, 'container': {'arguments': {'root': 'https://hub.grid.tf/tf-official-apps/threefoldtech-0-db-release-1.0.0.flist', 'mount': {}, 'host_network': False, 'identity': '', 'nics': [{'type': 'zerotier', 'id': '93afae5963e793f7', 'hwaddr': '', 'config': {'dhcp': False, 'cidr': '', 'gateway': '', 'dns': None}, 'monitor': False, 'state': 'configured'}, {'type': 'default', 'id': 'None', 'hwaddr': '', 'name': 'nat0', 'config': {'dhcp': False, 'cidr': '', 'gateway': '', 'dns': None}, 'monitor': False, 'state': 'configured'}], 'port': None, 'privileged': False, 'hostname': '', 'storage': 'zdb://hub.grid.tf:9900', 'name': 'zerodb1', 'tags': ['zerodb1'], 'env': {}, 'cgroups': [['devices', 'corex']], 'config': {}}, 'root': '/mnt/containers/2', 'pid': 634}}}

JSX> zos.client.container.get('zerodb1')
{'arguments': {'root': 'https://hub.grid.tf/tf-official-apps/threefoldtech-0-db-release-1.0.0.flist', 'mount': {}, 'host_network': False, 'identity': '', 'nics': [{'type': 'zerotier', 'id': '93afae5963e793f7', 'hwaddr': '', 'config': {'dhcp': False, 'cidr': '', 'gateway': '', 'dns': None}, 'monitor': False, 'state': 'configured'}, {'type': 'default', 'id': 'None', 'hwaddr': '', 'name': 'nat0', 'config': {'dhcp': False, 'cidr': '', 'gateway': '', 'dns': None}, 'monitor': False, 'state': 'configured'}], 'port': {}, 'privileged': False, 'hostname': '', 'storage': 'zdb://hub.grid.tf:9900', 'name': 'zerodb1', 'tags': ['zerodb1'], 'env': {}, 'cgroups': [['devices', 'corex']], 'config': {}}, 'root': '/mnt/containers/2', 'pid': 634}

JSX> zos.containers.list()
[Container <zrobot>, Container <zerodb1>]

JSX> zerodb1=zos.containers.get('zerodb1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sandbox/lib/jumpscale/Jumpscale/sal_zos/container/Container.py", line 34, in get
    container["container"]["id"] = container.pop("id")
KeyError: 'id'

'id'
robvanmieghem commented 5 years ago
JSX> zos.client.container.get('zerodb1').keys()
dict_keys(['arguments', 'root', 'pid'])

but in the code :

 container = self.node.client.container.get(name)
            if not container:
                raise LookupError("Could not find container with name {}".format(name))
            container["container"]["id"] = container.pop("id")
zaibon commented 5 years ago

I cannot reproduce this.

JSX> node.containers.list()                                                                                            
[Container <zrobot>]

JSX> zcont = node.containers.get('zrobot')                                                                             
JSX> zcont.id                                                                                                          
1
BolaNasr commented 5 years ago

it works good at development_builders branch photo_2019-07-11_12-22-08

siddiquagig commented 5 years ago

Works on development_builders

JSX> node.containers.get('zrobot')
Container <zrobot>

JSX> _.id
1
3BOTDEVEL:3bot:jumpscaleX: git branch
  development
* development_builders
3BOTDEVEL:3bot:jumpscaleX: git log -1
commit 4a4e87444c0f5a68a7907fff2eaa16cc57e12ba1 (HEAD -> development_builders, origin/development_builders)
Merge: 6e36df48 eb759af6
Author: Reem Khamis <khamisr@codescalers.com>
Date:   Thu Jul 11 11:35:24 2019 +0200

    Merge branch 'development_builder' into development_builders