Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

setup_module: [Manjaro Linux] TypeError: Can't convert 'bytes' object to str implicitly, rc: 257 #4996

Closed
dminca opened this issue Sep 24, 2016 · 7 comments

Comments

@dminca
Copy link
Contributor

dminca commented Sep 24, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • setup module
ANSIBLE VERSION
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION
  • none, using defaults
OS / ENVIRONMENT
OS: Manjaro 16.08 Ellada
Kernel: x86_64 Linux 4.4.21-1-MANJARO
Shell: zsh 5.2
Resolution: 1680x1050
WM: i3
GTK Theme: Vertex-Maia-Dark [GTK2/3]
Icon Theme: Breeze-Maia-Dark
Font: Hack 10
CPU: Intel Core i7 CPU M 620 @ 2.667GHz
GPU: NVS 3100M
RAM: 1661MiB / 1929MiB
SUMMARY

After running the playbook via ansible-playbook -i inventory site.yml it errors out after the PLAY [all] ***** stage (at TASK [setup] ).

STEPS TO REPRODUCE
  • run the playbook via ansible-playbook -i inventory site.yml
ansible-playbook -i inventory site.yml

# checked whether setup module is bugged; and it's not, it is outputting localhost info
ansible localhost -m setup
localhost | SUCCESS => {
    "ansible_facts": {
        "ansible_all_ipv4_addresses": [
            "192.168.1.132"
        ],
..... (dimmed output)
EXPECTED RESULTS
  • run the playbook without returning any errors
  • install pacman packages
ACTUAL RESULTS
  • exited with return code 257 during the [SETUP] task
➜  Repos/containerschiff git:(os/arch_linux) ansible-playbook -i inventory site.yml -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0

PLAYBOOK: site.yml *************************************************************
1 plays in site.yml

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: dminca
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1474751096.68-239904980489857 `" && echo ansible-tmp-1474751096.68-239904980489857="` echo $HOME/.ansible/tmp/ansible-tmp-1474751096.68-239904980489857 `" ) && sleep 0'
<localhost> PUT /tmp/tmpEa0tQl TO /home/dminca/.ansible/tmp/ansible-tmp-1474751096.68-239904980489857/setup
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/dminca/.ansible/tmp/ansible-tmp-1474751096.68-239904980489857/setup; rm -rf "/home/dminca/.ansible/tmp/ansible-tmp-1474751096.68-239904980489857/" > /dev/null 2>&1 && sleep 0'
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_7f4z9h91/ansible_module_setup.py", line 127, in <module>
    main()
  File "/tmp/ansible_7f4z9h91/ansible_module_setup.py", line 117, in main
    supports_check_mode = True,
  File "/tmp/ansible_7f4z9h91/ansible_modlib.zip/ansible/module_utils/basic.py", line 679, in __init__
  File "/tmp/ansible_7f4z9h91/ansible_modlib.zip/ansible/module_utils/basic.py", line 1615, in _log_invocation
  File "/tmp/ansible_7f4z9h91/ansible_modlib.zip/ansible/module_utils/basic.py", line 475, in heuristic_log_sanitize
TypeError: a bytes-like object is required, not 'str'

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "setup"}, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_7f4z9h91/ansible_module_setup.py\", line 127, in <module>\n    main()\n  File \"/tmp/ansible_7f4z9h91/ansible_module_setup.py\", line 117, in main\n    supports_check_mode = True,\n  File \"/tmp/ansible_7f4z9h91/ansible_modlib.zip/ansible/module_utils/basic.py\", line 679, in __init__\n  File \"/tmp/ansible_7f4z9h91/ansible_modlib.zip/ansible/module_utils/basic.py\", line 1615, in _log_invocation\n  File \"/tmp/ansible_7f4z9h91/ansible_modlib.zip/ansible/module_utils/basic.py\", line 475, in heuristic_log_sanitize\nTypeError: a bytes-like object is required, not 'str'\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}

NO MORE HOSTS LEFT *************************************************************
 [WARNING]: Could not create retry file 'site.retry'.         [Errno 2] No such file or directory: ''


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

@dminca dminca changed the title setup_module: TypeError: Can't convert 'bytes' object to str implicitly, rc: 257 setup_module: [Manjaro Linux] TypeError: Can't convert 'bytes' object to str implicitly, rc: 257 Sep 24, 2016
@ansibot
Copy link

ansibot commented Sep 24, 2016

@grossws ping, this issue is waiting for your response.
click here for bot help

dminca added a commit to skullops/containerschiff that referenced this issue Sep 25, 2016
Trying to gather more intel about the Ansible bug

Related: #23, ansible/ansible-modules-core#4996
Signed-off-by: Minca Daniel Andrei <mandrei17@gmail.com>
@dminca
Copy link
Contributor Author

dminca commented Sep 30, 2016

I don't know how to instruct Ansible to use python2.7 because it's running python3.5.2.
@Qalthos suggested I add ansible_python_interpreter=python2 in the inventory footer, but that didn't fix it.

~  python --version
Python 3.5.2
➜  ~  which python
/usr/sbin/python

@Qalthos
Copy link
Contributor

Qalthos commented Oct 2, 2016

@dminca Not as another line, this is a variable you are attaching to localhost, so it has to be on the same line, just as you are specifying ansible_connection=local to localhost

@dminca
Copy link
Contributor Author

dminca commented Oct 3, 2016

Ahh. Ok @Qalthos, will try it out and come with feedback. Thank you!

@ansibot
Copy link

ansibot commented Oct 18, 2016

@ansible, ping. This issue is still waiting on your response.
click here for bot help

@dminca
Copy link
Contributor Author

dminca commented Oct 18, 2016

Don't have time to test this anymore, also switched os.

@ansibot
Copy link

ansibot commented Nov 3, 2016

@ansible, ping. This issue is still waiting on your response.
click here for bot help

@dminca dminca closed this as completed Nov 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants