forked from evolvingweb/puppet-apt
-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Description
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
onlyifsetting 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 '" ]
Metadata
Metadata
Assignees
Labels
No labels