From 56b98fe0e1eba7fb79793c694094daad06370ad1 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Thu, 28 Jun 2018 13:29:33 -0500 Subject: [PATCH] Add file splitting to evm:db:dump:local --- lib/tasks/evm_dba.rake | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/tasks/evm_dba.rake b/lib/tasks/evm_dba.rake index d80e61219ee3..1dc9e1881e87 100644 --- a/lib/tasks/evm_dba.rake +++ b/lib/tasks/evm_dba.rake @@ -34,6 +34,8 @@ module EvmDba opt :local_file, "Destination file", :type => :string, :required => true when :remote_file opt :remote_file_name, "Destination depot filename", :type => :string + when :splitable + opt :byte_count, "Size to split files by", :type => :string when :remote_uri opt :uri, "Destination depot URI", :type => :string, :required => true opt :uri_username, "Destination depot username", :type => :string @@ -59,6 +61,12 @@ module EvmDba connect_opts[:password] = connect_opts.delete(:uri_password) if connect_opts[:uri_password] connect_opts end + + def self.collect_additional_opts(opts) + additional_opts = {} + [:byte_count].each { |k| additional_opts[k] = opts[k] if opts[k] } + additional_opts + end end namespace :evm do @@ -185,9 +193,11 @@ namespace :evm do require File.expand_path(File.join(Rails.root, "lib", "evm_database_ops")) desc 'Backup the local ManageIQ EVM Database (VMDB) to a local file' task :local do - opts = EvmDba.with_options(:local_file, :db_credentials) + opts = EvmDba.with_options(:local_file, :splitable, :db_credentials) + + additional_opts = EvmDba.collect_additional_opts(opts) - EvmDatabaseOps.backup(opts) + EvmDatabaseOps.backup(opts, {}, additional_opts) exit # exit so that parameters to the first rake task are not run as rake tasks end @@ -209,9 +219,10 @@ namespace :evm do require Rails.root.join("lib", "evm_database_ops").expand_path.to_s desc 'Dump the local ManageIQ EVM Database (VMDB) to a local file' task :local do - opts = EvmDba.with_options(:local_file, :db_credentials, :exclude_table_data) + opts = EvmDba.with_options(:local_file, :splitable, :db_credentials, :exclude_table_data) - EvmDatabaseOps.dump(opts) + additional_opts = EvmDba.collect_additional_opts(opts) + EvmDatabaseOps.dump(opts, {}, additional_opts) exit # exit so that parameters to the first rake task are not run as rake tasks end