This repository has been archived by the owner. It is now read-only.

Docker 1.8.3 is broken under certain conditions #2257

Closed
SamYaple opened this Issue Oct 13, 2015 · 10 comments

Comments

Projects
None yet
6 participants
@SamYaple
Contributor

SamYaple commented Oct 13, 2015

The API now returns different json data depending on the conditions of the variable. Specifically if the variables are empty it will not return them.

This change happened between 1.8.2 and 1.8.3. In a commit[1] now ExposedPorts will not return if it is None (or empty). This effectively kills the module since that is hardcoded. This is the only variable that is affected by this patch.

[1] moby/moby@9098628

SamYaple added a commit to SamYaple/ansible-modules-core that referenced this issue Oct 13, 2015

Don't assume ExposedPorts exists (bug #2257)
A recent change [1] in docker between v1.8.2 and v1.8.3 changed what
is returned in the json when inspecting an image. Five variables which
could have been expected before will now be omited when empty. Only
one of those variables is being addressed in the docker, ExposedPorts.

Unfortunately there was also no API version change on this so this
can't be easily corrected with pinning the API to the older version.

This does a get() which will return None if the variable is not in the
dict formed from the json that was returned. Everything else works the
same way.

[1] moby/moby@9098628
@Glueon

This comment has been minimized.

Show comment
Hide comment
@Glueon

Glueon Oct 14, 2015

I confirm this bug. Here is a traceback:

Traceback (most recent call last):  
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 3185, in <module>  
    main()  
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 1542, in main  
    reloaded(manager, containers, count, name)  
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 1419, in reloaded  
    for container in manager.get_differing_containers():
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 933, in get_differing_containers
    expected_exposed_ports = set((image['ContainerConfig']['ExposedPorts'] or {}).keys())
KeyError: 'ExposedPorts'

Glueon commented Oct 14, 2015

I confirm this bug. Here is a traceback:

Traceback (most recent call last):  
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 3185, in <module>  
    main()  
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 1542, in main  
    reloaded(manager, containers, count, name)  
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 1419, in reloaded  
    for container in manager.get_differing_containers():
  File "/root/.ansible/tmp/ansible-tmp-1444786751.04-168544313354701/docker", line 933, in get_differing_containers
    expected_exposed_ports = set((image['ContainerConfig']['ExposedPorts'] or {}).keys())
KeyError: 'ExposedPorts'
@robynbergeron

This comment has been minimized.

Show comment
Hide comment
@robynbergeron

robynbergeron Oct 14, 2015

Hi @SamYaple -- thanks for filing this bug report (and the accompanying PR in #2258 :D). Also, thanks to @Glueon for confirming!

@cove @softzilla @joshuaconner @smashwilson -- thanks in advance for taking a look at this bug report and for your ongoing work in maintaining this module.

robynbergeron commented Oct 14, 2015

Hi @SamYaple -- thanks for filing this bug report (and the accompanying PR in #2258 :D). Also, thanks to @Glueon for confirming!

@cove @softzilla @joshuaconner @smashwilson -- thanks in advance for taking a look at this bug report and for your ongoing work in maintaining this module.

bcoca added a commit that referenced this issue Oct 14, 2015

Merge pull request #2258 from SamYaple/fix_docker_bug_2257
Don't assume ExposedPorts exists (bug #2257)

chrisdail pushed a commit to chrisdail/ansible-modules-core that referenced this issue Nov 5, 2015

Don't assume ExposedPorts exists (bug #2257)
A recent change [1] in docker between v1.8.2 and v1.8.3 changed what
is returned in the json when inspecting an image. Five variables which
could have been expected before will now be omited when empty. Only
one of those variables is being addressed in the docker, ExposedPorts.

Unfortunately there was also no API version change on this so this
can't be easily corrected with pinning the API to the older version.

This does a get() which will return None if the variable is not in the
dict formed from the json that was returned. Everything else works the
same way.

[1] moby/moby@9098628
@Fei-Guang

This comment has been minimized.

Show comment
Hide comment
@Fei-Guang

Fei-Guang Nov 19, 2015

ansible 1.9.4 still has no this patch?

i still got this error

Fei-Guang commented Nov 19, 2015

ansible 1.9.4 still has no this patch?

i still got this error

@Fei-Guang

This comment has been minimized.

Show comment
Hide comment
@Fei-Guang

Fei-Guang Nov 19, 2015

i've installed ansigle on ubuntu using

$sudo pip install -U ansible
$ ansible --version
ansible 1.9.4
configured module search path = None

Fei-Guang commented Nov 19, 2015

i've installed ansigle on ubuntu using

$sudo pip install -U ansible
$ ansible --version
ansible 1.9.4
configured module search path = None

@Fei-Guang

This comment has been minimized.

Show comment
Hide comment
@Fei-Guang

Fei-Guang Nov 19, 2015

have to install ansible from source

Fei-Guang commented Nov 19, 2015

have to install ansible from source

@SamYaple

This comment has been minimized.

Show comment
Hide comment
@SamYaple

SamYaple Nov 19, 2015

Contributor

@Fei-Guang This was backported but there has been no new 1.9.x tag cut. I have been told there will not be either. This fix will only be available in ansible 2.0

Contributor

SamYaple commented Nov 19, 2015

@Fei-Guang This was backported but there has been no new 1.9.x tag cut. I have been told there will not be either. This fix will only be available in ansible 2.0

@bcoca

This comment has been minimized.

Show comment
Hide comment
@bcoca

bcoca Nov 20, 2015

Member

there will be a 1.9.5 release, if the patch made it into the stable-1.9 tree it will be in that release

Member

bcoca commented Nov 20, 2015

there will be a 1.9.5 release, if the patch made it into the stable-1.9 tree it will be in that release

@SamYaple

This comment has been minimized.

Show comment
Hide comment
@SamYaple

SamYaple Nov 21, 2015

Contributor

@bcoca fantastic news! I was pretty disappointed when I was told there would not be a 1.9.5 before. Glad to know that is not the case

Contributor

SamYaple commented Nov 21, 2015

@bcoca fantastic news! I was pretty disappointed when I was told there would not be a 1.9.5 before. Glad to know that is not the case

@ansibot

This comment has been minimized.

Show comment
Hide comment
@ansibot

ansibot Aug 1, 2016

@cove, @softzilla, @zfil, @ThomasSteinbach, ping. This issue is still waiting on your response.
click here for bot help

ansibot commented Aug 1, 2016

@cove, @softzilla, @zfil, @ThomasSteinbach, ping. This issue is still waiting on your response.
click here for bot help

@SamYaple

This comment has been minimized.

Show comment
Hide comment
@SamYaple

SamYaple Aug 1, 2016

Contributor

With 1.9.5 released, this issue was fixed.

Contributor

SamYaple commented Aug 1, 2016

With 1.9.5 released, this issue was fixed.

@SamYaple SamYaple closed this Aug 1, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.