@@ -71,7 +71,7 @@ def self.logical_volume_path
71
71
end
72
72
73
73
def self . database_size ( opts )
74
- result = runcmd ( "psql" , opts , :command => "SELECT pg_database_size('#{ opts [ :dbname ] } ');" )
74
+ result = run_command ( "psql" , opts , :command => "SELECT pg_database_size('#{ opts [ :dbname ] } ');" )
75
75
result . match ( /^\s +([0-9]+)\n / ) [ 1 ] . to_i
76
76
end
77
77
@@ -140,7 +140,7 @@ def self.backup_pg_dump(opts)
140
140
args = combine_command_args ( opts , :format => "c" , :file => opts [ :local_file ] , nil => dbname )
141
141
args = handle_multi_value_pg_dump_args! ( opts , args )
142
142
143
- runcmd_with_logging ( "pg_dump" , opts , args )
143
+ run_command_with_logging ( "pg_dump" , opts , args )
144
144
opts [ :local_file ]
145
145
end
146
146
@@ -177,9 +177,8 @@ def self.backup_pg_compress(opts)
177
177
def self . recreate_db ( opts )
178
178
dbname = opts [ :dbname ]
179
179
opts = opts . merge ( :dbname => 'postgres' )
180
- runcmd ( "psql" , opts , :command => "DROP DATABASE IF EXISTS #{ dbname } " )
181
- runcmd ( "psql" , opts ,
182
- :command => "CREATE DATABASE #{ dbname } WITH OWNER = #{ opts [ :username ] || 'root' } ENCODING = 'UTF8'" )
180
+ run_command ( "psql" , opts , :command => "DROP DATABASE IF EXISTS #{ dbname } " )
181
+ run_command ( "psql" , opts , :command => "CREATE DATABASE #{ dbname } WITH OWNER = #{ opts [ :username ] || 'root' } ENCODING = 'UTF8'" )
183
182
end
184
183
185
184
def self . restore_pg_dump ( opts )
@@ -199,7 +198,7 @@ def self.restore_pg_dump(opts)
199
198
handle_error ( cmd , process_status . exitstatus , error_path )
200
199
else
201
200
args [ nil ] = opts [ :local_file ]
202
- runcmd ( "pg_restore" , opts , args )
201
+ run_command ( "pg_restore" , opts , args )
203
202
end
204
203
opts [ :local_file ]
205
204
end
@@ -245,24 +244,29 @@ def self.vacuum(opts)
245
244
args [ :full ] = nil if opts [ :full ]
246
245
args [ :verbose ] = nil if opts [ :verbose ]
247
246
args [ :table ] = opts [ :table ] if opts [ :table ]
248
- runcmd ( "vacuumdb" , opts , args )
247
+ run_command ( "vacuumdb" , opts , args )
249
248
end
250
249
251
250
def self . reindex ( opts )
252
251
args = { }
253
252
args [ :table ] = opts [ :table ] if opts [ :table ]
254
- runcmd ( "reindexdb" , opts , args )
253
+ run_command ( "reindexdb" , opts , args )
255
254
end
256
255
257
- def self . runcmd ( cmd_str , opts , args )
258
- runcmd_with_logging ( cmd_str , opts , combine_command_args ( opts , args ) )
256
+ def self . run_command ( cmd_str , opts , args )
257
+ run_command_with_logging ( cmd_str , opts , combine_command_args ( opts , args ) )
259
258
end
260
259
261
- def self . runcmd_with_logging ( cmd_str , opts , params = { } )
260
+ def self . run_command_with_logging ( cmd_str , opts , params = { } )
262
261
$log. info ( "MIQ(#{ name } .#{ __method__ } ) Running command... #{ AwesomeSpawn . build_command_line ( cmd_str , params ) } " )
263
262
AwesomeSpawn . run! ( cmd_str , :params => params , :env => pg_env ( opts ) ) . output
264
263
end
265
264
265
+ class << self
266
+ # Temporary alias due to manageiq core stubbing this method
267
+ alias runcmd_with_logging run_command_with_logging
268
+ end
269
+
266
270
private_class_method def self . combine_command_args ( opts , args )
267
271
default_args = { :no_password => nil }
268
272
default_args [ :dbname ] = opts [ :dbname ] if opts [ :dbname ]
0 commit comments