Hi James,

It seems that it's now working with Python 2.7 on RHEL. The distribution 
supplied Python (2.6) still produces the same error.

--
 Eino Tuominen

From: ansible-project@googlegroups.com 
[mailto:ansible-project@googlegroups.com] On Behalf Of James Cammarata
Sent: 14. syyskuuta 2015 3:40
To: ansible-project@googlegroups.com
Subject: Re: [ansible-project] Ansible task crash if using with_items

Hi Eino, this appears to be working now:

TASK [foo] *********************************************************************
changed: [localhost] => (item=foo) => {"changed": true, "cmd": "true", "delta": 
"0:00:00.002933", "end": "2015-09-13 20:38:31.761057", "item": "foo", "rc": 0, 
"start": "2015-09-13 20:38:31.758124", "stderr": "", "stdout": "", 
"stdout_lines": [], "warnings": []}
changed: [localhost] => (item=bar) => {"changed": true, "cmd": "true", "delta": 
"0:00:00.003014", "end": "2015-09-13 20:38:31.826862", "item": "bar", "rc": 0, 
"start": "2015-09-13 20:38:31.823848", "stderr": "", "stdout": "", 
"stdout_lines": [], "warnings": []}

Let us know if you continue seeing problems with this.

Thanks!



James Cammarata
Director, Ansible Core Engineering
github: jimi-c

On Thu, Sep 10, 2015 at 11:51 AM, Eino Tuominen 
<eino.tuomi...@gmail.com<mailto:eino.tuomi...@gmail.com>> wrote:
Hello,

I have:

Red Hat Enterprise Linux Server release 6.7 (Santiago)

Linux x.utu.fi<http://x.utu.fi> 2.6.32-504.30.3.el6.x86_64 #1 SMP Thu Jul 9 
15:20:47 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux


# ansible --version

ansible 2.0.0

  config file = /etc/ansible/ansible.cfg

  configured module search path = /etc/ansible/library


# cat reproduce.yml

---

- hosts: localhost

  tasks:

    - name: foo

      shell: "true"

      with_items:

        - foo

        - bar

# ansible-playbook reproduce.yml -vvv

...

TASK [foo] *********************************************************************

ESTABLISH LOCAL CONNECTION FOR USER: root

127.0.0.1 EXEC mkdir -p 
"$HOME/.ansible/tmp/ansible-tmp-1441900074.83-151106908408783" && echo 
"$HOME/.ansible/tmp/ansible-tmp-1441900074.83-151106908408783"

127.0.0.1 PUT /tmp/tmp2XuR76 TO 
/root/.ansible/tmp/ansible-tmp-1441900074.83-151106908408783/command

127.0.0.1 EXEC LANG=C LC_MESSAGES=C LC_CTYPE=C /usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1441900074.83-151106908408783/command; rm -rf 
"/root/.ansible/tmp/

ansible-tmp-1441900074.83-151106908408783/" > /dev/null 2>&1

ESTABLISH LOCAL CONNECTION FOR USER: root

127.0.0.1 EXEC mkdir -p 
"$HOME/.ansible/tmp/ansible-tmp-1441900074.91-107992728137762" && echo 
"$HOME/.ansible/tmp/ansible-tmp-1441900074.91-107992728137762"

127.0.0.1 PUT /tmp/tmppaIjQW TO 
/root/.ansible/tmp/ansible-tmp-1441900074.91-107992728137762/command

127.0.0.1 EXEC LANG=C LC_MESSAGES=C LC_CTYPE=C /usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1441900074.91-107992728137762/command; rm -rf 
"/root/.ansible/tmp/

ansible-tmp-1441900074.91-107992728137762/" > /dev/null 2>&1

An exception occurred during task execution. The full traceback is:

Traceback (most recent call last):

  File 
"/usr/lib/python2.6/site-packages/ansible-2.0.0-py2.6.egg/ansible/executor/process/worker.py",
 line 119, in run

    executor_result = TaskExecutor(host, task, job_vars, new_play_context, 
self._new_stdin, self._loader, shared_loader_obj).run()

  File 
"/usr/lib/python2.6/site-packages/ansible-2.0.0-py2.6.egg/ansible/executor/task_executor.py",
 line 127, in run

    result = json.dumps(res, default=json_variable_cleaner)

  File "/usr/lib64/python2.6/json/__init__.py", line 237, in dumps

    **kw).encode(obj)

  File "/usr/lib64/python2.6/json/encoder.py", line 367, in encode

    chunks = list(self.iterencode(o))

  File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode

    for chunk in self._iterencode_dict(o, markers):

  File "/usr/lib64/python2.6/json/encoder.py", line 275, in _iterencode_dict

    for chunk in self._iterencode(value, markers):

  File "/usr/lib64/python2.6/json/encoder.py", line 306, in _iterencode

    for chunk in self._iterencode_list(o, markers):

  File "/usr/lib64/python2.6/json/encoder.py", line 204, in _iterencode_list

    for chunk in self._iterencode(value, markers):

  File "/usr/lib64/python2.6/json/encoder.py", line 309, in _iterencode

    for chunk in self._iterencode_dict(o, markers):

  File "/usr/lib64/python2.6/json/encoder.py", line 275, in _iterencode_dict

    for chunk in self._iterencode(value, markers):

  File "/usr/lib64/python2.6/json/encoder.py", line 294, in _iterencode

    yield encoder(o)

TypeError: first argument must be a string or unicode, not 
UnsafeProxy(AnsibleUnicode)



fatal: [localhost]: FAILED! => {"failed": true, "stdout": ""}

I tried to google around, but I didn't manage to find anything obvious. I have 
another test server with Ubuntu that doesn't have this problem. I also tried to 
install Python 2.7, but that didn't help either.

--
  Eino Tuominen
--
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<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to 
ansible-project@googlegroups.com<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fef0e26a-84cd-4bb0-a569-8690ad36efc2%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/fef0e26a-84cd-4bb0-a569-8690ad36efc2%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<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to 
ansible-project@googlegroups.com<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMFyvFiKtqwMJuGO7XBDBgvf3WqDwtipbax3b%3Dq1eQhJri08Gw%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAMFyvFiKtqwMJuGO7XBDBgvf3WqDwtipbax3b%3Dq1eQhJri08Gw%40mail.gmail.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/a3c0240a4fd74a7fa9027a39e2873e7f%40EX13-01.utu.fi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to