mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix UnicodeEncodeError for ansible --version. (#50997)
The error occurs on Python 2.x when running the following commands: ``` mkdir /tmp/Δ.cfg ANSIBLE_CONFIG=/tmp/Δ.cfg ansible --version | tee ```
This commit is contained in:
parent
54867b4add
commit
c46a09dcf4
1 changed files with 2 additions and 1 deletions
|
@ -15,6 +15,7 @@ import yaml
|
||||||
import ansible
|
import ansible
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.release import __version__
|
from ansible.release import __version__
|
||||||
from ansible.utils.path import unfrackpath
|
from ansible.utils.path import unfrackpath
|
||||||
|
|
||||||
|
@ -192,7 +193,7 @@ def create_base_parser(usage="", desc=None, epilog=None):
|
||||||
Create an options parser for all ansible scripts
|
Create an options parser for all ansible scripts
|
||||||
"""
|
"""
|
||||||
# base opts
|
# base opts
|
||||||
parser = SortedOptParser(usage, version=version("%prog"), description=desc, epilog=epilog)
|
parser = SortedOptParser(usage, version=to_native(version("%prog")), description=desc, epilog=epilog)
|
||||||
parser.remove_option('--version')
|
parser.remove_option('--version')
|
||||||
version_help = "show program's version number, config file location, configured module search path," \
|
version_help = "show program's version number, config file location, configured module search path," \
|
||||||
" module location, executable location and exit"
|
" module location, executable location and exit"
|
||||||
|
|
Loading…
Reference in a new issue