Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class profiles::mysql::client {
- pin_package { [
- 'libmariadb-dev',
- 'libmariadb3',
- 'libmysqlclient18',
- 'mariadb-client-10.2',
- 'mariadb-client-core-10.2',
- 'mariadb-common',
- 'mariadb-server',
- 'mariadb-server-10.2',
- 'mariadb-server-core-10.2',
- 'mysql-common',
- 'mariadb-client']:
- ensure => hiera('mysql::client::package_ensure'),
- only_pin => true,
- }
- # This is basically "Do I have PHP included in my catalog?" without using defined
- # Still not a great solution to this because it will log warnings as well with each lookup
- # if it's not in the catalog
- if !(empty($::php::php_version)) and !(defined(Php::Extension['mysql']) or defined(Php::Php70::Extension['mysql'])) {
- pin_package {
- ["php${::php::php_dotted_version}-mysql"]:
- ensure => hiera("php${::php::php_version}::package::version"),
- only_pin => true;
- 'php-mysql':
- ensure => "1:${::php::php_dotted_version}*",
- only_pin => true;
- }
- }
- include ::mysql::client
- }
- define pin_package (
- $ensure,
- $priority = '1001',
- $explanation = 'Never upgrade from the assigned version. Puppet will update the version here.',
- $install_options = undef,
- $alias = undef,
- $package_require = Class['apt::update'],
- $package_before = undef,
- $package_notify = undef,
- Boolean $only_pin = false, # This is useful for being able to pin packages that are declared in 3rd party modules
- ) {
- if !($ensure in [
- 'present',
- 'installed',
- 'latest']) {
- apt::pin { $name:
- packages => $name,
- version => $ensure ? {
- /absent|purged/ => undef,
- default => $ensure,
- },
- explanation => $explanation,
- priority => $ensure ? {
- /absent|purged/ => '-1',
- default => $priority,
- },
- before => $only_pin ? {
- false => [
- Class['apt::update'],
- Package["${name}"]],
- default => undef,
- },
- }
- }
- if !$only_pin {
- package { $name:
- ensure => $ensure,
- install_options => $install_options,
- require => $package_require,
- before => $package_before,
- notify => $package_notify,
- alias => $alias,
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement