I am trying to puppetize a process that goes like this:
1) remove package a.i386
2) create repo file
3) install package a.x86_64 from repo
4) update config_file_1
5) update config_file_2
6) update config_file_3
7) start service

Shouldn't be too hard right? Except I have played with every combination I
can think of using with notify, subscribe, before, and require and I can't
seem to get this to all happen in the same run. It always does a part of it
the first run then requires a second run to finish up (a couple of
variations required three and even four runs!). I am struggling to find out
where I am going wrong. The code I have right now is the "best" in that it
always requires _just_ two runs to complete. I edited out a lot of the
parameters that are trivial just to focus on the dependency problem. I can
share full code if I really need to but it is a bit messy as I pass all
kinds of stuff to the template and I don't want to confuse the issue.

Here is the basis of my code:

package { ['a.i386']:
   ensure => absent,
   before => Package['a.x86_64'],

yumrepo { "RepoA":
   # stripped out other paramters
   notify => Package['a.x86_64'],

package { ['a.x86_64']:
   ensure => absent,
   subscribe => Yumrepo['RepoA'],

file { "/etc/config_file_1":
   # stripped out other paramters
   subscribe => Package['a.x86_64'],

file { "/etc/config_file_2":
   # stripped out other paramters
   subscribe => Package['a.x86_64'],

file { "/etc/config_file_3":
   # stripped out other paramters
   subscribe => Package['a.x86_64'],

service { 'a':
   # stripped out other paramters
   subscribe =>

As stated, I get a consistent run out of this. I just have to do it twice.
First run:
a.i386 is removed
Yumrepo is created
scheduling refresh of service
All three files fail to install
service fails

Second run
a.x86_64 is created
scheduling refresh of service
All three files install
service works


According to this page [1] subscribe "Causes a resource to be applied after
the target resource. The subscribing resource will refresh if the target
resource changes." Thus the scheduling of a refresh shouldn't happen until
/after/ the files and NONE of the files are supposed to run until /after/
the package is installed! But clearly, this is not the case! At least the
service schedule happens after the files fail so that is somewhat in order.
And the repo is created properly, so that is a plus. I have a feeling that
it is because the yum repo isn't refreshed before trying to install the
package, but I am not 100% sure on that. As far as I can tell through
debug, puppet never even attempts to install a.x86_64 until the second run.

The only thing left that I can think of that I haven't tried would be to
shove each process into a subclass then chain them together something like
but that seems /really/ silly.

Can someone please point out where things are going screwy for me? I would
greatly appreciate it.


You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4562f58e-d88d-4d84-bab3-9337c6a081f9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
grouppuppet-users @
postedJan 30, '14 at 10:00p
activeJan 31, '14 at 1:21p



site design / logo © 2022 Grokbase