mysql package name

42 views
Skip to first unread message

Suresh Rajagopal

unread,
Aug 29, 2016, 10:07:35 AM8/29/16
to Puppet Users
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

Lowe Schmidt

unread,
Aug 29, 2016, 10:30:10 AM8/29/16
to puppet...@googlegroups.com
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. 


--
Lowe Schmidt | +46 723 867 157

--
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.
For more options, visit https://groups.google.com/d/optout.

Suresh Rajagopal

unread,
Aug 29, 2016, 2:00:17 PM8/29/16
to puppet...@googlegroups.com
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 <m...@loweschmidt.se>
To: puppet...@googlegroups.com
Sent: Monday, August 29, 2016 7:29 AM
Subject: Re: [Puppet Users] mysql package name

To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAC-wWcT%2BD0BgoAa238y2xgn3dV5XByTSewJTk5hGOx4cR2GuQg%40mail.gmail.com.

Peter Kristolaitis

unread,
Aug 29, 2016, 2:05:14 PM8/29/16
to puppet...@googlegroups.com

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.

Suresh Rajagopal

unread,
Aug 29, 2016, 2:30:16 PM8/29/16
to puppet...@googlegroups.com
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 <alt...@alter3d.ca>
To: puppet...@googlegroups.com
Sent: Monday, August 29, 2016 11:03 AM

Rob Nelson

unread,
Aug 29, 2016, 2:41:57 PM8/29/16
to puppet...@googlegroups.com
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.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
--
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.
--
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.

--
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.

For more options, visit https://groups.google.com/d/optout.


--

Suresh Rajagopal

unread,
Aug 29, 2016, 3:47:03 PM8/29/16
to puppet...@googlegroups.com
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 <rnel...@gmail.com>
To: "puppet...@googlegroups.com" <puppet...@googlegroups.com>
Sent: Monday, August 29, 2016 11:41 AM

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 puppet-users+unsubscribe@ googlegroups.com.

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 puppet-users+unsubscribe@ googlegroups.com.

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 puppet-users+unsubscribe@ googlegroups.com.

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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAC76iT9c9CUoyABT27ax_cwmuuXEx3FAUWT%3DU9Z2w_hVkUmNVA%40mail.gmail.com.

Rob Nelson

unread,
Aug 29, 2016, 4:31:42 PM8/29/16
to puppet...@googlegroups.com
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
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.

--
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.

J.T. Conklin

unread,
Aug 29, 2016, 6:31:55 PM8/29/16
to puppet...@googlegroups.com
Suresh Rajagopal <sure...@gmail.com> writes:
> 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 ?

The philosophy I use in my own modules is that params.pp should provide
the best possible default based on the host OS version. But at the same
time it should be a parameter, so it can be overriden by hiera to handle
cases where that default is wrong.

It's very rare when I have to do that. And when I do, it's usually only
needed until params.pp can be updated to handle the case (e.g., when a
package name has changed in a new version of an OS, and the module has
not been updated to handle that new version).

--jtc

Reply all
Reply to author
Forward
0 new messages