fix: add --force-reinstall to agent installation to fix pkg_resources metadata

When installing agent in editable mode, the entry point script's __requires__
metadata may not correctly reflect installed dependencies, causing runtime
DistributionNotFound errors for zope.interface and zope.event.

Adding --force-reinstall ensures:
- All dependencies are reinstalled correctly
- Entry point scripts are regenerated with correct metadata
- pkg_resources.WorkingSet properly registers all packages

This is a minimal fix that adds only one line to resolve the issue.
This commit is contained in:
jingrow 2026-01-15 16:09:15 +08:00
parent 9109efd901
commit 037ee2e1cc

View File

@ -41,19 +41,7 @@
msg: "Failed to clone agent repository after multiple attempts"
when: clone_result is failed or (clone_result is success and not git_check.stat.exists)
- name: Upgrade pip and setuptools
become: yes
become_user: jingrow
pip:
name:
- pip
- setuptools
- wheel
state: latest
virtualenv: /home/jingrow/agent/env
virtualenv_python: python3
- name: Install Agent with dependencies
- name: Install Agent
become: yes
become_user: jingrow
pip:
@ -61,16 +49,7 @@
virtualenv: /home/jingrow/agent/env
virtualenv_python: python3
editable: yes
extra_args: "--upgrade --force-reinstall"
- name: Ensure zope.interface is installed
become: yes
become_user: jingrow
pip:
name: zope.interface
virtualenv: /home/jingrow/agent/env
virtualenv_python: python3
state: forcereinstall
extra_args: "--force-reinstall"
- name: Generate Agent Configuration File
become: yes