File tree Expand file tree Collapse file tree 6 files changed +15
-22
lines changed Expand file tree Collapse file tree 6 files changed +15
-22
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ module Puppet::Parser::Functions
39
39
end
40
40
end
41
41
42
- def normalized! ( hash , key )
42
+ def normalized? ( hash , key )
43
43
return true if hash . key? ( key )
44
44
return false unless key =~ %r{-|_}
45
45
other_key = key . include? ( '-' ) ? key . tr ( '-' , '_' ) : key . tr ( '_' , '-' )
@@ -50,7 +50,7 @@ def normalized!(hash, key)
50
50
51
51
def overlay ( hash1 , hash2 )
52
52
hash2 . each do |key , value |
53
- if normalized! ( hash1 , key ) && value . is_a? ( Hash ) && hash1 [ key ] . is_a? ( Hash )
53
+ if normalized? ( hash1 , key ) && value . is_a? ( Hash ) && hash1 [ key ] . is_a? ( Hash )
54
54
overlay ( hash1 [ key ] , value )
55
55
else
56
56
hash1 [ key ] = value
Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ class Puppet::Provider::Mysql < Puppet::Provider
6
6
# Make sure we find mysql commands on CentOS and FreeBSD
7
7
ENV [ 'PATH' ] = ENV [ 'PATH' ] + ':/usr/libexec:/usr/local/libexec:/usr/local/bin'
8
8
9
- commands mysql : 'mysql'
10
- commands mysqld : 'mysqld'
11
- commands mysqladmin : 'mysqladmin'
9
+ # rubocop:disable Style/HashSyntax
10
+ commands :mysql => 'mysql'
11
+ commands :mysqld => 'mysqld'
12
+ commands :mysqladmin => 'mysqladmin'
13
+ # rubocop:enable Style/HashSyntax
12
14
13
15
# Optional defaults file
14
16
def self . defaults_file
Original file line number Diff line number Diff line change 11
11
commands mysql_install_db : 'mysql_install_db'
12
12
# rubocop:disable Lint/UselessAssignment
13
13
def create
14
- name = @resource [ :name ]
14
+ name = @resource [ :name ]
15
15
insecure = @resource . value ( :insecure ) || true
16
16
defaults_extra_file = @resource . value ( :defaults_extra_file )
17
17
user = @resource . value ( :user ) || 'mysql'
@@ -34,9 +34,7 @@ def create
34
34
35
35
opts = [ defaults_extra_file ]
36
36
%w[ basedir datadir user ] . each do |opt |
37
- # rubocop:disable Security/Eval
38
- val = eval ( opt )
39
- # rubocop:enable Security/Eval
37
+ val = eval ( opt ) # rubocop:disable Security/Eval
40
38
opts << "--#{ opt } =#{ val } " unless val . nil?
41
39
end
42
40
@@ -57,9 +55,7 @@ def create
57
55
end
58
56
59
57
def destroy
60
- # rubocop:disable Lint/UselessAssignment
61
- name = @resource [ :name ]
62
- # rubocop:enable Lint/UselessAssignment
58
+ name = @resource [ :name ] # rubocop:disable Lint/UselessAssignment
63
59
raise ArgumentError , 'ERROR: Resource can not be removed'
64
60
end
65
61
Original file line number Diff line number Diff line change @@ -68,11 +68,9 @@ def self.instances
68
68
def self . prefetch ( resources )
69
69
users = instances
70
70
resources . keys . each do |name |
71
- # rubocop:disable Lint/AssignmentInCondition
72
- if provider = users . find { |user | user . name == name }
71
+ if provider = users . find { |user | user . name == name } # rubocop:disable Lint/AssignmentInCondition
73
72
resources [ name ] . provider = provider
74
73
end
75
- # rubocop:enable Lint/AssignmentInCondition
76
74
end
77
75
end
78
76
Original file line number Diff line number Diff line change @@ -18,11 +18,9 @@ def self.instances
18
18
def self . prefetch ( resources )
19
19
plugins = instances
20
20
resources . keys . each do |plugin |
21
- # rubocop:disable Lint/AssignmentInCondition
22
- if provider = plugins . find { |pl | pl . name == plugin }
21
+ if provider = plugins . find { |pl | pl . name == plugin } # rubocop:disable Lint/AssignmentInCondition
23
22
resources [ plugin ] . provider = provider
24
23
end
25
- # rubocop:enable Lint/AssignmentInCondition
26
24
end
27
25
end
28
26
Original file line number Diff line number Diff line change 3
3
describe 'mysql::server' do
4
4
context "on an unsupported OS" do
5
5
let ( :facts ) do
6
- {
7
- :osfamily => 'UNSUPPORTED' ,
6
+ {
7
+ :osfamily => 'UNSUPPORTED' ,
8
8
:operatingsystem => 'UNSUPPORTED'
9
9
}
10
- end
11
-
10
+ end
12
11
it 'should gracefully fail' do
13
12
is_expected . to compile . and_raise_error ( /Unsupported platform:/ )
14
13
end
You can’t perform that action at this time.
0 commit comments