-
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
Fix uri dirname parsing for swift restore #18166
Fix uri dirname parsing for swift restore #18166
Conversation
The swift protocol is the only file storage used by `EvmDatabaseOps` at this time that uses query params as part of setting it's options. The previous implementation of `.with_file_storage` would use a simple `File.dirname` to determine the mount point. This causes the query params to be completely stripped from the uri, and messes with the configuration set by the user via the query params. There is also a quirk with the implementation of `URI::FTP` (stdlib) that overrides `.path` differently since it swaps it's `"/"` characters for `"%2F"`, which we don't happening unannounced. So for the fix, we use `URI::Generic.new` directly, and avoid the `URI.parse` method since it will make use of `URI::FTP` in those cases. Split is used as just a convenient way of getting the args for `URI::Generic.new`.
ad4ec3a
to
2d9e5d7
Compare
Checked commit NickLaMuro@2d9e5d7 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 lib/evm_database_ops.rb
|
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.
looking good - just that one catch
@@ -291,10 +291,28 @@ def execute_with_file_storage(action = :backup) | |||
execute_with_file_storage(:restore) | |||
end | |||
|
|||
it "parses the dirname of the `uri` and passes that in `connect_opts`" do |
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.
it "parses the dirname of the `uri` and passes that in `connect_opts`" do | |
it "parses the dirname of the 'uri' and passes that in 'connect_opts'" do |
do you really want backticks in here?
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 always use backticks to denote variable names (pulled from markdown syntax). It isn't executed, so it is just a standard I am using to say this_is_code
.
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.
Sorry, to further explain, I use backticks because I want to clarify that I am referencing a variable or some other syntax element, and not a string value (so not object.class.name.downcase == 'uri'
).
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.
nvr mind -brain freeze
…e_mount_point Fix uri dirname parsing for swift restore (cherry picked from commit 3d2a9b6)
Hammer backport details:
|
The swift protocol is the only file storage used by
EvmDatabaseOps
at this time that uses query params as part of setting it's options.The previous implementation of
.with_file_storage
would use a simpleFile.dirname
to determine the mount point. This causes the query params to be completely stripped from the uri, and messes with the configuration set by the user via the query params.There is also a quirk with the implementation of
URI::FTP
(stdlib) that overrides.path
differently since it swaps it's"/"
characters for"%2F"
, which we don't happening unannounced.So for the fix, we use
URI::Generic.new
directly, and avoid theURI.parse
method since it will make use ofURI::FTP
in those cases. Split is used as just a convenient way of getting the args forURI::Generic.new
.