Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'" reploying service file #96

Open
nickbroon opened this issue Feb 28, 2019 · 4 comments

Comments

@nickbroon
Copy link

Deploying to CentOS 7:

TASK [RocketChat.Server : Deploy the Rocket.Chat service file]
fatal: [rocketchat.mydomain.com]: FAILED! => {
    "changed": false,
    "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'"
}

Any suggestion to the cause/fix?

@nickbroon
Copy link
Author

Does this relate to #74 in some way?

The 'Deploy the Rocket.Chat service file' task using rocketchat.service.j2:

{% for variable, value in rocket_chat_service_environment.iteritems() %}
Environment={{ variable }}={{ value }}
{% endfor -%}

@nickbroon
Copy link
Author

Changing it to use rocket_chat_service_environment.items() seemed to fix the problem.

This appears to be an issue with iteritem() being removed in Python 3.
https://stackoverflow.com/questions/30418481/error-dict-object-has-no-attribute-iteritems

@tanc
Copy link

tanc commented Jun 20, 2019

I also get this error and I my ansible version runs in Python 3 on MacOS, installed via homebrew:

$ ansible --version
ansible 2.8.1
  config file = /Users/tanc/Documents/Projects/agile-ansible/ansible.cfg
  configured module search path = ['/Users/tanc/.local/lib/python2.7/site-packages/ara/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.8.1/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]

@ElijahLynn
Copy link

I also get this error and I my ansible version runs in Python 3 on MacOS, installed via homebrew:

$ ansible --version
ansible 2.8.1
  config file = /Users/tanc/Documents/Projects/agile-ansible/ansible.cfg
  configured module search path = ['/Users/tanc/.local/lib/python2.7/site-packages/ara/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.8.1/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]

Super valuable, I just searched this error and I am not using rocketchat or homebrew but am using pyenv along with virtualenvironment and had the version set to 2.7.x but no matter what I did with pyenv the virtualenvironment kept using system default. End solution was to use pyenv-virtualenvironment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants