Ask Your Question
2

Does purged to present mean it is re-installed

asked 2013-05-15 10:51:55 -0600

Matt Copperwaite gravatar image

updated 2014-03-27 06:37:54 -0600

We have some Debian packages that we built ourselves that we are installing through puppet. I am concerned that every time I run puppetd --test the Debian packages that have been previously installed through puppet print the message:

(package name)/ensure: ensure changed 'purged' to 'present'

The init.pp directive we are using looks similar to the following. software_dev_file is defined in the usual way.

package { "software_dev":
    provider => dpkg,
    ensure => present,
    source => "/tmp/software.deb",
    require => File["software_dev_file"]
}

Does that mean my package is being uninstalled and reinstalled? What do I need to do if I don't want my ... (more)

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
0

answered 2014-03-27 09:58:53 -0600

Matt Copperwaite gravatar image

It's always great to get to answer your own questions, especially after so long. To prove what was going on I built a trivial Debian package that wrote out to a file whenever it was installed and uninstalled.

What I discovered was that when Puppet runs dpkg it uninstalls then reinstalls the package if ensure is set to true. Obviously that means that if this is a service, every 15 minutes (or however often your puppet agent runs) your service will be stopped and started.

But it seems to be more to do with the way dpkg works than ... (more)

edit flag offensive delete link more
3

answered 2013-05-15 13:40:11 -0600

ramindk gravatar image

updated 2013-05-16 03:14:59 -0600

That's the standard message when a new package is installed at least when apt is the package manager. Here's an example from Puppet 2.7.21 and 12.04 LTS.

[ramindk@preceise ~]# sudo puppet apply -e "package { tcptraceroute: ensure => present }"    
Notice: /Stage[main]//Package[tcptraceroute]/ensure: ensure changed 'purged' to 'present'
Notice: Finished catalog run in 6.45 seconds

The same under CentOS 6.4 with yum as the package manager looks like this.

[ramindk@centos64 ~]# sudo puppet apply -e "package { tcptraceroute: ensure => present, }"    
notice: /Stage[main]//Package[tcptraceroute]/ensure: created
notice: Finished catalog run in 5.95 ...
(more)
edit flag offensive delete link more

Comments

that is a good response. I was trying to convey though that the package is already installed when that message appears. I'll update my question.

Matt Copperwaite gravatar imageMatt Copperwaite ( 2013-05-16 02:45:32 -0600 )edit

Added a few more ideas in response to your updated question.

ramindk gravatar imageramindk ( 2013-05-16 03:15:31 -0600 )edit

So they're not virtual packages they are deb files for some software we built ourselves. I'll flesh my question out a bit more.

Matt Copperwaite gravatar imageMatt Copperwaite ( 2013-05-16 04:38:18 -0600 )edit
1

Before you run Puppet, what is the output of dpkg -l | grep software_dev? Along the same lines, what's the output of the same command after Puppet runs?

Ancillas gravatar imageAncillas ( 2013-05-16 13:52:38 -0600 )edit

@Ancillas it is ii sofwate_dev 0.1.1 This is software dev before and after puppetd --test but it still says notice: Package[software_dev]/ensure: ensure changed 'purged' to 'present ...(more)

Matt Copperwaite gravatar imageMatt Copperwaite ( 2013-05-17 02:42:06 -0600 )edit
0

answered 2013-05-15 13:50:38 -0600

I'd say it's being installed.

Looks like it is the regular message on DEbian based systems : Example on mediwiki vagrant

On RedHat based system, it looks like :

notice: /Stage[main]//Node[default]/Package[git]/ensure: created

edit flag offensive delete link more
0

answered 2016-02-10 13:11:12 -0600

I had this problem, and searching for the solution yielded the fix here.

Ensure the name specified for the package resource matches the actual package name that dpkg sees.

From their example:

Incorrect Example

The package name used by dpkg is libapache2-mod-auth-openid. This will fail to match and install again.

package { 'mod_auth_openid':
    provider => dpkg,
    ensure   => present,
    source   => "/var/tmp/libapache2-mod-auth-openid_0.7-0.1_amd64",
}

Correct Example

The package name used by dpkg is libapache2-mod-auth-openid. This will succeed in matching and no additional install will be performed.

package { 'libapache2-mod-auth-openid':
    provider => dpkg,
    ensure   => present,
    source   => "/var/tmp/libapache2-mod-auth-openid_0.7-0.1_amd64",
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-15 10:51:55 -0600

Seen: 2,002 times

Last updated: Mar 27 '14