puppetlabs / puppetlabs-apt

Puppet module to help manage Apt
https://forge.puppetlabs.com/puppetlabs/apt
Apache License 2.0
216 stars 463 forks source link

apt::mark with setting => unhold is not idempotent #1166

Open aboks opened 4 months ago

aboks commented 4 months ago

Describe the Bug

A resource declation like

apt::mark { 'foo':
  setting => unhold
}

is not idempotent and will execute on every Puppet run.

Expected Behavior

I would expect this resource to be idempotent, so that it can be used to ensure that a certain package is not held.

Steps to Reproduce

Add an apt::mark resource as above for an installed package that is not held, and observe Puppet executing it on every run.

Environment

Additional Context

It seems that the unless_cmd for unhold is just not configured: https://github.com/puppetlabs/puppetlabs-apt/blob/22ed8ab5509d7f0f553f3dd4fab3c096c17214b0/manifests/mark.pp#L16 Something like ! (/usr/bin/apt-mark showhold ${title} | grep ${title} -q), or adding /usr/bin/apt-mark showhold ${title} | grep ${title} -q to onlyif, should probably work.