Skip to content

Conversation

@Dorin-Pleava
Copy link
Contributor

No description provided.

@puppetcla
Copy link

CLA signed by all contributors.

@Dorin-Pleava Dorin-Pleava force-pushed the PUP-10597/Remove_deprecated_held_from_apt branch from 7f0f0b4 to 9adf282 Compare August 11, 2020 07:20
@Dorin-Pleava Dorin-Pleava requested a review from a team August 11, 2020 09:49
@Dorin-Pleava Dorin-Pleava marked this pull request as ready for review August 11, 2020 09:49
@Dorin-Pleava Dorin-Pleava requested review from a team August 11, 2020 09:49
@gimmyxd
Copy link
Contributor

gimmyxd commented Aug 11, 2020

@Dorin-Pleava we should entirely remove "held" from ensure values, as it was replaced by apt mark: #7802

@Dorin-Pleava Dorin-Pleava force-pushed the PUP-10597/Remove_deprecated_held_from_apt branch 2 times, most recently from 79b917c to 7bce804 Compare August 11, 2020 13:28
@gimmyxd
Copy link
Contributor

gimmyxd commented Aug 17, 2020

Jenkins please test this on debian8-64,debian9-64,debian10-64

@Dorin-Pleava
Copy link
Contributor Author

Jenkins please test this on debian10-64a,debian8-64a,debian8-32a,debian9-64a,debian9-32a

@gimmyxd
Copy link
Contributor

gimmyxd commented Aug 17, 2020

Jenkins please test this on debian9-64,debian10-64

@@ -1,4 +1,4 @@
test_name "dpkg ensure held package is latest installed" do
test_name "dpkg ensure hold package is latest installed" do
confine :to, :platform => /debian-8-amd64/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please update this to debian-9 as debian-8 was dropped in puppet-agent main

@@ -1,4 +1,4 @@
test_name "dpkg ensure held package should preserve version if package is already installed" do
test_name "dpkg ensure hold package should preserve version if package is already installed" do
confine :to, :platform => /debian-8-amd64/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please update this to debian-9 as debian-8 was dropped in puppet-agent main

@Dorin-Pleava Dorin-Pleava force-pushed the PUP-10597/Remove_deprecated_held_from_apt branch from 7bce804 to ee97ee7 Compare August 18, 2020 06:43
Comment on lines 176 to 183
def deprecated_hold
def hold
if package_not_installed?
self.install
end
hold
end

def hold
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we still need to call self.install in this step, as it may run the install twice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it seems it installs the package without doing the self.install here.
I think package_not _installed? method can also be removed as I only found it being used here.

@GabrielNagy
Copy link
Contributor

I believe this works okay, but while testing I found a behavior that's not idempotent (also happens without changes from this PR).

The following will always report changes on Debian 10:

package { 'mc':
    ensure => present,
    mark   => none,
}

/cc @ciprianbadescu

As provider.hold does not install packages, method
package_not_installed? is no longer needed.

Also removed package_not_installed? tests and tests that expect
provider.hold to call provider.install
@ciprianbadescu
Copy link
Contributor

package { 'mc': ensure => present, mark => none, }

Should be solved with bellow change:

--- a/lib/puppet/provider/package/dpkg.rb
+++ b/lib/puppet/provider/package/dpkg.rb
@@ -74,7 +74,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
       elsif ['config-files', 'half-installed', 'unpacked', 'half-configured'].include?(hash[:status])
         hash[:ensure] = :absent
       end
-      hash[:mark] = :hold if hash[:desired] == 'hold'
+      hash[:mark] = hash[:desired] == 'hold' ? :hold : :none
     else
       Puppet.debug("Failed to match dpkg-query line #{line.inspect}")
     end

@ciprianbadescu ciprianbadescu requested a review from a team August 19, 2020 11:52
@puppetcla
Copy link

CLA signed by all contributors.

@GabrielNagy GabrielNagy merged commit 52fc636 into puppetlabs:main Aug 27, 2020
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

Successfully merging this pull request may close these issues.

6 participants