Skip to content

Commit 5217d11

Browse files
committed
top-scope facts
1 parent 5131e0f commit 5217d11

File tree

9 files changed

+46
-28
lines changed

9 files changed

+46
-28
lines changed

.puppet-lint.rc

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
--relative
2-
--no-top_scope_facts-check
32
--no-anchor_resource-check
43
--no-params_empty_string_assignment-check

.sync.yml

-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@ Rakefile:
3636
changelog_since_tag: 'v11.0.3'
3737
Rakefile:
3838
extra_disabled_lint_checks:
39-
- top_scope_facts
4039
- anchor_resource
4140
- params_empty_string_assignment

Rakefile

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def changelog_future_release
4242
end
4343

4444
PuppetLint.configuration.send('disable_relative')
45-
PuppetLint.configuration.send('disable_top_scope_facts')
4645
PuppetLint.configuration.send('disable_anchor_resource')
4746
PuppetLint.configuration.send('disable_params_empty_string_assignment')
4847

examples/monitor.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
$mysql_monitor_password = 'password'
55
$mysql_monitor_username = 'monitoring'
6-
$mysql_monitor_hostname = $::facts['networking']['hostname']
6+
$mysql_monitor_hostname = $facts['networking']['hostname']
77

88
mysql_user { "${mysql_monitor_username}@${mysql_monitor_hostname}":
99
ensure => present,

manifests/bindings.pp

+17-10
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,50 @@
2525
# @param daemon_dev
2626
# Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`.
2727
# @param java_package_ensure
28-
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `java_enable => true`.
28+
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'.
29+
# Only applies if `java_enable => true`.
2930
# @param java_package_name
3031
# The name of the Java package to install. Only applies if `java_enable => true`.
3132
# @param java_package_provider
3233
# The provider to use to install the Java package. Only applies if `java_enable => true`.
3334
# @param perl_package_ensure
34-
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `perl_enable => true`.
35+
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'.
36+
# Only applies if `perl_enable => true`.
3537
# @param perl_package_name
3638
# The name of the Perl package to install. Only applies if `perl_enable => true`.
3739
# @param perl_package_provider
3840
# The provider to use to install the Perl package. Only applies if `perl_enable => true`.
3941
# @param php_package_ensure
40-
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `php_enable => true`.
42+
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'.
43+
# Only applies if `php_enable => true`.
4144
# @param php_package_name
4245
# The name of the PHP package to install. Only applies if `php_enable => true`.
4346
# @param php_package_provider
4447
# The provider to use to install the PHP package. Only applies if `php_enable => true`.
4548
# @param python_package_ensure
46-
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `python_enable => true`.
49+
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'.
50+
# Only applies if `python_enable => true`.
4751
# @param python_package_name
4852
# The name of the Python package to install. Only applies if `python_enable => true`.
4953
# @param python_package_provider
5054
# The provider to use to install the Python package. Only applies if `python_enable => true`.
5155
# @param ruby_package_ensure
52-
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `ruby_enable => true`.
56+
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'.
57+
# Only applies if `ruby_enable => true`.
5358
# @param ruby_package_name
5459
# The name of the Ruby package to install. Only applies if `ruby_enable => true`.
5560
# @param ruby_package_provider
5661
# What provider should be used to install the package.
5762
# @param client_dev_package_ensure
58-
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `client_dev => true`.
63+
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'.
64+
# Only applies if `client_dev => true`.
5965
# @param client_dev_package_name
6066
# The name of the client_dev package to install. Only applies if `client_dev => true`.
6167
# @param client_dev_package_provider
6268
# The provider to use to install the client_dev package. Only applies if `client_dev => true`.
6369
# @param daemon_dev_package_ensure
64-
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `daemon_dev => true`.
70+
# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'.
71+
# Only applies if `daemon_dev => true`.
6572
# @param daemon_dev_package_name
6673
# The name of the daemon_dev package to install. Only applies if `daemon_dev => true`.
6774
# @param daemon_dev_package_provider
@@ -102,11 +109,11 @@
102109
) inherits mysql::params {
103110
case $facts['os']['family'] {
104111
'Archlinux': {
105-
if $java_enable { fail("::mysql::bindings::java cannot be managed by puppet on ${::facts['os']['family']} as it is not in official repositories. Please disable java mysql binding.") }
112+
if $java_enable { fail("::mysql::bindings::java cannot be managed by puppet on ${facts['os']['family']} as it is not in official repositories. Please disable java mysql binding.") }
106113
if $perl_enable { include 'mysql::bindings::perl' }
107-
if $php_enable { warning("::mysql::bindings::php does not need to be managed by puppet on ${::facts['os']['family']} as it is included in mysql package by default.") }
114+
if $php_enable { warning("::mysql::bindings::php does not need to be managed by puppet on ${facts['os']['family']} as it is included in mysql package by default.") }
108115
if $python_enable { include 'mysql::bindings::python' }
109-
if $ruby_enable { fail("::mysql::bindings::ruby cannot be managed by puppet on ${::facts['os']['family']} as it is not in official repositories. Please disable ruby mysql binding.") }
116+
if $ruby_enable { fail("::mysql::bindings::ruby cannot be managed by puppet on ${facts['os']['family']} as it is not in official repositories. Please disable ruby mysql binding.") }
110117
}
111118

112119
default: {

manifests/db.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
exec { "${dbname}-import":
127127
command => "${import_cat_cmd} ${shell_join($sql)} | mysql ${dbname}",
128128
logoutput => true,
129-
environment => "HOME=${::root_home}",
129+
environment => "HOME=${facts['root_home']}",
130130
refreshonly => ! $enforce_sql,
131131
path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:${_mysql_exec_path}",
132132
require => Mysql_grant["${user}@${host}/${table}"],

manifests/server.pp

+15-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
# @param manage_config_file
2121
# Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`.
2222
# @param options
23-
# A hash of options structured like the override_options, but not merged with the default options. Use this if you don't want your options merged with the default options.
23+
# A hash of options structured like the override_options, but not merged with the default options.
24+
# Use this if you don't want your options merged with the default options.
2425
# @param override_options
2526
# Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details.
2627
# @param package_ensure
@@ -50,7 +51,11 @@
5051
# @param mycnf_group
5152
# Name or group-id which owns the mysql-config-file.
5253
# @param root_password
53-
# The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. This is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created. Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password.
54+
# The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. This is required
55+
# if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and
56+
# `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created.
57+
# Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old
58+
# password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password.
5459
# @param service_enabled
5560
# Specifies whether the service should be enabled. Valid values are `true`, `false`. Defaults to `true`.
5661
# @param service_manage
@@ -60,9 +65,13 @@
6065
# @param service_provider
6166
# The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined.
6267
# @param create_root_user
63-
# Whether root user should be created. Valid values are `true`, `false`. Defaults to `true`. This is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes.
68+
# Whether root user should be created. Valid values are `true`, `false`. Defaults to `true`.
69+
# This is useful for a cluster setup with Galera. The root user has to be created only once.
70+
# You can set this parameter true on one node and set it to false on the remaining nodes.
6471
# @param create_root_my_cnf
65-
# Whether to create `/root/.my.cnf`. Valid values are `true`, `false`. Defaults to `true`. `create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes.
72+
# Whether to create `/root/.my.cnf`. Valid values are `true`, `false`. Defaults to `true`.
73+
# `create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`.
74+
# You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes.
6675
# @param create_root_login_file
6776
# Whether to create a login file for root. Valid values are 'true', 'false'.
6877
# @param login_file
@@ -78,7 +87,8 @@
7887
# @param manage_service
7988
# _Deprecated_
8089
# @param old_root_password
81-
# This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password.
90+
# This parameter no longer does anything. It exists only for backwards compatibility.
91+
# See the `root_password` parameter above for details on changing the root password.
8292
#
8393
class mysql::server (
8494
String[1] $config_file = $mysql::params::config_file,

manifests/server/backup.pp

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
# @param ignore_events
4646
# Ignore the mysql.event table.
4747
# @param delete_before_dump
48-
# Whether to delete old .sql files before backing up. Setting to true deletes old files before backing up, while setting to false deletes them after backup.
48+
# Whether to delete old .sql files before backing up.
49+
# Setting to true deletes old files before backing up, while setting to false deletes them after backup.
4950
# @param backupdatabases
5051
# Databases to backup (required if using xtrabackup provider). By default `[]` will back up all databases.
5152
# @param file_per_database
@@ -62,15 +63,18 @@
6263
# @param prescript
6364
# A script that is executed before the backup begins.
6465
# @param postscript
65-
# A script that is executed when the backup is finished. This could be used to sync the backup to a central store. This script can be either a single line that is directly executed or a number of lines supplied as an array. It could also be one or more externally managed (executable) files.
66+
# A script that is executed when the backup is finished. This could be used to sync the backup to a central store.
67+
# This script can be either a single line that is directly executed or a number of lines supplied as an array.
68+
# It could also be one or more externally managed (executable) files.
6669
# @param execpath
6770
# Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`.
6871
# @param provider
6972
# Sets the server backup implementation. Valid values are: xtrabackup, mysqldump, mysqlbackup
7073
# @param maxallowedpacket
7174
# Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value.
7275
# @param optional_args
73-
# Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.)
76+
# Specifies an array of optional arguments which should be passed through to the backup tool.
77+
# (Supported by the xtrabackup and mysqldump providers.)
7478
# @param install_cron
7579
# Manage installation of cron package
7680
# @param compression_command

manifests/server/root_password.pp

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@
3939

4040
if $mysql::server::create_root_my_cnf and $root_password_set {
4141
# TODO: use EPP instead of ERB, as EPP can handle Data of Type Sensitive without further ado
42-
file { "${::root_home}/.my.cnf":
42+
file { "${facts['root_home']}/.my.cnf":
4343
content => template('mysql/my.cnf.pass.erb'),
4444
owner => 'root',
4545
mode => '0600',
4646
}
4747

4848
# show_diff was added with puppet 3.0
49-
if versioncmp($::puppetversion, '3.0') >= 0 {
50-
File["${::root_home}/.my.cnf"] { show_diff => false }
49+
if versioncmp($facts['puppetversion'], '3.0') >= 0 {
50+
File["${facts['root_home']}/.my.cnf"] { show_diff => false }
5151
}
5252
if $mysql::server::create_root_user {
53-
Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"]
53+
Mysql_user['root@localhost'] -> File["${facts['root_home']}/.my.cnf"]
5454
}
5555
}
5656

5757
if $mysql::server::create_root_login_file and $root_password_set {
58-
file { "${::root_home}/.mylogin.cnf":
58+
file { "${facts['root_home']}/.mylogin.cnf":
5959
source => $login_file,
6060
owner => 'root',
6161
mode => '0600',

0 commit comments

Comments
 (0)