fix(service-role-loader): loop on a variable of its own #62

Merged
claudiomaradonna merged 1 commit from fix/loader-loop-var into main 2026-12-02 23:50:11 +01:00
Collaborator

Why

service-role-loader includes each service role a host switches on. It
did so in a loop on Ansible's default item. A loaded role whose own task
loops also binds item, so every run through the loader warned
The loop variable 'item' is already in use. The user's --check --diff
run of fortify.yml showed it at container-prune, and zram and
traefik-routes loop the same way. A role task that read the loader's
item would also get its own loop's value instead.

What changed

The loader's include loop now binds service_role_loader_role, so
item stays with the roles it loads. Which roles load, the refusal of
active_services, and the always tag that lets a tagged run reach
the loaded roles are unchanged.

The retired_services gate now also loads container-prune through
the loader under --check and fails on the warning. Its fixture play
and its CONTRIBUTING row say so.

How to verify

Prerequisites: the Setup toolchain. Base main
(a5c49f5); branch fix/loader-loop-var (eba5441).

  • ./tests/gates/check_retired_services.sh passes on the branch. On
    main it fails with "the loader's loop variable collides with a
    loaded role's loop".
  • The same command by hand shows the warning on main and none on the
    branch:
    ansible-playbook -i tests/fixtures/local.yml tests/fixtures/retired_services/playbook.yml --check --tags container-prune -e container_prune_enabled=true -e docker_engine_enabled=true
  • make check passes. ./tests/gates/check_tag_propagation.sh, which
    needs podman, passes on the branch: --tags zram still reaches
    zram through the loader.

Considerations

  • The gate keeps its retired_services name although it now covers
    the loop variable too. Renaming it would touch the Makefile and the
    gate table without helping anyone reading them.
## Why `service-role-loader` includes each service role a host switches on. It did so in a loop on Ansible's default `item`. A loaded role whose own task loops also binds `item`, so every run through the loader warned `The loop variable 'item' is already in use`. The user's `--check --diff` run of `fortify.yml` showed it at `container-prune`, and `zram` and `traefik-routes` loop the same way. A role task that read the loader's `item` would also get its own loop's value instead. ## What changed The loader's include loop now binds `service_role_loader_role`, so `item` stays with the roles it loads. Which roles load, the refusal of `active_services`, and the `always` tag that lets a tagged run reach the loaded roles are unchanged. The `retired_services` gate now also loads `container-prune` through the loader under `--check` and fails on the warning. Its fixture play and its CONTRIBUTING row say so. ## How to verify Prerequisites: the [Setup](CONTRIBUTING.md#setup) toolchain. Base `main` (a5c49f5); branch `fix/loader-loop-var` (eba5441). - `./tests/gates/check_retired_services.sh` passes on the branch. On `main` it fails with "the loader's loop variable collides with a loaded role's loop". - The same command by hand shows the warning on `main` and none on the branch: `ansible-playbook -i tests/fixtures/local.yml tests/fixtures/retired_services/playbook.yml --check --tags container-prune -e container_prune_enabled=true -e docker_engine_enabled=true` - `make check` passes. `./tests/gates/check_tag_propagation.sh`, which needs podman, passes on the branch: `--tags zram` still reaches `zram` through the loader. ## Considerations - The gate keeps its `retired_services` name although it now covers the loop variable too. Renaming it would touch the Makefile and the gate table without helping anyone reading them.
fix(service-role-loader): loop on a variable of its own
All checks were successful
check / check (push) Successful in 24m36s
check / check (pull_request) Successful in 25m19s
eba54415c2
The loader included each service role in a loop on item, so a loaded
role whose task loops, such as container-prune's units, made Ansible
warn that item was already in use, and a task reading the loader's item
would have got its own loop's value. The retired_services gate now
loads container-prune through the loader and fails on the warning.
claudiomaradonna deleted branch fix/loader-loop-var 2026-12-02 23:50:18 +01:00
First-time contributor

Command failed

The agent did not complete this command, so nothing came of it. A person should look at this thread.

The run failed at step "aoe_purge". The operator reads the job logs in the Windmill editor, or finds the run with: wmill job list --path f/agents/bot_commands

## Command failed The agent did not complete this command, so nothing came of it. A person should look at this thread. The run failed at step "aoe_purge". The operator reads the job logs in the Windmill editor, or finds the run with: `wmill job list --path f/agents/bot_commands`
Sign in to join this conversation.
No description provided.