-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add support for magic check in EvmDatabaseOps #18167
Add support for magic check in EvmDatabaseOps #18167
Conversation
807629c
to
3fb203b
Compare
lib/evm_database_ops.rb
Outdated
@@ -144,7 +144,14 @@ def self.restore(db_opts, connect_opts = {}) | |||
# are doing a `MiqFileStorage.download`, and the interface for that | |||
# method is to pass a `nil` for the block form since we are streaming the | |||
# data from the command that we are writting as part of the block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this comment continue to live next to the line it applies to? Maybe we can shorten it to something like this?
Restores need a nil passed to the block form of
download
to accommodate streaming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can look into that.
spec/lib/evm_database_ops_spec.rb
Outdated
|
||
it "yields `db_opt`s only" do | ||
allow(file_storage).to receive(:download) { |&block| block.call(input_path) } | ||
expect { |rspec_probe| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the bot comments about the multi-line blocks and curly-braces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, I just figured it would have also barfed about doing a:
this_my_block do |var|
# stuff and things
end.call_a_method_on_the_result
But maybe it won't... ¯\_(ツ)_/¯
spec/lib/evm_database_ops_spec.rb
Outdated
{ :dbname => "vmdb_production", :local_file => input_path }, | ||
:pgdump | ||
] | ||
expect { |rspec_probe| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Calls the newly created method `MiqFileStorage.magic_number_for` to pre-fetch the magic from the file that will be downloaded, and send that to `PostgresAdmin` as a `database_opts` to avoid checking it on it's end. Note: Shortened a comment in here, but since it is part of the git history, I am fine with it. Those willing to dig deep can find it.
3fb203b
to
ca92710
Compare
@carbonin comments addressed. |
Checked commit NickLaMuro@ca92710 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
…tabase-restores Add support for magic check in EvmDatabaseOps (cherry picked from commit 3b053f0)
Hammer backport details:
|
Calls the newly created method
MiqFileStorage.magic_number_for
to pre-fetch the magic from the file that will be downloaded, and send that toPostgresAdmin
as adatabase_opts
to avoid checking it on it's end.Requires changes in gems-pending to work (Update: done)
Links
manageiq-gems-pending