Skip to content

Check resource error in container network API #1673

@matthewtberry

Description

@matthewtberry
docker python client v2.4.2
python v2.7.12
docker v17.03.1-ce
Ubuntu 16.04

PR #1649 updated the check_resource decorator to handle different resource names. Container network API functions connect_container_to_network() and disconnect_container_from_network() check 'image' as resource ID and not 'container'.

Reproduce using the following snippet:

import docker

cli = docker.APIClient(base_url='unix:///var/run/docker.sock')
cli.pull(repository='ubuntu', tag='latest')

name = 'my_ubuntu'
container = cli.create_container(image='ubuntu:latest', name=name)
cli.connect_container_to_network(container=name, net_id='bridge')

This causes:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    cli.connect_container_to_network(container=name, net_id='bridge')
  File "/home/mberry/scratch/virtualenv/docker_py/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 17, in wrapped
    'Resource ID was not provided'
docker.errors.NullResource: Resource ID was not provided

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions