Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For database dumps don't modify the directory name #18058

Merged
merged 3 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

@NickLaMuro NickLaMuro Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO! Boo! 😡

See ManageIQ/manageiq-providers-amazon#434 (comment)

(pedantic, don't actually change this)

def self.collect_connect_opts(opts)
connect_opts = {}
CONNECT_OPT_KEYS.each { |k| connect_opts[k] = opts[k] if opts[k] }
Expand Down