On Monday, January 7, 2013 9:33:15 PM UTC-6, goo...@reetstreet.com wrote:
>
> On Centos 6.3, I have attempted to upgrade to php 5.4 using the following:
>
>     yumrepo { "epel-repo":
>         baseurl => "
> http://download.fedoraproject.org/pub/epel/6/\$basearch";,
>         descr => "Epel Repo",
>         enabled => 1,
>         gpgcheck => 0,
>     }
>     yumrepo   { "remi-repo":
>         baseurl => "
> http://rpms.famillecollet.com/enterprise/6/remi/\$basearch/";,
>         descr => "remi repo",
>         enabled => 1,
>         gpgcheck => 0,
>         require => Yumrepo["epel-repo"],
>

This 'require' is unnecessary, or at least misplaced.  No Yumrepo resource 
has any true application-order dependency on any other.  This is probably 
not harmful, however.
 

>     }
>     package { 'php':
>         ensure => latest,
>         require => [ Yumrepo["remi-repo"] ],
>     }
>
> This actually works fine, but *only* if I apply the manifest *twice*.  It 
> seems that the first time it runs, the Remi repo has not been installed, so 
> Puppet decides that the Package php statement ensure => latest is in fact 
> up-to-date, so it does not actually try to update php.  (php 5.3.3 is 
> installed from the default repository; Remi makes php 5.4 available.) On 
> the second run, Remi is installed, and Puppet correctly notices that php 
> needs to be updated.
>
> Is there any way I can get the php package rule to update php on the first 
> run?
>


Something is very strange here.  Denmat is probably right to implicate the 
yum cache, but that doesn't make sense if remi-repo is new to the target 
node.  Yet, if the remi-repo were not new to the node then yum should 
already know about the php-5.4 packages available from it.  Also, if it is 
really a yum cache problem then it doesn't make sense that the php update 
is reliably installed on the second run, unless you've omitted something 
relevant.

I infer, therefore, that somewhere you have an Exec that updates or 
invalidates the yum cache ("yum clean metadata", "yum clean expire-cache", 
"yum makecache", or maybe something else), but that it is not running at 
the right time.  To ensure that package management correctly reflects your 
repository, such a command needs to run, once, before all packages are 
managed but after all needed Yumrepos are managed.  For example, you might 
have

--
exec { 'expire yum cache':
    command => 'yum clean expire-cache'
}

Yumrepo <| |> -> Exec['expire yum cache'] -> Package <| |>
--

You may need somehow to ensure that it is parsed after all Yumrepo and 
Package declarations.

Alternatively, if you are in control of all repository and package 
declarations (i.e. you are not using third-party modules, or you are 
willing to modify those you do use) then you could make the repos and 
packages declare the needed relationships instead of declaring them 
separately via the chain operator.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/cy20-zEt6TcJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to