I have a manifests that looks like this:

----- s n i p -----
class someclass {
        package { 'mypackage':
            ensure          => $version,
            install_options => [ '-o', 'Dpkg::Options::=--force-overwrite' 
            notify          => Service['myservice'],
            require         => Class['defaults::apt_repo::repo']
        defaults::hold_pkg { 'mypackage': }

define defaults::hold_pkg() {
    exec { "hold-${name}":
        command => "/bin/echo '${name} hold' | /usr/bin/dpkg 
        unless  => "/usr/bin/dpkg --get-selections ${name} | /bin/grep -q 
        require => Package[$name]

class someclass::service {
    service { 'myservice':
        ensure     => 'running',
        enable     => true,
        hasrestart => false,
        provider   => systemd
----- s n i p -----

This results in:

----- s n i p -----
Notice: /Stage[main]/Someclass/Package[mypackage]/ensure: ensure changed 
'held' to '1.0.0-20180409-458'
Info: /Package[mypackage]: Scheduling refresh of Service[mypackage]
Notice: /Stage[main]/someclass::Service/Service[mypackage]: Triggered 
'refresh' from 1 events
----- s n i p -----

I understand *why* this is happening, but I don't know how to fix it. I 
don't want the app to restart
just because of that change (held to version).

The reason I do it this way is so that I can still run "apt-get 
[dist]upgrade" without risking an upgrade/change
of the/that package.

I can't use "~>" or "->" between "package {}" and "hold_pkg {}" either, 
because Puppet sees a change in the
package (because of the "held" to "<version>")..

I'm running Puppet version 3.8.5 on Ubuntu 16.04.

You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to