File tree 2 files changed +57
-1
lines changed
2 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 67
67
require => Mysql_user[" ${backupuser} @localhost" ],
68
68
}
69
69
}
70
+ if versioncmp($facts [' mysql_version' ], ' 8' ) >= 0 {
71
+ mysql_grant { "${backupuser}@localhost/performance_schema.keyring_component_status" :
72
+ ensure => $ensure ,
73
+ user => " ${backupuser} @localhost" ,
74
+ table => ' performance_schema.keyring_component_status' ,
75
+ privileges => [' SELECT' ],
76
+ require => Mysql_user[" ${backupuser} @localhost" ],
77
+ }
78
+ mysql_grant { "${backupuser}@localhost/performance_schema.log_status" :
79
+ ensure => $ensure ,
80
+ user => " ${backupuser} @localhost" ,
81
+ table => ' performance_schema.log_status' ,
82
+ privileges => [' SELECT' ],
83
+ require => Mysql_user[" ${backupuser} @localhost" ],
84
+ }
85
+ }
70
86
}
71
87
72
88
if $install_cron {
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ class { 'mysql::server': }
11
11
EOF
12
12
end
13
13
let ( :facts ) do
14
- facts . merge ( root_home : '/root' )
14
+ facts . merge ( root_home : '/root' ,
15
+ mysql_version : '5.7' )
15
16
end
16
17
17
18
let ( :default_params ) do
@@ -114,6 +115,45 @@ class { 'mysql::server': }
114
115
)
115
116
. that_requires ( 'Mysql_user[backupuser@localhost]' )
116
117
end
118
+
119
+ context 'with MySQL version 5.7' do
120
+ let ( :facts ) do
121
+ facts . merge ( mysql_version : '5.7' )
122
+ end
123
+
124
+ it {
125
+ is_expected . not_to contain_mysql_grant ( 'backupuser@localhost/performance_schema.keyring_component_status' )
126
+ is_expected . not_to contain_mysql_grant ( 'backupuser@localhost/performance_schema.log_status' )
127
+ }
128
+ end
129
+
130
+ context 'with MySQL version 8.0' do
131
+ let ( :facts ) do
132
+ facts . merge ( mysql_version : '8.0' )
133
+ end
134
+
135
+ it {
136
+ is_expected . to contain_mysql_grant ( 'backupuser@localhost/performance_schema.keyring_component_status' )
137
+ . with (
138
+ ensure : 'present' ,
139
+ user : 'backupuser@localhost' ,
140
+ table : 'performance_schema.keyring_component_status' ,
141
+ privileges :
142
+ [ 'SELECT' ]
143
+ )
144
+ . that_requires ( 'Mysql_user[backupuser@localhost]' )
145
+
146
+ is_expected . to contain_mysql_grant ( 'backupuser@localhost/performance_schema.log_status' )
147
+ . with (
148
+ ensure : 'present' ,
149
+ user : 'backupuser@localhost' ,
150
+ table : 'performance_schema.log_status' ,
151
+ privileges :
152
+ [ 'SELECT' ]
153
+ )
154
+ . that_requires ( 'Mysql_user[backupuser@localhost]' )
155
+ }
156
+ end
117
157
end
118
158
119
159
context 'with additional cron args' do
You can’t perform that action at this time.
0 commit comments