Created
January 8, 2014 10:15
-
-
Save cghsystems/8314593 to your computer and use it in GitHub Desktop.
This script will replace all soft linked Bosh blobs contained in $BOSH_RELEASE_DIR/blobs with hard links. This helps solve the issue of moving blobs from a created release to a new blobstore. After this script has run `bosh blobs` should show a set of blobs ready to be uploaded to a blobstore. Note: config/blobs will probably need removed.
This file contains 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
require 'fileutils' | |
require 'find' | |
def cp_symlink(f) | |
new_file = "#{f}.new" | |
old_file = File.readlink(f) | |
FileUtils.cp(old_file, new_file) | |
`rm -r #{f}` | |
File.rename(new_file, f) | |
puts "Processed #{f}" | |
end | |
Find.find('blobs') { |e| cp_symlink(e) if File.symlink?(e) } | |
p "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment