Complete backward compatibility cleanup and Windows improvements

- Fix main.yml requirements.txt lookup with pyproject.toml parsing
- Update test_docker_localhost_deployment.py to check pyproject.toml
- Fix Vagrantfile pip args with hard-coded dependency versions
- Enhance Windows OS detection for WSL, Git Bash, and MINGW variants
- Implement versioned Windows PowerShell installer (0.8.5)
- Update documentation references in troubleshooting.md and tests/README.md

All linters and tests pass: ruff  yamllint  pytest 48/48  ansible syntax 

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Dan Guido 2025-08-05 15:44:51 -07:00
parent ca97542130
commit 048a2794ec
6 changed files with 12 additions and 14 deletions

2
Vagrantfile vendored
View file

@ -15,7 +15,7 @@ Vagrant.configure("2") do |config|
# https://github.com/hashicorp/vagrant/issues/12204
ansible.pip_install_cmd = "sudo apt-get install -y python3-pip python-is-python3 && sudo ln -s -f /usr/bin/pip3 /usr/bin/pip"
ansible.install_mode = "pip_args_only"
ansible.pip_args = "-r /opt/algo/requirements.txt"
ansible.pip_args = "ansible==11.8.0 jinja2>=3.1.6 netaddr==1.3.0 pyyaml>=6.0.2"
ansible.inventory_path = "/opt/algo/inventory"
ansible.limit = "local"
ansible.verbose = "-vvvv"

6
algo
View file

@ -56,9 +56,9 @@ install_uv_via_download() {
fi
echo "Downloading uv installation script..."
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
# Windows (Git Bash/WSL)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "linux-gnu" && -n "${WSL_DISTRO_NAME:-}" ]] || uname -s | grep -q "MINGW\|MSYS"; then
# Windows (Git Bash/WSL/MINGW) - use versioned installer
powershell -ExecutionPolicy ByPass -c "irm https://github.com/astral-sh/uv/releases/download/0.8.5/uv-installer.ps1 | iex"
else
# macOS/Linux - use the versioned script for consistency
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.8.5/uv-installer.sh | sh

View file

@ -121,7 +121,7 @@ You are running an old version of `pip` that cannot download the binary `cryptog
You tried to install Algo and you see an error that reads "ansible-playbook: command not found."
You did not finish step 4 in the installation instructions, "[Install Algo's remaining dependencies](https://github.com/trailofbits/algo#deploy-the-algo-server)." Algo depends on [Ansible](https://github.com/ansible/ansible), an automation framework, and this error indicates that you do not have Ansible installed. Ansible is installed by `pip` when you run `python3 -m pip install -r requirements.txt`. You must complete the installation instructions to run the Algo server deployment process.
You did not finish the installation instructions, "[Install Algo's remaining dependencies](https://github.com/trailofbits/algo#deploy-the-algo-server)." Algo depends on [Ansible](https://github.com/ansible/ansible), an automation framework, and this error indicates that you do not have Ansible installed. Dependencies are managed by uv and installed automatically when you run `./algo`. You must complete the installation instructions to run the Algo server deployment process.
### Fatal: "Failed to validate the SSL certificate"
@ -138,8 +138,8 @@ You tried to install Algo and you received an error like this one:
```
Could not fetch URL https://pypi.python.org/simple/secretstorage/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Could not find a version that satisfies the requirement SecretStorage<3 (from -r requirements.txt (line 2)) (from versions: )
No matching distribution found for SecretStorage<3 (from -r requirements.txt (line 2))
Could not find a version that satisfies the requirement SecretStorage<3 (from pyproject.toml dependencies) (from versions: )
No matching distribution found for SecretStorage<3 (from pyproject.toml dependencies)
```
It's time to upgrade your python.

View file

@ -22,11 +22,9 @@
no_log: true
register: ipaddr
- name: Extract ansible version from requirements
- name: Extract ansible version from pyproject.toml
set_fact:
ansible_requirement: "{{ item }}"
when: '"ansible" in item'
with_items: "{{ lookup('file', 'requirements.txt').splitlines() }}"
ansible_requirement: "{{ lookup('community.general.toml', 'pyproject.toml', 'project.dependencies') | select('match', '^ansible.*') | first }}"
- name: Parse ansible version requirement
set_fact:
@ -55,7 +53,7 @@
msg: >
Ansible version is {{ pip_package_info.packages.pip.ansible.0.version }}.
You must update the requirements to use this version of Algo.
Try to run python3 -m pip install -U -r requirements.txt
Try to run: uv sync
- name: Include prompts playbook
import_playbook: input.yml

View file

@ -5,7 +5,7 @@
### What We Test Now
1. **Basic Sanity** (`test_basic_sanity.py`)
- Python version >= 3.10
- requirements.txt exists
- pyproject.toml exists and has dependencies
- config.cfg is valid YAML
- Ansible playbook syntax
- Shell scripts pass shellcheck

View file

@ -123,7 +123,7 @@ def test_localhost_deployment_requirements():
'Python 3.8+': sys.version_info >= (3, 8),
'Ansible installed': subprocess.run(['which', 'ansible'], capture_output=True).returncode == 0,
'Main playbook exists': os.path.exists('main.yml'),
'Requirements file exists': os.path.exists('requirements.txt'),
'Project config exists': os.path.exists('pyproject.toml'),
'Config template exists': os.path.exists('config.cfg.example') or os.path.exists('config.cfg'),
}