On Tuesday, March 6, 2018 at 1:50:28 PM UTC-6, P.C. Kroon wrote:
>
> Hi Jochen,
>
>  
>
> I’m going to give this back to the rest of the list since I’m out of my 
> depth, and I don’t have the time to figure out the details at the moment. 
> Good luck though 😊
>

In the first place, since you are using dpkg instead of apt to install the 
DEB, and especially to the extent that you care which of the two 
alternative packages are used to satisfy the package dependency, your 
Package['wpcli'] should express a direct or indirect resource dependency on 
the MySQL client Package you want to use.  Since you're using 
puppetlabs-mysql, perhaps you want to depend on Class['::mysql::client'], 
but if you're wrapping that inside a profile (different from the one in 
which your problem occurs), then you should probably depend on the profile 
class instead.  As a matter of good form and style, however, you should not 
attempt to express relationships with resources managed by other classes, 
especially across module boundaries.

You may express an explicit relationship with the DEB File resource, too, 
but you do not need to do, because Puppet will automatically generate 
dependencies between Packages and their managed source files (see the 
"Autorequires" section in the resource type's documentation 
<https://puppet.com/docs/puppet/5.4/types/package.html#package>).

Thus, you might want something like this:

$debfile = '/tmp/php-wpcli_latest_all.deb'

file { "$debfile" : 
  ensure => 'file', 
  source => 'puppet:///modules/profile/wordpress/php-wpcli_1.5.0_all.deb', 
} 

package { 'wpcli': 
  ensure   => 'installed', 
  provider => 'dpkg', 
  source   => "$debfile", 
}

# 1. This assumes that you have a profile class '::profile::mysql_client' 
wrapping the PL
#    ::mysql::client class.  If not, then you could depend directly on
#    Class['::mysql::client'].
# 2. You could express this same relationship with a 'require' attribute, 
if you prefer.
Class['::profile::mysql_client'] -> Package['wpcli']


Note well that for the dependency on your profile class to work reliably, 
you need to ensure that the profile provides proper containment 
<https://puppet.com/docs/puppet/5.4/lang_containment.html> of the 
appropriate application class (e.g. ::mysql::client), which you would 
achieve via appropriate use of the contain 
<https://puppet.com/docs/puppet/5.4/function.html#contain> function / 
statement.

Ultimately, what I'm describing as not very different from what Peter 
recommended.  It may be that I've hit on a key detail that he missed, but 
without more information about your manifest set, it's hard to confidently 
offer a solution.  If the above does not solve your problem, then I think 
it would behoove you to present a minimal yet complete example manifest set 
that reproduces the problem for you, primarily stripped-down versions of 
the manifests you and your organization wrote.  Supposing that you're using 
off-the-shelf puppetlabs-mysql, do not include any of its manifests, but 
do, please, tell us which version you are using.


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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/bcbcbca8-1c8e-4064-af42-20797890f5b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to