Skip to content

apt::mark with setting auto is not idempotent #1226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
FrankVanDamme opened this issue Mar 6, 2025 · 0 comments
Open

apt::mark with setting auto is not idempotent #1226

FrankVanDamme opened this issue Mar 6, 2025 · 0 comments

Comments

@FrankVanDamme
Copy link

Describe the Bug

apt::mark with setting "auto" will execute every run

apt::mark { 'lib1':
setting => auto,
}

The behaviour is quite similar to #1166.

Expected Behavior

To mark a package as automatic if it is installed and not marked as automatic.

Environment

  • puppetlabs-apt v10.0.0;
  • Debian 11 or 12

Additional Context

The main issue I believe is that the module tries to mark packages as auto that are not installed. What happens in that case:

  • the package will not show up in the output of "apt-mark showauto", since non-installed packages can't be marked
  • the onlyif setting wil always return true: "dpkg -l " will show that the package is uninstalled, but that doesn't mean it returns non-zero exit status. It only does so if the package doesn't exist in the sources.
    https://github.com/puppetlabs/puppetlabs-apt/blob/v10.0.1/manifests/mark.pp#L29

Suggest changing the check to something like:

$onlyif_cmd = ["/usr/bin/dpkg -l $title | grep '^ii '" ]

@FrankVanDamme FrankVanDamme changed the title apt::mark with setting markauto is not idempotent apt::mark with setting auto is not idempotent Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant