Puppet: System Administration Automated

Support

Ticket #571 (closed defect: fixed)

Opened 1 year ago

Last modified 6 months ago

Resources cannot be used in the same run their providers are made functional

Reported by: windowsrefund Assigned to: luke
Priority: high Milestone: elmo
Component: library Version: 0.22.2
Severity: normal Keywords: provider yum bug
Cc: Triage Stage: Needs design decision
Attached Patches: None Complexity: Unknown

Description

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.

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"] ]                   
    }                                                                                                                                 
                                                                                                                                      
                                                                                                                                      
}

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.

Change History

04/19/07 22:37:12 changed by luke

  • specification set to Unnecessary.
  • patch set to None.
  • complexity set to Unknown.
  • milestone changed from grover to elmo.
  • approval set to Unnecessary.
  • compatibility set to Unknown.
  • stage set to Needs design decision.

01/19/08 22:46:54 changed by luke

  • priority changed from normal to high.

02/26/08 01:55:28 changed by luke

  • summary changed from 2 runs of puppetd are required in order to use yum provider when not initially present to Resources cannot be used in the same run their providers are made functional.

Marked #1090 a dupe.

03/20/08 18:14:21 changed by apenney

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 => Packageruby-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.

03/24/08 23:10:19 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [6a53519].