Opened 9 years ago

Closed 7 years ago

#50975 closed defect (fixed)

sysutils/ansible @2.0.1.0.1 not working with unset locale

Reported by: easye Owned by: adfernandes (Andrew Fernandes)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: blair (Blair Zajac), pedro.salgado@…
Port: ansible

Description

Not exactly a bug report; more like a WORKAROUND for others possibly encountering this issue.

Invoking ansible-playbook from sysutils/ansible@2.0.1.0.1 fails where the previous version worked:

Traceback (most recent call last):
  File "/opt/local/bin/ansible-playbook", line 110, in <module>
    display.error("Unexpected Exception: %s" % to_unicode(e), wrap_text=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible/utils/display.py", line 261, in error
    self.display(new_msg, color='red', stderr=True)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible/utils/display.py", line 124, in display
    msg2 = to_bytes(msg2, encoding=self._output_encoding(stderr=stderr))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible/utils/unicode.py", line 208, in to_bytes
    return obj.encode(encoding, errors)
LookupError: unknown encoding: 

The culprit is an unset locale in my environment.

One may either specify a locale via the 'module_lang' variable in {/opt/local/etc/ansible/ansible.cfg} or setting LANG in the invoking shell

export LANG=en_US.UTF-8 

The upstream Ansible code should probably code defensively against unset locale in their basic "display output to users" routines.

Change History (2)

comment:1 Changed 7 years ago by mf2k (Frank Schima)

Cc: blair pedro.salgado@… added
Owner: changed from adfernandes@… to adfernandes
Status: newassigned

Trac allows only a single owner of a ticket. Other maintainers should be Cc'ed.

comment:2 Changed 7 years ago by adfernandes (Andrew Fernandes)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.