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

Add support for magic check in EvmDatabaseOps #18167

Conversation

NickLaMuro
Copy link
Member

@NickLaMuro NickLaMuro commented Nov 5, 2018

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.

Requires changes in gems-pending to work (Update: done)

Links

@miq-bot miq-bot added the wip label Nov 5, 2018
@NickLaMuro NickLaMuro force-pushed the magic-number-support-for-database-restores branch 3 times, most recently from 807629c to 3fb203b Compare November 10, 2018 01:16
@NickLaMuro NickLaMuro changed the title [WIP] Add support for magic check in EvmDatabaseOps Add support for magic check in EvmDatabaseOps Nov 10, 2018
@NickLaMuro
Copy link
Member Author

@miq-bot assign @carbonin
@miq-bot add_label enhancement, hammer/yes

@@ -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.
Copy link
Member

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

Copy link
Member Author

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.


it "yields `db_opt`s only" do
allow(file_storage).to receive(:download) { |&block| block.call(input_path) }
expect { |rspec_probe|
Copy link
Member

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?

Copy link
Member Author

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... ¯\_(ツ)_/¯

{ :dbname => "vmdb_production", :local_file => input_path },
:pgdump
]
expect { |rspec_probe|
Copy link
Member

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.
@NickLaMuro NickLaMuro force-pushed the magic-number-support-for-database-restores branch from 3fb203b to ca92710 Compare November 12, 2018 21:09
@NickLaMuro
Copy link
Member Author

@carbonin comments addressed.

@miq-bot
Copy link
Member

miq-bot commented Nov 12, 2018

Checked commit NickLaMuro@ca92710 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

@carbonin carbonin merged commit 3b053f0 into ManageIQ:master Nov 12, 2018
@carbonin carbonin added this to the Sprint 99 Ending Nov 19, 2018 milestone Nov 12, 2018
simaishi pushed a commit that referenced this pull request Nov 13, 2018
…tabase-restores

Add support for magic check in EvmDatabaseOps

(cherry picked from commit 3b053f0)
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit aebb66eecfca49441783074c59bb77045fbc1a42
Author: Nick Carboni <ncarboni@redhat.com>
Date:   Mon Nov 12 18:01:45 2018 -0500

    Merge pull request #18167 from NickLaMuro/magic-number-support-for-database-restores
    
    Add support for magic check in EvmDatabaseOps
    
    (cherry picked from commit 3b053f0afd4a21fdd333a695a47d53f2ffac2248)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants