Yes, you can see where the mysql module from Puppet does that, starting on this line: https://github.com/puppetlabs/puppetlabs-mysql/blob/master/manifests/params.pp#L58
Rob Nelson [email protected] On Mon, Aug 29, 2016 at 3:46 PM, Suresh Rajagopal <[email protected]> wrote: > Hi Rob, > > version is passed via hiera. params.pp has the logic to decide the package > name based version. Is it a good practice to have this logic in params.pp ? > > Thanks > Suresh > > > ------------------------------ > *From:* Rob Nelson <[email protected]> > *To:* "[email protected]" <[email protected]> > *Sent:* Monday, August 29, 2016 11:41 AM > *Subject:* Re: [Puppet Users] mysql package name > > If you dig deeper into the forge module, I think you will find that > defaults are set in manifests/params.pp and set in the main class as > `$client_package_name = $mysql::params::client_package_name` or similar. > However, they're still class params so they can be overridden by users, > often via hiera. > > On Monday, August 29, 2016, Suresh Rajagopal <[email protected]> wrote: > > Hi Peter, > > Yes passing package name works. But i have to pass package name for all > the components. Something like below. I am just trying to figure out a way > to handle this better. variable version is the deciding factor for the > package names. I can pass this vie hiera. Is below the only approach to > handle package names? If yes where to place this code ? init.pp or > params.pp ? > > if $mysql_provider == 'mariadb' { > $client_package_name = 'MariaDB-client' > $server_package_name = 'MariaDB-server' > $server_service_name = 'mysql' > $devel_package_name = 'MariaDB-devel' > $shared_package_name = 'MariaDB-shared' > } else { > $server_package_name = $version ? { > /^5\.0|\.1\./ => 'MySQL-server-community', > /^5.6\./ => 'MySQL-server', > /^5.7\./ => 'mysql-community-server', > default => 'mysql-community-server' > } > $client_package_name = $version ? { > /^5\.0|\.1\./ => 'MySQL-client-community', > /^5.6\./ => 'MySQL-client', > /^5.7\./ => 'mysql-community-client', > default => 'mysql-community-client' > } > $devel_package_name = $version ? { > /^5\.0|\.1\./ => 'MySQL-devel-community', > /^5.6\./ => 'MySQL-devel', > /^5.7\./ => 'mysql-community-devel', > default => 'mysql-community-devel' > } > $shared_package_name = $version ? { > /^5\.0|\.1\./ => 'MySQL-shared-community', > /^5.6\./ => 'MySQL-shared', > /^5.7\./ => 'mysql-community-libs', > default => 'mysql-community-libs' > } > $compat_package_name = $version ? { > /^5\.0|\.1\./ => 'MySQL-shared-compat', > /^5.6\./ => 'MySQL-shared-compat', > /^5.7\./ => 'mysql-community-libs-compat', > default => 'mysql-community-libs-compat' > } > $server_service_name = $version ? { > /^5\.0|\.1\./ => 'mysql', > /^5.6\./ => 'mysql', > /^5.7\./ => 'mysqld', > default => 'mysqld' > } > > > > > Thanks > Suresh Rajagopal > > ------------------------------ > *From:* Peter Kristolaitis <[email protected]> > *To:* [email protected] > *Sent:* Monday, August 29, 2016 11:03 AM > *Subject:* Re: [Puppet Users] mysql package name > > There is a package_name parameter in the Forge module. It's designed to > allow you to install e.g. MariaDB instead of MySQL, but it would work fine > for your use case as well. > > > On 2016-08-29 02:00 PM, Suresh Rajagopal wrote: > > Hi Lowe, > > My concern is with package name. MySQL package name differs for each > version. In the forge module, if you try installing with > mysql::server(ensure=>5.6.31) it will fail if you don't pass package name > as(MySQL-server) an argument. > > 5.0/5.1 ---> MySQL-server-community > 5.6 ----> MySQL-server > 5.7 --->mysql-community-server > > How to handle this logic ? > > Thanks > Suresh Rajagopal > ------------------------------ > *From:* Lowe Schmidt <[email protected]> > *To:* [email protected] > *Sent:* Monday, August 29, 2016 7:29 AM > *Subject:* Re: [Puppet Users] mysql package name > > Have a look at the mysql module in the forge [0]. They solve it by having > a package_ensure parameter to the mysql::server class which is one of [ > 'present', 'latest, 'absent', 'x.y.z' ] where "x.y.z" is a version string. > > [0] https://forge.puppet.com/ puppetlabs/mysql#mysqlserver > <https://forge.puppet.com/puppetlabs/mysql#mysqlserver> > > -- > Lowe Schmidt | +46 723 867 157 > > On 29 August 2016 at 06:42, Suresh Rajagopal <[email protected]> wrote: > > Hi, > > Puppet 3.4 with hieara. > > what is the best place to define package name within a module? package > name varies based on package version. > > Thanks > Suresh Rajagopal > -- > 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/c66b04fb- 2591-47da-af56-8f7eda59f964% 40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/c66b04fb-2591-47da-af56-8f7eda59f964%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/ optout > <https://groups.google.com/d/optout>. > > > -- > 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/CAC-wWcT% 2BD0BgoAa238y2xgn3dV5XByTSewJT > k5hGOx4cR2GuQg%40mail.gmail. com > <https://groups.google.com/d/msgid/puppet-users/CAC-wWcT%2BD0BgoAa238y2xgn3dV5XByTSewJTk5hGOx4cR2GuQg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/ optout > <https://groups.google.com/d/optout>. > > > -- > 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/1151442669. 1567854.1472493607331%40mail. yahoo.com > <https://groups.google.com/d/msgid/puppet-users/1151442669.1567854.1472493607331%40mail.yahoo.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/ optout > <https://groups.google.com/d/optout>. > > > -- > 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/148610e9- 6fb8-ba33-0348-5af4b6c0ed6f% 40alter3d.ca > <https://groups.google.com/d/msgid/puppet-users/148610e9-6fb8-ba33-0348-5af4b6c0ed6f%40alter3d.ca?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/ optout > <https://groups.google.com/d/optout>. > > > -- > 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/1604279226. 1539856.1472495405093%40mail. yahoo.com > <https://groups.google.com/d/msgid/puppet-users/1604279226.1539856.1472495405093%40mail.yahoo.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/ optout > <https://groups.google.com/d/optout>. > > > > -- > > Rob Nelson > [email protected] > > -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/puppet-users/CAC76iT9c9CUoyABT27ax_cwmuuXEx3FAUWT%3DU9Z2w_ > hVkUmNVA%40mail.gmail.com > <https://groups.google.com/d/msgid/puppet-users/CAC76iT9c9CUoyABT27ax_cwmuuXEx3FAUWT%3DU9Z2w_hVkUmNVA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/puppet-users/380325773.1528048.1472500003432%40mail.yahoo.com > <https://groups.google.com/d/msgid/puppet-users/380325773.1528048.1472500003432%40mail.yahoo.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAC76iT9A4c%2BOyq-2Bi5bE7mne_io5zqadDMifY702tq4Cxwsgw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
