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?
Here is the 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