'tuple' object has no attribute 'iteritems'

802 views
Skip to first unread message

Randy Bush

unread,
Aug 5, 2015, 9:19:15 PM8/5/15
to ansible project
- name: run syslog-ng version
command: syslog-ng --version
register: ver_out
changed_when: false

- name: set ver
set_fact: ver="{{ ver_out.stdout.splitlines()[0]|regex_replace('[^\d.]+', '') }}"

is getting me

fatal: [frobnitz.edu]: FAILED! => {"msg": "Traceback (most recent call last):
File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 2106, in <module>
main()
File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 158, in main
module = CommandModule(argument_spec=dict())
File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 607, in __init__
self._check_for_check_mode()
File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 1133, in _check_for_check_mode
for (k,v) in self.params.iteritems():
AttributeError: 'tuple' object has no attribute 'iteritems'
", "failed": true, "changed": false, "parsed": false, "invocation": {"module_name": "command", "module_args": {"_raw_params": "syslog-ng --version"}}}

clue bat, please

randy

candlerb

unread,
Aug 7, 2015, 2:28:41 AM8/7/15
to Ansible Project
Which version of ansible?

As a standalone test case, it works for me with ansible-1.7.1.

brian@wrn-mon1:~$ cat test.yml
- hosts: localhost
  tasks:

    - name: run syslog-ng version
      command: syslog-ng --version
      register: ver_out
      changed_when: false

    - name: set ver
      set_fact: ver="{{ ver_out.stdout.splitlines()[0]|regex_replace('[^\d.]+', '') }}"

    - debug: msg="answer={{ ver }}"
brian@wrn-mon1:~$ ansible-playbook test.yml

PLAY [localhost] **************************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [run syslog-ng version] *************************************************
ok: [localhost]

TASK: [set ver] ***************************************************************
ok: [localhost]

TASK: [debug msg="answer={{ ver }}"] ******************************************
ok: [localhost] => {
    "msg": "answer=3.3.4"
}

PLAY RECAP ********************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=0

brian@wrn-mon1:~$ ansible-playbook --version
ansible-playbook 1.7.1

Randy Bush

unread,
Aug 7, 2015, 3:05:59 AM8/7/15
to candlerb, Ansible Project
> Which version of ansible?

<blush> sorry.

% ansible-playbook --version
ansible-playbook 2.0.0
config file =
configured module search path = None

> As a standalone test case, it works for me with ansible-1.7.1.

ouch!

randy

Brian Candler

unread,
Aug 7, 2015, 3:25:21 AM8/7/15
to Randy Bush, Ansible Project
On 07/08/2015 08:05, Randy Bush wrote:
>> Which version of ansible?
> <blush> sorry.
>
> % ansible-playbook --version
> ansible-playbook 2.0.0
> config file =
> configured module search path = None
>
Is that a development version? I've done a "git pull" and the latest
*tagged* version is v1.9.2-1, although there is a *branch* called v2_final

But if I checkout the latest git devel branch, I get the same as you
(below).

Suggest you raise it directly on github, as there's now a nice
standalone test case. In fact, the test case reduces to just this:

~~~
- hosts: localhost
tasks:
- name: run a command
command: date
register: ver_out
changed_when: false
~~~

Note that the bot on github will reject your ticket unless you fill it
in using their template as a starting point.

Cheers,

Brian.

brian@wrn-mon1:~$ ansible-playbook test.yml

PLAY
***************************************************************************

TASK [setup]
*******************************************************************
ok: [localhost]

TASK [run syslog-ng version]
***************************************************
An exception occurred during task execution. To see the full traceback,
use -vvv. The error was: AttributeError: 'tuple' object has no attribute
'iteritems'
fatal: [localhost]: FAILED! => {"changed": false, "failed": true,
"parsed": false}

PLAY RECAP
*********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1

brian@wrn-mon1:~$ ansible-playbook --version
ansible-playbook 2.0.0 (devel 48840ad498) last updated 2015/08/07
08:17:44 (GMT +100)
lib/ansible/modules/core: (detached HEAD 8412adc4f9) last updated
2015/08/07 08:18:17 (GMT +100)
lib/ansible/modules/extras: (detached HEAD 210ee3febc) last updated
2015/08/07 08:18:33 (GMT +100)
v1/ansible/modules/core: (detached HEAD f8d8af17cd) last updated
2015/08/07 08:18:51 (GMT +100)
v1/ansible/modules/extras: (detached HEAD 495ad450e5) last updated
2015/08/07 08:19:06 (GMT +100)
config file = /etc/ansible/ansible.cfg
configured module search path = /usr/share/ansible

candlerb

unread,
Aug 7, 2015, 3:28:35 AM8/7/15
to Ansible Project, b.ca...@pobox.com
Is that a development version? I've done a "git pull" and the latest *tagged* version is v1.9.2-1, although there is a *branch* called v2_final

If I checkout the latest git devel branch, I see the same as you.

I suggest you raise it directly on github. The following standalone playbook reproduces it, without any need for syslog-ng:

~~~
- hosts: localhost
  tasks:

    - name: run a command
      command: date
      register: ver_out
      changed_when: false
~~~

Regards,

Brian.
Reply all
Reply to author
Forward
0 new messages