Hi Seth, after looking into this, the best way to approach this would be to
use the complex argument syntax as opposed to the key=value style you're
using now:

    docker:
      image: "readytalk/tomcat-native:8.0.9"
      state: "running"
      env:
        CATALINA_OPTS: "-Dconfig.zookeepers=zookeeper1,zookeeper2"

This way, the environment options are a native dictionary type. I've tested
it with the above and it works without issue.

Let us know if you have any further questions about this.

Thanks!



On Wed, Aug 20, 2014 at 1:16 PM, James Cammarata <jcammar...@ansible.com>
wrote:

> Hi Seth, looking into this now.
>
>
> On Wed, Aug 20, 2014 at 11:58 AM, Seth Goings <sethgoi...@gmail.com>
> wrote:
>
>> I noticed that a fix attempt for this recently went into the devel branch
>> thanks to help on the IRC channel. Thanks for pointing me in the right
>> direction, all!
>>
>> https://github.com/ansible/ansible/issues/8661
>>
>> However, I'm having a similar problem with the following snippet:
>>
>>   - name: "Try to inject commas in env strings"
>>     docker: image="readytalk/tomcat-native:8.0.9"
>>             state="running"
>>
>> env='CATALINA_OPTS="-Dconfig.zookeepers=zookeeper1,zookeeper2"'
>>
>> Which dumps out (on devel branch with
>> HEAD d63092ea45d70cb14c7633a8183a7a38a2726111)
>>
>> fatal: [newman] => failed to parse: Traceback (most recent call last):
>>   File
>> "/home/sgoings/.ansible/tmp/ansible-tmp-1408553551.73-77442219569203/docker",
>> line 2163, in <module>
>>     main()
>>   File
>> "/home/sgoings/.ansible/tmp/ansible-tmp-1408553551.73-77442219569203/docker",
>> line 724, in main
>>     net             = dict(default=None)
>>   File
>> "/home/sgoings/.ansible/tmp/ansible-tmp-1408553551.73-77442219569203/docker",
>> line 1086, in __init__
>>     self._check_argument_types()
>>   File
>> "/home/sgoings/.ansible/tmp/ansible-tmp-1408553551.73-77442219569203/docker",
>> line 1623, in _check_argument_types
>>     self.params[k] = dict([x.strip().split("=", 1) for x in
>> value.split(",")])
>> ValueError: dictionary update sequence element #1 has length 1; 2 is
>> required
>>
>> What could I do to avoid this problem?
>>
>>
>> On Thursday, August 14, 2014 6:13:36 AM UTC-6, Michael DeHaan wrote:
>>
>>> I think this is the problem in the module:
>>>
>>>  env = dict(type='list'),
>>> If it were type='dict' we could do:
>>>
>>> docker:
>>>
>>>     env:
>>>
>>>           options: {"foo":"bar","baz":"qux"}
>>>
>>>    other_arguments_here: 1234
>>>
>>>
>>> And basically use full YAML, without any splitting magic.
>>>
>>>
>>> If someone would like to help test that change, that would be great,
>>> otherwise, please file a github ticket and we can try it.
>>>
>>> It would also be nice if we could do it in a compatible way, but this is
>>> probably not be possible.
>>>
>>> Docker is new and has broken APIs in the past, we may also have to :)
>>>
>>>
>>>
>>>
>>> On Wed, Aug 13, 2014 at 11:51 PM, Dane Lipscombe <da...@lipscombe.com.au
>>> > wrote:
>>>
>>>> I use json to compact my docker environment variables, the problem is
>>>> that the docker module parser splits on ',' character to signify a new
>>>> key/value pair, meaning that more than one key doesn't work. eg
>>>>
>>>> docker: env='options={"foo":"bar"}' //ok
>>>>
>>>> docker: env='options={"foo":"bar","baz":"qux"}' //error because of
>>>> comma
>>>>
>>>> Is it possible to add an escape for the comma, eg '\,' or ',,' ?
>>>>
>>>>
>>>>
>>>>
>>>> Also, where do you see the latest docker module code? I found this link
>>>> but it says its been merged into the main repository.
>>>>
>>>> https://github.com/cove/docker-ansible/blob/master/docker-ansible.py
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Ansible Project" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to ansible-proje...@googlegroups.com.
>>>> To post to this group, send email to ansible...@googlegroups.com.
>>>>
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/ansible-project/69fe3bf1-6a74-484c-b997-
>>>> 8c07dd229478%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/69fe3bf1-6a74-484c-b997-8c07dd229478%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/a24d0c7e-11d2-4c79-8bc3-564fdb4e4876%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/a24d0c7e-11d2-4c79-8bc3-564fdb4e4876%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMFyvFi1M07pjpii-46ujLFPvhAGUfZasNcw5c9tVvkAgpvYOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to