-
Notifications
You must be signed in to change notification settings - Fork 262
overlay: refactor getStagingDir helper #2107
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
overlay: refactor getStagingDir helper #2107
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
0bd5b74
to
ceab862
Compare
@rhatdan thanks for the review. Addressed the comments |
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.
Thanks!
This refactoring is correct as is, but it also exposes lingering questions…
drivers/overlay/overlay.go
Outdated
func (d *Driver) dir2(id string, useImageStore bool) (string, string, bool) { | ||
var homedir string | ||
|
||
func (d *Driver) homeDir(useImageStore bool) string { |
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’m confused by the terminology. We have d.homeDir
and d.home
, and those are different values with different semantics.
What do the values actually mean?
(I mean, I’m generally confused and scared by these code paths and options and indirections. This is just a very clear manifestation of my general confusion. But, still.)
pruneStagingDirectories
hard-codes filepath.Join(d.home, stagingDir)
, not using the useImageStore
condition. Which of the two is correct?
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.
thanks, I've renamed the function, hopefully it is clearer now.
pruneStagingDirectories
was using the wrong location, I've fixed this too
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 am still generally confused ;), but making the names are much more distinct does help.
simplify the implementation of getStagingDir() to just create a new staging directory and drop the check whether the correct staging base directory as anyway the rename operation would fail later. Closes: containers#2092 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
ceab862
to
7f30233
Compare
LGTM |
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.
/lgtm
Thanks again!
simplify the implementation of getStagingDir() to just create a new staging directory and drop the check whether the correct staging base directory as anyway the rename operation would fail later.
Closes: #2092