Skip to content

Commit

Permalink
Add file splitting to evm:db:dump:local
Browse files Browse the repository at this point in the history
  • Loading branch information
NickLaMuro committed Jul 16, 2018
1 parent 916ba0a commit 56b98fe
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/tasks/evm_dba.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 56b98fe

Please sign in to comment.