Skip to content

Commit

Permalink
Addressing puppet-lint and rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcmaw committed Jan 25, 2018
1 parent 4a35815 commit 670cbd6
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 22 deletions.
12 changes: 9 additions & 3 deletions manifests/bindings.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@

case $::osfamily {
'Archlinux': {
if $java_enable { fail(translate('::mysql::bindings::java cannot be managed by puppet on %{osfamily} as it is not in official repositories. Please disable java mysql binding.', {'osfamily' => $::osfamily })) }
if $java_enable { fail(translate('::mysql::bindings::java cannot be managed by puppet on %{osfamily}
as it is not in official repositories. Please disable java mysql binding.',
{'osfamily' => $::osfamily })) }
if $perl_enable { include '::mysql::bindings::perl' }
if $php_enable { warning(translate('::mysql::bindings::php does not need to be managed by puppet on %{osfamily} as it is included in mysql package by default.', {'osfamily' => $::osfamily })) }
if $php_enable { warning(translate('::mysql::bindings::php does not need to be managed by puppet on %{osfamily}
as it is included in mysql package by default.',
{'osfamily' => $::osfamily })) }
if $python_enable { include '::mysql::bindings::python' }
if $ruby_enable { fail(translate('::mysql::bindings::ruby cannot be managed by puppet on %{osfamily} as it is not in official repositories. Please disable ruby mysql binding.', {'osfamily' => $::osfamily } )) }
if $ruby_enable { fail(translate('::mysql::bindings::ruby cannot be managed by puppet on %{osfamily}
as it is not in official repositories. Please disable ruby mysql binding.',
{'osfamily' => $::osfamily } )) }
}

default: {
Expand Down
6 changes: 4 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@
}
}
default: {
fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{os}.', {'module_name' => $module_name, 'os' => $::operatingsystem }))
fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{os}.',
{'module_name' => $module_name, 'os' => $::operatingsystem }))
}
}
$config_file = '/etc/my.cnf'
Expand Down Expand Up @@ -380,7 +381,8 @@
}

default: {
fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{osfamily} or %{os}.', {'module_name' => $module_name, 'os' => $::operatingsystem, 'osfamily' => $::osfamily}))
fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{osfamily} or %{os}.',
{'module_name' => $module_name, 'os' => $::operatingsystem, 'osfamily' => $::osfamily}))
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion manifests/server/backup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
) {

if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ {
warning(translate("The 'prescript' option is not currently implemented for the %{provider} backup provider.", {'provider' => $provider}))
warning(translate("The 'prescript' option is not currently implemented for the %{provider} backup provider.",
{'provider' => $provider}))
}

create_resources('class', {
Expand Down
6 changes: 4 additions & 2 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
# on mariadb systems, $includedir is not defined, but /etc/my.cnf.d has
# to be managed to place the server.cnf there
$configparentdir = mysql_dirname($mysql::server::config_file)
if $configparentdir != '/' and $configparentdir != '/etc' and $configparentdir != $includedir and $configparentdir != mysql_dirname($includedir) {
if $configparentdir != '/' and $configparentdir != '/etc' and $configparentdir
!= $includedir and $configparentdir != mysql_dirname($includedir) {
file { $configparentdir:
ensure => directory,
mode => '0755',
Expand All @@ -50,7 +51,8 @@

if $options['mysqld']['ssl-disable'] {
notify {'ssl-disable':
message =>'Disabling SSL is evil! You should never ever do this except if you are forced to use a mysql version compiled without SSL support'
message =>'Disabling SSL is evil! You should never ever do this except
if you are forced to use a mysql version compiled without SSL support'
}
}
}
6 changes: 4 additions & 2 deletions manifests/server/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
$service_ensure = undef
}

if $mysql::server::override_options and $mysql::server::override_options['mysqld'] and $mysql::server::override_options['mysqld']['user'] {
if $mysql::server::override_options and $mysql::server::override_options['mysqld']
and $mysql::server::override_options['mysqld']['user'] {
$mysqluser = $mysql::server::override_options['mysqld']['user']
} else {
$mysqluser = $options['mysqld']['user']
Expand Down Expand Up @@ -40,7 +41,8 @@
File['mysql-config-file'] -> Service['mysqld']
}

if $mysql::server::override_options and $mysql::server::override_options['mysqld'] and $mysql::server::override_options['mysqld']['socket'] {
if $mysql::server::override_options and $mysql::server::override_options['mysqld']
and $mysql::server::override_options['mysqld']['socket'] {
$mysqlsocket = $mysql::server::override_options['mysqld']['socket']
} else {
$mysqlsocket = $options['mysqld']['socket']
Expand Down
4 changes: 1 addition & 3 deletions spec/acceptance/mysql_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class { 'mysql::server::backup':
end

describe 'mysqlbackup.sh' do
# rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength
before(:all) do
pre_run
end
Expand Down Expand Up @@ -111,7 +110,6 @@ class { 'mysql::server::backup':
end

describe 'mysqlbackup.sh' do
# rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength
before(:all) do
pre_run
end
Expand Down Expand Up @@ -192,7 +190,7 @@ class { 'mysql::server::backup':
apply_manifest(pp, catch_failures: true)
end

it 'runs mysqlbackup.sh with no errors' do # rubocop:disable RSpec/ExampleLength
it 'runs mysqlbackup.sh with no errors' do
pre_run
unless version_is_greater_than('5.7.0')
shell('/usr/local/sbin/mysqlbackup.sh') do |r|
Expand Down
3 changes: 0 additions & 3 deletions spec/acceptance/types/mysql_grant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ class { 'mysql::server':
end

describe 'adding function privileges' do
# rubocop:disable RSpec/ExampleLength
it 'works without errors' do
pp = <<-EOS
exec { 'simplefunc-create':
Expand All @@ -479,8 +478,6 @@ class { 'mysql::server':
apply_manifest(pp, catch_failures: true)
end
# rubocop:enable RSpec/ExampleLength

# rubocop:disable RSpec/MultipleExpectations
it 'finds the user' do
shell('mysql -NBe "SHOW GRANTS FOR test3@tester"') do |r|
expect(r.stdout).to match(%r{GRANT EXECUTE ON FUNCTION `mysql`.`simplefunc` TO 'test3'@'tester'})
Expand Down
2 changes: 0 additions & 2 deletions spec/acceptance/types/mysql_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class { 'mysql::server': }
end

pre_run

# rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
describe 'changing authentication plugin', if: version_is_greater_than('5.5.0') do
it 'works without errors' do
pp = <<-EOS
Expand Down
1 change: 0 additions & 1 deletion spec/classes/mysql_server_backup_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'

describe 'mysql::server::backup' do
# rubocop:disable RSpec/NestedGroups
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:pre_condition) do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/mysql_server_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'

describe 'mysql::server' do
# rubocop:disable RSpec/NestedGroups
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/provider/mysql_database/mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
end

describe 'self.instances' do
it 'returns an array of databases' do # rubocop:disable RSpec/ExampleLength
it 'returns an array of databases' do
provider.class.stubs(:mysql_caller).with('show databases', 'regular').returns(raw_databases)
raw_databases.each_line do |db|
provider.class.stubs(:mysql_caller).with(["show variables like '%_database'", db.chomp], 'regular').returns("character_set_database latin1\ncollation_database latin1_swedish_ci\nskip_show_database OFF") # rubocop:disable Metrics/LineLength
Expand Down
1 change: 0 additions & 1 deletion spec/unit/puppet/provider/mysql_user/mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@
end

describe 'plugin=' do
# rubocop:disable RSpec/NestedGroups
context 'auth_socket' do
context 'MySQL < 5.7.6' do
it 'changes the authentication plugin' do
Expand Down

0 comments on commit 670cbd6

Please sign in to comment.