File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
files/gitlab-ctl-commands-ee/lib Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -133,10 +133,14 @@ def database_paused?
133
133
134
134
databases = show_databases
135
135
136
- # In `show databases` output, column 10 gives paused status of database
137
- # (1 for paused and 0 for unpaused )
138
- paused_status = databases . lines . find { | x | x . match ( / #{ @database } / ) } . split ( '|' ) [ 10 ] . strip
136
+ # Find the headings of the output from `SHOW DATABASES` to find out the location of the `paused` column
137
+ headings = databases . lines . first . split ( "|" ) . map ( & :strip )
138
+ paused_position = headings . index ( 'paused' )
139
139
140
+ # Find the paused value of the specified database
141
+ paused_status = databases . lines . find { |x | x . match ( /#{ @database } / ) } . split ( '|' ) [ paused_position ] . strip
142
+
143
+ # 1 for paused and 0 for unpaused
140
144
paused_status == "1"
141
145
end
142
146
You can’t perform that action at this time.
0 commit comments