Issue #9655 has been updated by James Turnbull.

Category set to package
Status changed from Unreviewed to Needs Decision
Assignee set to Nigel Kersten

Am I missing why this doesn't work? 
----------------------------------------
Bug #9655: Strange behaviour with collections and package providers
https://projects.puppetlabs.com/issues/9655

Author: Matt Dainty
Status: Needs Decision
Priority: Normal
Assignee: Nigel Kersten
Category: package
Target version: 
Affected Puppet version: 2.6.9
Keywords: 
Branch: 


I have the following basic class:

<pre>
class yum {

    yumrepo { "foo":
        ...
        notify => Exec["yum clean all"],
    }

    yumrepo { "bar":
        ...
        notify => Exec["yum clean all"],
    }

    exec { "yum clean all":
        refreshonly => true,
    }

    Exec["yum clean all"] -> Package <| provider == yum |>
}
</pre>

So basically I'd like to run "yum clean all" after making any changes to the 
repository config and before I install any packages. However, I can't get the 
dependency created unless I explicitly set the provider to yum in any 
individual package resources. So the following examples all fail:

On a CentOS host where yum is/should be the default provider:

<pre>
node baz {
    include yum

    package { "vim": ensure => present }
}
</pre>

Setting a resource default globally for all Packages:

<pre>
Package {
    provider => yum,
}

node baz {
    include yum

    package { "vim": ensure => present }
}
</pre>

Setting the resource default for all Packages just on the node in question:

<pre>
node baz {
    Package {
        provider => yum,
    }

    include yum

    package { "vim": ensure => present }
}
</pre>

The only way I got it to work is with:

<pre>
node baz {
    include yum

    package { "vim":
        ensure   => present,
        provider => yum, # Ick
    }
}
</pre>

I can also make it work by removing the condition "provider == yum" in the 
Package <| |> collection or even changing the == to !=. I'm verifying the 
presence of the dependency by looking at the graph .dot output as sometimes the 
random ordering can make it look like it's working.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to