Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. class profiles::mysql::client {
  2. pin_package { [
  3. 'libmariadb-dev',
  4. 'libmariadb3',
  5. 'libmysqlclient18',
  6. 'mariadb-client-10.2',
  7. 'mariadb-client-core-10.2',
  8. 'mariadb-common',
  9. 'mariadb-server',
  10. 'mariadb-server-10.2',
  11. 'mariadb-server-core-10.2',
  12. 'mysql-common',
  13. 'mariadb-client']:
  14. ensure => hiera('mysql::client::package_ensure'),
  15. only_pin => true,
  16. }
  17.  
  18. # This is basically "Do I have PHP included in my catalog?" without using defined
  19. # Still not a great solution to this because it will log warnings as well with each lookup
  20. # if it's not in the catalog
  21. if !(empty($::php::php_version)) and !(defined(Php::Extension['mysql']) or defined(Php::Php70::Extension['mysql'])) {
  22. pin_package {
  23. ["php${::php::php_dotted_version}-mysql"]:
  24. ensure => hiera("php${::php::php_version}::package::version"),
  25. only_pin => true;
  26. 'php-mysql':
  27. ensure => "1:${::php::php_dotted_version}*",
  28. only_pin => true;
  29. }
  30. }
  31.  
  32. include ::mysql::client
  33.  
  34. }
  35.  
  36. define pin_package (
  37. $ensure,
  38. $priority = '1001',
  39. $explanation = 'Never upgrade from the assigned version. Puppet will update the version here.',
  40. $install_options = undef,
  41. $alias = undef,
  42. $package_require = Class['apt::update'],
  43. $package_before = undef,
  44. $package_notify = undef,
  45. Boolean $only_pin = false, # This is useful for being able to pin packages that are declared in 3rd party modules
  46. ) {
  47.  
  48. if !($ensure in [
  49. 'present',
  50. 'installed',
  51. 'latest']) {
  52. apt::pin { $name:
  53. packages => $name,
  54. version => $ensure ? {
  55. /absent|purged/ => undef,
  56. default => $ensure,
  57. },
  58. explanation => $explanation,
  59. priority => $ensure ? {
  60. /absent|purged/ => '-1',
  61. default => $priority,
  62. },
  63. before => $only_pin ? {
  64. false => [
  65. Class['apt::update'],
  66. Package["${name}"]],
  67. default => undef,
  68. },
  69. }
  70. }
  71.  
  72. if !$only_pin {
  73. package { $name:
  74. ensure => $ensure,
  75. install_options => $install_options,
  76. require => $package_require,
  77. before => $package_before,
  78. notify => $package_notify,
  79. alias => $alias,
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement