container-transform icon indicating copy to clipboard operation
container-transform copied to clipboard

container-transform 1.1.5 and/or Latest container doesn't appear to be working, at least for ECS -> Compose

Open floer32 opened this issue 7 years ago • 8 comments

$ <snipped> | docker run --rm -i micahhausler/container-transform --input-type ecs --output-type compose
Unable to find image 'micahhausler/container-transform:latest' locally
latest: Pulling from micahhausler/container-transform
79650cf9cc01: Pull complete
581a2604819e: Pull complete
ada98fe44e3a: Pull complete
70b4de28adfd: Pull complete
bcd83fe4359e: Pull complete
a79ed293bf7c: Pull complete
ca7ba4450342: Pull complete
bdc934014ded: Pull complete
Digest: sha256:3836dc18396e463afce186372f715137007cf4f19680a130833ff8763332038e
Status: Downloaded newer image for micahhausler/container-transform:latest
Traceback (most recent call last):
  File "/usr/local/bin/container-transform", line 11, in <module>
    load_entry_point('container-transform==1.1.5', 'console_scripts', 'container-transform')()
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/container_transform-1.1.5-py3.6.egg/container_transform/client.py", line 64, in transform
    output = converter.convert(verbose)
  File "/usr/local/lib/python3.6/site-packages/container_transform-1.1.5-py3.6.egg/container_transform/converter.py", line 57, in convert
    output_transformer
  File "/usr/local/lib/python3.6/site-packages/container_transform-1.1.5-py3.6.egg/container_transform/converter.py", line 83, in _convert_container
    if container.get(input_name) and \
AttributeError: 'str' object has no attribute 'get'

floer32 avatar Jun 21 '17 00:06 floer32

This only affects piping into the container, does not affect when giving an argument. I can see how to work around so to make it clear that this is not urgent or anything I'm going to close this issue.

floer32 avatar Jun 21 '17 00:06 floer32

Wait, nevermind. Affects both usages.

floer32 avatar Jun 21 '17 00:06 floer32

here is the task definition with most of specifics scrubbed out, but should work for reproducing issue

{
    "taskDefinition": {
        "status": "ACTIVE",
        "family": "foobarbaz",
        "placementConstraints": [],
        "requiresAttributes": [
            {
                "name": "com.amazonaws.ecs.capability.logging-driver.syslog"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
            }
        ],
        "volumes": [],
        "taskDefinitionArn": "REPLACEMEORLEAVEASGARBAGE",
        "containerDefinitions": [
            {
                "environment": [
                    {
                        "name": "FOOBAR",
                        "value": "foobar"
                    }
                ],
                "name": "foobar",
                "links": [],
                "mountPoints": [],
                "image": "REPLACEME",
                "logConfiguration": {
                    "logDriver": "syslog",
                    "options": {
                        "syslog-address": "tcp://127.0.0.1:1514"
                    }
                },
                "essential": true,
                "portMappings": [
                    {
                        "protocol": "tcp",
                        "containerPort": 123,
                        "hostPort": 123
                    }
                ],
                "entryPoint": [],
                "memory": 1536,
                "command": [],
                "cpu": 100,
                "volumesFrom": []
            }
        ],
        "revision": 257
    }
}

Confirmed, yes this works to reproduce the issue

$ docker run --rm -v $(pwd):/data/ micahhausler/container-transform --verbose td2.json --input-type ecs --output-type compose
Traceback (most recent call last):
  File "/usr/local/bin/container-transform", line 11, in <module>
    load_entry_point('container-transform==1.1.5', 'console_scripts', 'container-transform')()
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/container_transform-1.1.5-py3.6.egg/container_transform/client.py", line 64, in transform
    output = converter.convert(verbose)
  File "/usr/local/lib/python3.6/site-packages/container_transform-1.1.5-py3.6.egg/container_transform/converter.py", line 57, in convert
    output_transformer
  File "/usr/local/lib/python3.6/site-packages/container_transform-1.1.5-py3.6.egg/container_transform/converter.py", line 83, in _convert_container
    if container.get(input_name) and \
AttributeError: 'str' object has no attribute 'get'

floer32 avatar Jun 21 '17 00:06 floer32

@hangtwenty I ran into the exactly the same issue. I switched over to pip3 to do the install of container-transform and it started working for me.

pip3 install container-transform

jbryson3 avatar Jul 20 '17 02:07 jbryson3

@jbryson3 even with pip3 I can't transform Dockerrun file into docker-compose file. But transforming docker-compose file into Dockerrun file works as usual.

Congrammers avatar Oct 29 '17 14:10 Congrammers

A json array of container definitions should be passed in. It can't be a whole task definition just the containerDefinitions inside it.

sixcorners avatar May 17 '18 08:05 sixcorners

  File "/usr/local/lib/python3.6/site-packages/container_transform/ecs.py", line 237, in _ingest_volume
    'host': self.volumes_in.get(volume.get('sourceVolume')).get('path'),
AttributeError: 'NoneType' object has no attribute 'get'

Similar issue using AWS's sample (installed using pip3).

gaffney avatar Jul 06 '18 20:07 gaffney

I am getting the same error. Even though I used pip3

alok15ee avatar May 17 '20 19:05 alok15ee