Why does Puppet keep installing a package even if it is already installed?

9,756

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:
9,756

Related videos on Youtube

michal
Author by

michal

Updated on September 18, 2022

Comments

  • michal
    michal over 1 year

    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
    
  • michal
    michal over 12 years
    wow, so $names are so 'heavy'. Thanks a lot, it puts light in my system ;)