фон:
Идентификатор распространителя: Ubuntu Описание: Ubuntu 18.04.3 LTS Выпуск: 18.04 Кодовое имя: bioni c
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
SSH_CONNECTION=172.19.0.10 57690 172.19.0.67 22
LESSCLOSE=/usr/bin/lesspipe %s %s
LANG=C.UTF-8
AMD_ENTRYPOINT=vs/server/remoteExtensionHostProcess
OLDPWD=/usr/lib/python2.7
COLORTERM=truecolor
ANSIBLE_HOME=/root/ansible
VIRTUAL_ENV=/root/ansible/venv
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL=true
XDG_SESSION_ID=11
USER=root
PWD=/root/ansible
HOME=/root
python -V Python 3.6. 9
описание проблемы
я следую этому руководству https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#environment -setup , чтобы запустить ansible-test sanity -v --docker --python 2.7 my_test
my_test, модуль которого упоминается в приведенной выше документации. И мне не удалось получить следующее сообщение об ошибке.
ansible-test sanity -v --docker --python 2.7 my_test
Run command: docker images quay.io/ansible/default-test-container:1.12 --format '{{json .}}'
Creating a payload archive containing 19605 files...
Created a 18417093 byte payload archive containing 19605 files in 2 seconds.
Run command: docker run --detach --volume /sys/fs/cgroup:/sys/fs/cgroup:ro --privileged=false --security-opt seccomp=unconfined --volume /var/run ...
Run command: docker exec -i 76e55178549fcd9f3ec3f735a88af91c356960c6e409d908897f657ef7c18ac4 dd of=/root/docker.sh bs=65536
Run command: docker exec 76e55178549fcd9f3ec3f735a88af91c356960c6e409d908897f657ef7c18ac4 /bin/bash /root/docker.sh
Run command: docker exec -i 76e55178549fcd9f3ec3f735a88af91c356960c6e409d908897f657ef7c18ac4 dd of=/root/ansible.tgz bs=65536
Run command: docker exec 76e55178549fcd9f3ec3f735a88af91c356960c6e409d908897f657ef7c18ac4 mkdir /root/ansible
Run command: docker exec 76e55178549fcd9f3ec3f735a88af91c356960c6e409d908897f657ef7c18ac4 tar oxzf /root/ansible.tgz -C /root/ansible
Run command: docker exec 76e55178549fcd9f3ec3f735a88af91c356960c6e409d908897f657ef7c18ac4 /usr/bin/env ANSIBLE_TEST_CONTENT_ROOT=/root/ansible LC ...
WARNING: Skipping tests disabled by default without --allow-disabled: docs-build, package-data
WARNING: Skipping sanity test 'action-plugin-docs' on unsupported Python 2.7.
No tests applicable.
WARNING: Skipping sanity test 'ansible-doc' on unsupported Python 2.7.No tests applicable.
WARNING: Skipping sanity test 'azure-requirements' on unsupported Python 2.7.
No tests applicable.
Run command: /usr/bin/python2.7 /root/ansible/test/lib/ansible_test/_data/yamlcheck.py
Running sanity test 'bin-symlinks'
Read 8765 sanity test ignore line(s) for Ansible from: test/sanity/ignore.txt
pre:changelogs/fragments/
path:test/integration/targets/ansible/ansible-testé.cfg
Traceback (most recent call last):
File "/root/ansible/bin/ansible-test", line 28, in <module>
main()
File "/root/ansible/bin/ansible-test", line 24, in main
cli_main()
File "/root/ansible/test/lib/ansible_test/_internal/cli.py", line 168, in main
args.func(config)
File "/root/ansible/test/lib/ansible_test/_internal/sanity/__init__.py", line 165, in command_sanity
settings = test.load_processor(args)
File "/root/ansible/test/lib/ansible_test/_internal/sanity/__init__.py", line 876, in load_processor
return SanityIgnoreProcessor(args, self, None)
File "/root/ansible/test/lib/ansible_test/_internal/sanity/__init__.py", line 450, in __init__
self.parser = SanityIgnoreParser.load(args)
File "/root/ansible/test/lib/ansible_test/_internal/sanity/__init__.py", line 428, in load
SanityIgnoreParser.instance = SanityIgnoreParser(args)
File "/root/ansible/test/lib/ansible_test/_internal/sanity/__init__.py", line 280, in __init__
paths_by_test[test.name] = set(target.path for target in test.filter_targets(test_targets))
File "/root/ansible/test/lib/ansible_test/_internal/sanity/__init__.py", line 760, in filter_targets
target.path.startswith(pre)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 45: ordinal not in range(128)
мой прогресс:
Я попытался найти проблему с помощью простого кода фрагмента печати, который я добавил в /root/ansible/test/lib/ansible_test/_internal/sanity/__init__.py
и обнаружил, что это test/integration/targets/ansible/ansible-testé.cfg
этот файл с символом, которого нет в кодировке ascii.
после того, как я погрузился в ansible -тест, я нашел следующий код в /Users/steveguan/code/Interest/ansible/test/lib/ansible_test/_internal/delegation.py
:
def generate_command(args, python_interpreter, ansible_bin_path, content_root, options, exclude, require):
"""
:type args: EnvironmentConfig
:type python_interpreter: str | None
:type ansible_bin_path: str
:type content_root: str
:type options: dict[str, int]
:type exclude: list[str]
:type require: list[str]
:rtype: list[str]
"""
options['--color'] = 1
cmd = [os.path.join(ansible_bin_path, 'ansible-test')]
if python_interpreter:
cmd = [python_interpreter] + cmd
# Force the encoding used during delegation.
# This is only needed because ansible-test relies on Python's file system encoding.
# Environments that do not have the locale configured are thus unable to work with unicode file paths.
# Examples include FreeBSD and some Linux containers.
env_vars = dict(
LC_ALL='en_US.UTF-8',
ANSIBLE_TEST_CONTENT_ROOT=content_root,
)
env_args = ['%s=%s' % (key, env_vars[key]) for key in sorted(env_vars)]
cmd = ['/usr/bin/env'] + env_args + cmd
cmd += list(filter_options(args, sys.argv[1:], options, exclude, require))
cmd += ['--color', 'yes' if args.color else 'no']
он должен декодировать путь с помощью utf-8, но в результате он потерпел неудачу. У кого-нибудь есть такой же вопрос?