Skip to content

Commit

Permalink
Merge pull request #18058 from kbrock/skip_directory_upload
Browse files Browse the repository at this point in the history
For database dumps don't modify the directory name
  • Loading branch information
carbonin authored Oct 15, 2018
2 parents 2ab08ae + 77d1616 commit 256bdd6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/evm_database_ops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ def self.restore(db_opts, connect_opts = {})
connect_opts[:uri] = File.dirname(connect_opts[:uri])
else
connect_opts[:remote_file_name] ||= File.basename(backup_file_name(action))
backup_folder = action == :dump ? "db_dump" : "db_backup"
#
# If the passed in URI contains query parameters, ignore them
# when creating the dump file name. They'll be used in the session object.
#
connect_opts_uri = connect_opts[:uri].split('?')[0]
uri = File.join(connect_opts_uri, backup_folder, connect_opts[:remote_file_name])
uri_parts = [connect_opts[:uri].split('?')[0]]
uri_parts << (action == :dump ? "db_dump" : "db_backup") unless connect_opts[:skip_directory]
uri_parts << connect_opts[:remote_file_name]
uri = File.join(uri_parts)
end
else
uri = db_opts[:local_file]
Expand Down
3 changes: 2 additions & 1 deletion lib/tasks/evm_dba.rake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module EvmDba
when :local_file
opt :local_file, "Destination file", :type => :string, :required => true
when :remote_file
opt :skip_directory, "Don't add backup directory", :type => :boolean, :default => false
opt :remote_file_name, "Destination depot filename", :type => :string
when :splitable
opt :byte_count, "Size to split files into", :type => :string
Expand All @@ -57,7 +58,7 @@ module EvmDba
db_opts
end

CONNECT_OPT_KEYS = [:uri, :uri_username, :uri_password, :aws_region, :remote_file_name].freeze
CONNECT_OPT_KEYS = %i(uri uri_username uri_password aws_region remote_file_name skip_directory).freeze
def self.collect_connect_opts(opts)
connect_opts = {}
CONNECT_OPT_KEYS.each { |k| connect_opts[k] = opts[k] if opts[k] }
Expand Down

0 comments on commit 256bdd6

Please sign in to comment.