-
Notifications
You must be signed in to change notification settings - Fork 51
to prevent file cleaning, touch cache, its link, md5 and id, resolves #1282 #1367
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a5235c1
refactored gridshare touch #1282
MontrealSergiy 7a746ab
refactoring cache link touch #1282
MontrealSergiy 8a286aa
refactoring cache link touch - spacing and placing #1282
MontrealSergiy f26720e
refactoring cache link touch - drop a touch #1282
MontrealSergiy 7e15576
refactoring cache link touch - more comments #1282
MontrealSergiy e38da4e
refactoring cache link touch - polish comments #1282
MontrealSergiy 0f2b366
rename a cache dp touch method into touch_cache_md5 #1282
MontrealSergiy 772c767
simplify soft link touch #1282
MontrealSergiy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,15 +289,24 @@ def self.a100_ensure_dp_cache_symlink_exists #:nodoc: | |
myself = RemoteResource.current_resource | ||
gridshare_dir = myself.cms_shared_dir | ||
cache_dir = myself.dp_cache_dir | ||
sym_path = "#{gridshare_dir}/#{DataProvider::DP_CACHE_SYML}" | ||
|
||
return unless Dir.exists?(gridshare_dir) && Dir.exists?(cache_dir) | ||
|
||
#---------------------------------------------------------------------------- | ||
puts "C> Making sure the grid share directory has a symlink to the data provider cache..." | ||
#---------------------------------------------------------------------------- | ||
|
||
sym_path = "#{gridshare_dir}/#{DataProvider::DP_CACHE_SYML}" | ||
return if File.symlink?(sym_path) && File.realpath(sym_path) == File.realpath(cache_dir) | ||
# update the work directory timestamp to counter cluster deletion policies | ||
FileUtils.touch(gridshare_dir, verbose: true, nocreate: true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you leave the verbose and nocreate option there? Did you check the boot logs? I now see this crud:
|
||
|
||
if File.symlink?(sym_path) && File.realpath(sym_path) == File.realpath(cache_dir) | ||
# touch -h updates the timestamp of the symlink itself not the file it point to | ||
# it works on major modern Linux and MacOS, but might have problems with older OS, | ||
# such as Big Sur | ||
system("touch", "-h", sym_path) | ||
return | ||
end | ||
|
||
File.unlink(sym_path) if File.exists?(sym_path) | ||
File.symlink(cache_dir, sym_path) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is this so complicated?!??
The original code's logic was:
The new code should simply be instead:
But you did a complex set of conditions including checking the return status of system():
Why is make it so complicated?
Uh oh!
There was an error while loading. Please reload this page.
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.
To make code work even if touch fails. But ok, can roll back that check.