Skip to content

Commit 222c044

Browse files
committed
Replace operatingsystem with os.name
1 parent 847026a commit 222c044

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

manifests/params.pp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
case $facts['os']['family'] {
4141
'RedHat': {
42-
case $::operatingsystem {
42+
case $facts['os']['name'] {
4343
'Fedora': {
4444
if versioncmp($::operatingsystemrelease, '19') >= 0 or $::operatingsystemrelease == 'Rawhide' {
4545
$provider = 'mariadb'
@@ -119,7 +119,7 @@
119119
}
120120

121121
'Suse': {
122-
case $::operatingsystem {
122+
case $facts['os']['name'] {
123123
'OpenSuSE': {
124124
$socket = '/var/run/mysql/mysql.sock'
125125
$log_error = '/var/log/mysql/mysqld.log'
@@ -141,7 +141,7 @@
141141
$basedir = undef
142142
}
143143
default: {
144-
fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${::operatingsystem}.")
144+
fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${facts['os']['name']}.")
145145
}
146146
}
147147
$config_file = '/etc/my.cnf'
@@ -207,26 +207,26 @@
207207
$managed_dirs = ['tmpdir','basedir','datadir','innodb_data_home_dir','innodb_log_group_home_dir','innodb_undo_directory','innodb_tmpdir']
208208

209209
# mysql::bindings
210-
if ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '10') >= 0) or
211-
($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) {
210+
if ($facts['os']['name'] == 'Debian' and versioncmp($::operatingsystemrelease, '10') >= 0) or
211+
($facts['os']['name'] == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) {
212212
$java_package_name = 'libmariadb-java'
213213
} else {
214214
$java_package_name = 'libmysql-java'
215215
}
216216
$perl_package_name = 'libdbd-mysql-perl'
217-
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0) or
218-
($::operatingsystem == 'Debian') {
217+
if ($facts['os']['name'] == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0) or
218+
($facts['os']['name'] == 'Debian') {
219219
$php_package_name = 'php-mysql'
220220
} else {
221221
$php_package_name = 'php5-mysql'
222222
}
223-
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') < 0) or
224-
($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or
225-
($::operatingsystem == 'Debian') {
223+
if ($facts['os']['name'] == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') < 0) or
224+
($facts['os']['name'] == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or
225+
($facts['os']['name'] == 'Debian') {
226226
$xtrabackup_package_name = 'percona-xtrabackup-24'
227227
}
228-
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or
229-
($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '11') >= 0) {
228+
if ($facts['os']['name'] == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or
229+
($facts['os']['name'] == 'Debian' and versioncmp($::operatingsystemrelease, '11') >= 0) {
230230
$python_package_name = 'python3-mysqldb'
231231
} else {
232232
$python_package_name = 'python-mysqldb'
@@ -365,7 +365,7 @@
365365
}
366366

367367
default: {
368-
case $::operatingsystem {
368+
case $facts['os']['name'] {
369369
'Alpine': {
370370
$client_package_name = 'mariadb-client'
371371
$server_package_name = 'mariadb'
@@ -425,13 +425,13 @@
425425
}
426426

427427
default: {
428-
fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${facts['os']['family']} or ${::operatingsystem}.")
428+
fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${facts['os']['family']} or ${facts['os']['name']}.")
429429
}
430430
}
431431
}
432432
}
433433

434-
case $::operatingsystem {
434+
case $facts['os']['name'] {
435435
'Ubuntu': {
436436
$server_service_provider = 'systemd'
437437
}
@@ -516,7 +516,7 @@
516516
}
517517

518518
## Additional graceful failures
519-
if $facts['os']['family'] == 'RedHat' and $::operatingsystemmajrelease == '4' and $::operatingsystem != 'Amazon' {
519+
if $facts['os']['family'] == 'RedHat' and $::operatingsystemmajrelease == '4' and $facts['os']['name'] != 'Amazon' {
520520
fail("Unsupported platform: puppetlabs-${module_name} only supports RedHat 6.0 and beyond.")
521521
}
522522
}

spec/classes/graceful_failures_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
{
99
os: {
1010
family: 'UNSUPPORTED',
11+
name: 'UNSUPPORTED',
1112
},
12-
operatingsystem: 'UNSUPPORTED',
1313
}
1414
end
1515

spec/classes/mysql_backup_xtrabackup_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class { 'mysql::server': }
4545
else
4646
'percona-xtrabackup-20'
4747
end
48-
elsif facts[:operatingsystem] == 'Debian'
48+
elsif facts[:os]['name'] == 'Debian'
4949
'percona-xtrabackup-24'
50-
elsif facts[:operatingsystem] == 'Ubuntu'
50+
elsif facts[:os]['name'] == 'Ubuntu'
5151
if Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '20') >= 0
5252
'percona-xtrabackup-24'
5353
elsif Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '16') >= 0
@@ -114,8 +114,8 @@ class { 'mysql::server': }
114114
user: 'backupuser@localhost',
115115
table: '*.*',
116116
privileges:
117-
if (facts[:operatingsystem] == 'Debian' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '11') >= 0) ||
118-
(facts[:operatingsystem] == 'Ubuntu' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '22') >= 0)
117+
if (facts[:os]['name'] == 'Debian' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '11') >= 0) ||
118+
(facts[:os]['name'] == 'Ubuntu' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '22') >= 0)
119119
['BINLOG MONITOR', 'RELOAD', 'PROCESS', 'LOCK TABLES']
120120
else
121121
['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT']
@@ -157,8 +157,8 @@ class { 'mysql::server': }
157157
user: 'backupuser@localhost',
158158
table: '*.*',
159159
privileges:
160-
if (facts[:operatingsystem] == 'Debian' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '11') >= 0) ||
161-
(facts[:operatingsystem] == 'Ubuntu' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '22') >= 0)
160+
if (facts[:os]['name'] == 'Debian' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '11') >= 0) ||
161+
(facts[:os]['name'] == 'Ubuntu' && Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '22') >= 0)
162162
['BINLOG MONITOR', 'RELOAD', 'PROCESS', 'LOCK TABLES', 'BACKUP_ADMIN']
163163
else
164164
['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT', 'BACKUP_ADMIN']
@@ -201,9 +201,9 @@ class { 'mysql::server': }
201201
else
202202
'percona-xtrabackup-20'
203203
end
204-
elsif facts[:operatingsystem] == 'Debian'
204+
elsif facts[:os]['name'] == 'Debian'
205205
'percona-xtrabackup-24'
206-
elsif facts[:operatingsystem] == 'Ubuntu'
206+
elsif facts[:os]['name'] == 'Ubuntu'
207207
if Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '20') >= 0
208208
'percona-xtrabackup-24'
209209
elsif Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '16') >= 0

0 commit comments

Comments
 (0)