Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use the package install attribute to ensure that given package X is installed.

However, even though the package is installed, puppet tries to install it over again and of course exits with an exception ("X already installed"). It does not happen when the package name matches a service name. I use local RPM and an RPM provider.

How do I avoid that exception?


I also implemented a workaround: if I succeed with the RPM installation, I create a file called /X_DONE. Then I install the dependencies based on that file, not the package.

What is the proper way to deal with that?

EDIT: Failing manifest:

 file {"$tmp_dir/$php_pdo":
   ensure => present,
   source => "puppet:///files/services/$php_pdo"
 }

 package {"php_pdo":
   require => File["$tmp_dir/$php_pdo"],
   ensure => installed,
   provider => rpm,
   source => "$tmp_dir/$php_pdo"
 }

and exception:

err: /Stage[main]/Apache-php/Package[php_pdo]/ensure: change from absent to present failed: Execution of '/bin/rpm -i --oldpackage /tmp/puppet/php-pdo-5.1.6-27.el5_5.3.x86_64.rpm' returned 1:     package php-pdo-5.1.6-27.el5_5.3.x86_64 is already installed
share|improve this question
    
If you can post the classes/manifests that you are using it would be easier to diagnose. –  Torian Sep 1 '11 at 23:36

2 Answers 2

up vote 7 down vote accepted

You refer to the package by the name "php_pdo", but Puppet sees the package as "php-pdo" (dash, not underscore). Every time it checks to see of php_pdo is installed, it finds out that it is not. Unfortunately it doesn't matter how many times you install php-pdo, it will never be php_pdo.

To resolve the issue, change the line:

package {"php_pdo":

to be:

package {"php-pdo":
share|improve this answer
    
wow, so $names are so 'heavy'. Thanks a lot, it puts light in my system ;) –  michal Sep 2 '11 at 16:58

In fact, I don't think above is a correct answer.

Package name should be found according to its package manager.

for ubuntu

root@Web2:~# dpkg --get-selections | grep php
php-pdo install

package name would be php-pdo

for centos

[root@centos 2.6.32-71.el6.x86_64-x86_64]# rpm -qa | grep php

we need to omit the version for rpm according to this reference http://projects.puppetlabs.com/projects/puppet/wiki/Strict_RPM_Package_Version_Management

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.