Bug #571
Resources cannot be used in the same run their providers are made functional
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 0.25.0 | |||
| Affected Puppet version: | 0.25.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
h2. Scenario
RHEL < 5 do not include yum by default. Therefore, in order to use the yum provider with the package type, steps must be taken to “yummify” the client beforehand.
h2. Attempted Solution
Wrote a class that performs the following tasks:
Installs yum package and all dependencies using the rpm provider Configures client repo configs by using the yumrepo type
Wrote a second class to install nagios-nrpe package using the yum provider like so
class nagios_nrpe {
exec { "yum update":
refreshonly => true
}
# we'll need to ensure that yum update is run before attempting to install a package
package { nagios-nrpe:
ensure => installed,
provider => yum,
before => Exec[[yum update]],
#require => Package[yum],
require => [ Yumrepo[[247_ny_dag_${architecture}"] Yumrepo["247_ny_${lsbdistid}_${lsbdistrelease}_base]]
}
}
h2. Result of first puppetd run
(yum package was uninstalled prior to running the test)
[root@admin4-ny testing]# puppetd --masterport=8141 --test notice: Ignoring --listen on onetime run notice: Ignoring cache info: Caching configuration at /var/lib/puppet/localconfig.yaml info: /Sshkey[admin4-ny]: Adding aliases "puppet" err: Could not create nagios-nrpe: Parameter provider failed: Provider 'yum' is not functional on this platform err: Parameter provider failed: Provider 'yum' is not functional on this platform info: /File[/etc/httpd/conf.d/vhost-yum-repo.conf]: Adding aliases "vhost-conf" notice: Starting configuration run notice: //admin4-ny/yum_client_ny/yum_client_ny_redhat/Package[yum]/ensure: created notice: Finished configuration run in 2.82 seconds [root@admin4-ny testing]#
So yum gets installed…. ok
Now after running puppetd for the second time, the yum provider is available and nagios-nrpe gets installed.
History
Updated by Luke Kanies almost 4 years ago
Marked #1090 a dupe.
Updated by almost 4 years ago
I’m adding my story here as it’s kind of similar, requiring multiple runs to get the results I want:
I have a problem whereby when adding users on the first run, it checks for libshadow too early in the run and then fails, despite having installed ruby-shadow before attempting to add the users.
I have a user statement that looks like this:
class users::defaultusers {
user { "apenney":
ensure => "present",
uid => 35421,
gid => 100,
comment => "Ashley Penney",
home => "/home/apenney",
shell => "/bin/bash",
password => "testhash",
require => Package['ruby-shadow'],
}
If ruby-shadow is uninstalled, but is configured to be installed, it evaluates if adduser can add passwords at the very beginning of the run, then installs ruby-shadow, then attempts to add the users but uses the previously cached answers.
Other details:
I have two modules (repos and users) and the repo module contains the code that adds the repo for ruby-shadow, and the users module contains the user{} and package{} statements.
Updated by Luke Kanies almost 4 years ago
- Status changed from 1 to Closed
- 7 set to fixed
Fixed in [6a53519].