我正在尝试学习如何使用分子角色测试工具。测试在 venv 虚拟环境中进行。
Python 版本 - 3.5.3。
实例 - ubuntu 18.04,驱动程序 - 码头工人。
测试顺利开始,当第一个任务执行时,会出现这样的错误墙:
Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7f6778372f28>
Traceback (most recent call last):
File "/usr/lib/python3.5/weakref.py", line 117, in remove
然后一切都按照脚本完成:
PLAY [Create] ******************************************************************
TASK [Log into a Docker registry] **********************************************
skipping: [localhost] => (item={'name': 'instance', 'image': 'ubuntu:bionic', 'pre_build_image': True})
TASK [Check presence of custom Dockerfiles] ************************************
ok: [localhost] => (item={'name': 'instance', 'image': 'ubuntu:bionic', 'pre_build_image': True})
TASK [Create Dockerfiles from image names] *************************************
skipping: [localhost] => (item={'name': 'instance', 'image': 'ubuntu:bionic', 'pre_build_image': True})
TASK [Discover local Docker images] ********************************************
ok: [localhost] => (item={'changed': False, 'skip_reason': 'Conditional result was False', 'skipped': True, 'item': {'name': 'instance', 'image': 'ubuntu:bionic', 'pre_build_image': True}, 'i': 0, 'ansible_loop_var': 'item', 'ansible_index_var': 'i'})
在收敛阶段,它会引发另一个错误:
fatal: [instance]: FAILED! => {
"ansible_facts": {},
"changed": false,
"failed_modules": {
"setup": {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"failed": true,
"module_stderr": "/bin/sh: 1: /usr/bin/python: not found\nread unix @->/var/run/docker.sock: read: connection reset by peer\n",
"module_stdout": "",
"msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error",
"rc": 1,
"warnings": [
"No python interpreters found for host instance (tried ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])"
]
}
},
"msg": "The following modules failed to execute: setup\n"
}
PLAY RECAP *********************************************************************
instance : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ERROR:
之后,脚本结束,所做的所有更改都将被删除。
分子脚本:
---
dependency:
name: galaxy
lint:
yamllint .
driver:
name: docker
platforms:
- name: instance
image: ubuntu:bionic
pre_build_image: true
provisioner:
name: ansible
log: true
options:
vvv: true
diff: true
verifier:
name: ansible
converge_sequence:
- create
- converge
idempotence_sequence:
- create
- converge
你能告诉我问题可能是什么(是的,我看到错误是在对口译员发誓)?
答案很简单。docker-py 包有问题。我清理了旧版本,安装了一个新版本,将python 3.8版本卷起来,一切都启动了。