On Thursday, July 11, 2013 3:23:46 AM UTC-5, Daniel Siechniewicz
wrote:>
> Hi,
>
> I have a seemingly simple situation, it can''t really get simpler
than that
> when it comes to resource chaining:
>
> node ''redis'' {
> class { ''os::repo::misc'': }
> class { ''redis'': }
> Class[''os::repo::misc''] ->
Class[''redis'']
> }
>
> This doesn''t work:
>
> Info: Applying configuration version ''1373529981''
> Error: Could not find package redis
> Error: /Stage[main]/Redis::Package/Package[redis]/ensure: change from
> absent to present failed: Could not find package redis
> Notice: /Stage[main]/Redis::Config/File[redis_config]: Dependency
> Package[redis] has failures: true
> Warning: /Stage[main]/Redis::Config/File[redis_config]: Skipping because
> of failed dependencies
> Notice: /Stage[main]/Redis::Config/File[/apps/redis]: Dependency
> Package[redis] has failures: true
> Warning: /Stage[main]/Redis::Config/File[/apps/redis]: Skipping because of
> failed dependencies
> Notice: /Stage[main]/Redis::Service/Service[redis]: Dependency
> Package[redis] has failures: true
> Warning: /Stage[main]/Redis::Service/Service[redis]: Skipping because of
> failed dependencies
> Notice: /Stage[main]/Os::Repo::Misc/File[sp-misc.mirrors.list]/ensure:
> defined content as
''{md5}09676e55c31e92aa2090199f5b06423a''
> Info: create new repo misc in file /etc/yum.repos.d/misc.repo
> Notice: /Stage[main]/Os::Repo::Misc/Yumrepo[misc]/mirrorlist: mirrorlist
> changed '''' to
''file:///etc/yum.repos.d/sp-misc.mirrors.list''
> Notice: /Stage[main]/Os::Repo::Misc/Yumrepo[misc]/enabled: enabled changed
> '''' to ''1''
> Notice: /Stage[main]/Os::Repo::Misc/Yumrepo[misc]/gpgcheck: gpgcheck
> changed '''' to ''0''
> Info: changing mode of /etc/yum.repos.d/misc.repo from 600 to 644
> Notice: Finished catalog run in 3.07 seconds
>
>
> Of course, since the repo is deployed, it will work on second puppet run.
>
> There are no internal dependencies between redis and os::repo::misc.
I''ve
> had the same problem recently with other repositories.
>
> This: Yumrepo[''misc''] ->
Class[''redis''] also doesn''t work.
>
> Here''s the os::repo::misc
>
> class os::repo::misc {
> file { ''sp-misc.mirrors.list'':
> ensure => present,
> source =>
''puppet:///modules/os/repo/sp-misc.mirrors.list'',
> mode => 0644,
> path => ''/etc/yum.repos.d/sp-misc.mirrors.list'',
> }
>
> yumrepo { ''misc'':
> name => ''misc'',
> mirrorlist =>
''file:///etc/yum.repos.d/sp-misc.mirrors.list'',
> enabled => 1,
> gpgcheck => 0,
> require => File[''sp-misc.mirrors.list''],
> }
> }
>
> Redis module is more complicated (I cloned this:
> https://github.com/electrical/puppet-redis), but I''ve had the same
> problem with other modules, completely unrelated to one another, so it
> doesn''t seem like there''s any pattern there, other than
repo + something
> just doesn''t work.
>
> Any thoughts? Could this be a bug, or am I doing something wrong?
>
Some of both. You are running into a known Puppet behavior, that
relationships with a class C are not transitively applied to other classes
declared by C. Although this tends to surprise people, it is not a bug.
In fact, it is essential behavior under many circumstances. On the other
hand, sometimes you do want strict containment of one or more classes by
another, and in that case you need to make explicit declarations that tell
Puppet so. The usual way of doing this is to apply the "Anchor
pattern" to
the container class, and you will find a lot of information about it under
that name.
The puppet-redis module you cloned does not use the anchor pattern. That
is probably a flaw in that module, but perhaps it is intentional. Either
way, your clone of it needs to use the anchor pattern in order for
relationships with class ''redis'' to have the effect you want.
(Or else it
needs to incorporate everything into class ''redis'' instead of
splitting it
out into separate classes.)
John
--
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.