Skip to content

Instantly share code, notes, and snippets.

@cghsystems
Created January 8, 2014 10:15
Show Gist options
  • Save cghsystems/8314593 to your computer and use it in GitHub Desktop.
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.
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