Skip to content

Commit

Permalink
Merge pull request #1532 from puppetlabs/CONT-359-Syntax_update
Browse files Browse the repository at this point in the history
(CONT-359) Syntax update
  • Loading branch information
david22swan authored Feb 24, 2023
2 parents 18012b9 + 6a62778 commit c55e7a7
Show file tree
Hide file tree
Showing 24 changed files with 350 additions and 326 deletions.
5 changes: 0 additions & 5 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
--relative
--no-parameter_types-check
--no-parameter_documentation-check
--no-legacy_facts-check
--no-top_scope_facts-check
--no-anchor_resource-check
--no-relative_classname_reference-check
--no-params_empty_string_assignment-check
5 changes: 0 additions & 5 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,5 @@ Rakefile:
changelog_since_tag: 'v11.0.3'
Rakefile:
extra_disabled_lint_checks:
- parameter_types
- parameter_documentation
- legacy_facts
- top_scope_facts
- anchor_resource
- relative_classname_reference
- params_empty_string_assignment
5 changes: 0 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ def changelog_future_release
end

PuppetLint.configuration.send('disable_relative')
PuppetLint.configuration.send('disable_parameter_types')
PuppetLint.configuration.send('disable_parameter_documentation')
PuppetLint.configuration.send('disable_legacy_facts')
PuppetLint.configuration.send('disable_top_scope_facts')
PuppetLint.configuration.send('disable_anchor_resource')
PuppetLint.configuration.send('disable_relative_classname_reference')
PuppetLint.configuration.send('disable_params_empty_string_assignment')


Expand Down
2 changes: 1 addition & 1 deletion examples/monitor.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$mysql_monitor_password = 'password'
$mysql_monitor_username = 'monitoring'
$mysql_monitor_hostname = $::facts['networking']['hostname']
$mysql_monitor_hostname = $facts['networking']['hostname']

mysql_user { "${mysql_monitor_username}@${mysql_monitor_hostname}":
ensure => present,
Expand Down
4 changes: 2 additions & 2 deletions examples/mysql_db.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
host => 'localhost',
grant => ['SELECT', 'UPDATE'],
}
mysql::db { "mydb_${fqdn}":
mysql::db { "mydb_${facts['networking']['fqdn']}":
user => 'myuser',
password => 'mypass',
dbname => 'mydb',
host => $::fqdn,
host => $facts['networking']['fqdn'],
grant => ['SELECT', 'UPDATE'],
tag => $domain,
}
6 changes: 3 additions & 3 deletions examples/mysql_login_path.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include apt
apt::source { 'repo.mysql.com':
location => 'http://repo.mysql.com/apt/debian',
release => $::lsbdistcodename,
release => $facts['os']['distro']['codename'],
repos => 'mysql-8.0',
key => {
id => 'A4A9406876FCBD3C456770C88C718D3B5072E1F5',
Expand Down Expand Up @@ -35,7 +35,7 @@
class { 'mysql::client':
package_manage => false,
package_name => 'mysql-community-client',
require => Class['::mysql::server'],
require => Class['mysql::server'],
}

mysql_login_path { 'client':
Expand All @@ -54,7 +54,7 @@
password => Sensitive('blah'),
port => 3306,
owner => root,
require => Class['::mysql::server'],
require => Class['mysql::server'],
}

mysql_user { 'dan@localhost':
Expand Down
4 changes: 2 additions & 2 deletions examples/mysql_plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
root_password => 'password',
}

$validate_password_soname = $::osfamily ? {
$validate_password_soname = $facts['os']['family'] ? {
'windows' => 'validate_password.dll',
default => 'validate_password.so'
}
Expand All @@ -12,7 +12,7 @@
soname => $validate_password_soname,
}

$auth_socket_soname = $::osfamily ? {
$auth_socket_soname = $facts['os']['family'] ? {
'windows' => 'auth_socket.dll',
default => 'auth_socket.so'
}
Expand Down
60 changes: 30 additions & 30 deletions manifests/backup/mysqlbackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@
# @api private
#
class mysql::backup::mysqlbackup (
$backupuser = '',
Variant[String, Sensitive[String]] $backuppassword = '',
$maxallowedpacket = '1M',
$backupdir = '',
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = $mysql::params::root_group,
$backupcompress = true,
$backuprotate = 30,
$backupmethod = '',
$backup_success_file_path = undef,
$ignore_events = true,
$delete_before_dump = false,
$backupdatabases = [],
$file_per_database = false,
$include_triggers = true,
$include_routines = false,
$ensure = 'present',
$time = ['23', '5'],
$prescript = false,
$postscript = false,
$execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
$optional_args = [],
$incremental_backups = false,
$install_cron = true,
$compression_command = undef,
$compression_extension = undef,
$backupmethod_package = undef,
String $backupuser = '',
Variant[String, Sensitive[String]] $backuppassword = '',
String[1] $maxallowedpacket = '1M',
String $backupdir = '',
String[1] $backupdirmode = '0700',
String[1] $backupdirowner = 'root',
String[1] $backupdirgroup = $mysql::params::root_group,
Boolean $backupcompress = true,
Variant[Integer, String[1]] $backuprotate = 30,
String $backupmethod = '',
Optional[String[1]] $backup_success_file_path = undef,
Boolean $ignore_events = true,
Boolean $delete_before_dump = false,
Array[String[1]] $backupdatabases = [],
Boolean $file_per_database = false,
Boolean $include_triggers = true,
Boolean $include_routines = false,
Enum['present', 'absent'] $ensure = 'present',
Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'],
Variant[Boolean, String[1], Array[String[1]]] $prescript = false,
Variant[Boolean, String[1], Array[String[1]]] $postscript = false,
String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
Array[String[1]] $optional_args = [],
Boolean $incremental_backups = false,
Boolean $install_cron = true,
Optional[String[1]] $compression_command = undef,
Optional[String[1]] $compression_extension = undef,
Optional[String[1]] $backupmethod_package = undef,
) inherits mysql::params {
$backuppassword_unsensitive = if $backuppassword =~ Sensitive {
$backuppassword.unwrap
Expand Down Expand Up @@ -74,9 +74,9 @@
}

if $install_cron {
if $::osfamily == 'RedHat' {
if $facts['os']['family'] == 'RedHat' {
ensure_packages('cronie')
} elsif $::osfamily != 'FreeBSD' {
} elsif $facts['os']['family'] != 'FreeBSD' {
ensure_packages('cron')
}
}
Expand Down
68 changes: 34 additions & 34 deletions manifests/backup/mysqldump.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,45 @@
# @api private
#
class mysql::backup::mysqldump (
$backupuser = '',
Variant[String, Sensitive[String]] $backuppassword = '',
$backupdir = '',
$maxallowedpacket = '1M',
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = $mysql::params::root_group,
$backupcompress = true,
$backuprotate = 30,
$backupmethod = 'mysqldump',
$backup_success_file_path = undef,
$ignore_events = true,
$delete_before_dump = false,
$backupdatabases = [],
$file_per_database = false,
$include_triggers = false,
$include_routines = false,
$ensure = 'present',
$time = ['23', '5'],
$prescript = false,
$postscript = false,
$execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
$optional_args = [],
$mysqlbackupdir_ensure = 'directory',
$mysqlbackupdir_target = undef,
$incremental_backups = false,
$install_cron = true,
$compression_command = 'bzcat -zc',
$compression_extension = '.bz2',
$backupmethod_package = undef,
Array[String] $excludedatabases = [],
String $backupuser = '',
Variant[String, Sensitive[String]] $backuppassword = '',
String $backupdir = '',
String[1] $maxallowedpacket = '1M',
String[1] $backupdirmode = '0700',
String[1] $backupdirowner = 'root',
String[1] $backupdirgroup = $mysql::params::root_group,
Boolean $backupcompress = true,
Variant[Integer, String[1]] $backuprotate = 30,
String[1] $backupmethod = 'mysqldump',
Optional[String[1]] $backup_success_file_path = undef,
Boolean $ignore_events = true,
Boolean $delete_before_dump = false,
Array[String[1]] $backupdatabases = [],
Boolean $file_per_database = false,
Boolean $include_triggers = false,
Boolean $include_routines = false,
Enum['present', 'absent'] $ensure = 'present',
Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'],
Variant[Boolean, String[1], Array[String[1]]] $prescript = false,
Variant[Boolean, String[1], Array[String[1]]] $postscript = false,
String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
Array[String[1]] $optional_args = [],
String[1] $mysqlbackupdir_ensure = 'directory',
Optional[String[1]] $mysqlbackupdir_target = undef,
Boolean $incremental_backups = false,
Boolean $install_cron = true,
String[1] $compression_command = 'bzcat -zc',
String[1] $compression_extension = '.bz2',
Optional[String[1]] $backupmethod_package = undef,
Array[String] $excludedatabases = [],
) inherits mysql::params {
$backuppassword_unsensitive = if $backuppassword =~ Sensitive {
$backuppassword.unwrap
} else {
$backuppassword
}

unless $::osfamily == 'FreeBSD' {
unless $facts['os']['family'] == 'FreeBSD' {
if $backupcompress and $compression_command == 'bzcat -zc' {
ensure_packages(['bzip2'])
Package['bzip2'] -> File['mysqlbackup.sh']
Expand Down Expand Up @@ -69,9 +69,9 @@
}

if $install_cron {
if $::osfamily == 'RedHat' {
if $facts['os']['family'] == 'RedHat' {
ensure_packages('cronie')
} elsif $::osfamily != 'FreeBSD' {
} elsif $facts['os']['family'] != 'FreeBSD' {
ensure_packages('cron')
}
}
Expand Down
68 changes: 34 additions & 34 deletions manifests/backup/xtrabackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
# @api private
#
class mysql::backup::xtrabackup (
$backupuser = undef,
Optional[Variant[String, Sensitive[String]]] $backuppassword = undef,
$backupdir = '',
$maxallowedpacket = '1M',
$backupmethod = 'xtrabackup',
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = $mysql::params::root_group,
$backupcompress = true,
$backuprotate = 30,
$backupscript_template = 'mysql/xtrabackup.sh.erb',
$backup_success_file_path = undef,
$ignore_events = true,
$delete_before_dump = false,
$backupdatabases = [],
$file_per_database = false,
$include_triggers = true,
$include_routines = false,
$ensure = 'present',
$time = ['23', '5'],
$prescript = false,
$postscript = false,
$execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
$optional_args = [],
$additional_cron_args = '--backup',
$incremental_backups = true,
$install_cron = true,
$compression_command = undef,
$compression_extension = undef,
$backupmethod_package = $mysql::params::xtrabackup_package_name,
Array[String] $excludedatabases = [],
Optional[String] $backupuser = undef,
Optional[Variant[String, Sensitive[String]]] $backuppassword = undef,
String $backupdir = '',
String[1] $maxallowedpacket = '1M',
String[1] $backupmethod = 'xtrabackup',
String[1] $backupdirmode = '0700',
String[1] $backupdirowner = 'root',
String[1] $backupdirgroup = $mysql::params::root_group,
Boolean $backupcompress = true,
Variant[Integer, String[1]] $backuprotate = 30,
String[1] $backupscript_template = 'mysql/xtrabackup.sh.erb',
Optional[String[1]] $backup_success_file_path = undef,
Boolean $ignore_events = true,
Boolean $delete_before_dump = false,
Array[String[1]] $backupdatabases = [],
Boolean $file_per_database = false,
Boolean $include_triggers = true,
Boolean $include_routines = false,
Enum['present', 'absent'] $ensure = 'present',
Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'],
Variant[Boolean, String[1], Array[String[1]]] $prescript = false,
Variant[Boolean, String[1], Array[String[1]]] $postscript = false,
String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
Array[String[1]] $optional_args = [],
String[1] $additional_cron_args = '--backup',
Boolean $incremental_backups = true,
Boolean $install_cron = true,
Optional[String[1]] $compression_command = undef,
Optional[String[1]] $compression_extension = undef,
String[1] $backupmethod_package = $mysql::params::xtrabackup_package_name,
Array[String] $excludedatabases = [],
) inherits mysql::params {
ensure_packages($backupmethod_package)

Expand Down Expand Up @@ -109,9 +109,9 @@
}

if $install_cron {
if $::osfamily == 'RedHat' {
if $facts['os']['family'] == 'RedHat' {
ensure_packages('cronie')
} elsif $::osfamily != 'FreeBSD' {
} elsif $facts['os']['family'] != 'FreeBSD' {
ensure_packages('cron')
}
}
Expand All @@ -138,7 +138,7 @@
}

# Wether to use GNU or BSD date format.
case $::osfamily {
case $facts['os']['family'] {
'FreeBSD','OpenBSD': {
$dateformat = '$(date -v-sun +\\%F)_full'
}
Expand Down
Loading

0 comments on commit c55e7a7

Please sign in to comment.