Skip to content

bug(ansible): every dpkg presence probe is skipped under --check, so a dry run fails at the task that reads it #19663

Closed
1 of 1 issue completed

Description

@mrveiss

Problem

Every Ansible package-presence probe registers the result of a dpkg-query command task and then reads <var>.stdout in a later when:. Under ansible-playbook --check a command task is skipped and registers no stdout, so the reading task fails with an undefined-attribute error instead of reporting what it would change. A dry run of any play that contains one of these probes dies at the probe.

Sites (dpkg-query -W --showformat=${Status} <pkg> + register:), none with check_mode: false:

The probe is read-only, so it is safe to run in check mode.

Found by code review on #19329's PR.

Fix

Add check_mode: false to every dpkg presence probe. Extend repo_tests/dpkg_tests_installed_state_not_knowledge_17387_test.py, which already enumerates these registrations, so that a probe without it fails.

Acceptance criteria

Activity

  1. mrveiss commented on Oct 27, 2026

    @mrveiss
    OwnerAuthor

    Maintainer decision (2026-10-27), from the review of the merge train PR #19784: run the status query in check mode on every package or service where it works. This issue therefore widens from dpkg presence probes to every read-only status query: dpkg-query, apt-cache policy, systemctl is-active/is-enabled, <binary> --version and rpm -q. Each gets check_mode: false and changed_when: false, and a guard fails on a new query task without it, with contrast fixtures. About 60 query lines in 12+ files on main; only 6 tasks carry check_mode: false today. The two Grafana version probes are fixed in #19784. (Consolidated from #19808.)

  2. github-actions commented on Oct 27, 2026

    @github-actions
    Contributor

    Landed in train train-2026-10-27-85w (#19784, merge 71503d9dfe) via #19665

  3. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    Landed in train train-2026-10-28-86d (#19884, merge d6607461af) via #19814

  4. mrveiss commented on Oct 28, 2026

    @mrveiss
    OwnerAuthor

    Landed via the merge train (PR #19884), main d660746.

    Evidence on main:

    Issue stays open for a maintainer ruling on AC2.

  5. mrveiss commented on Nov 19, 2026

    @mrveiss
    OwnerAuthor

    Acceptance criteria verified against main at f0a3255 (the commit deployed to the local install), owner-approved closure 2026-11-19. Evidence, read at that commit:

    • Every status query runs in check mode: repo_tests/ansible_status_queries_run_in_check_mode_19663_test.py:99 test_every_status_query_runs_in_check_mode (assert not missing :115, floor 29).
    • A query without it is flagged: same file :128.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginfrastructurephase:M1.4Wizard and SLM: choose a mode, apply it, default models workpriority: low

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions