Merge branch '6859-fix-invalid-manifests' refs #6859
[arvados.git] / services / api / script / salvage_collection.rb
1 #!/usr/bin/env ruby
2
3 # Take two input parameters: a collection uuid and reason
4 # Get "src_collection" with the given uuid
5 # Create a new collection with:
6 #   src_collection.manifest_text as "invalid_manifest_text.txt"
7 #   Locators from src_collection.manifest_text as "salvaged_data"
8 # Update src_collection:
9 #   Set src_collection.manifest_text to: ""
10 #   Append to src_collection.name: " (reason; salvaged data at new_collection.uuid)"
11 #   Set portable_data_hash to "d41d8cd98f00b204e9800998ecf8427e+0"
12
13 require 'trollop'
14 require './lib/salvage_collection'
15
16 opts = Trollop::options do
17   banner ''
18   banner "Usage: salvage_collection.rb " +
19     "{uuid} {reason}"
20   banner ''
21   opt :uuid, "uuid of the collection to be salvaged.", type: :string, required: true
22   opt :reason, "Reason for salvaging.", type: :string, required: false
23 end
24
25 # Salvage the collection with the given uuid
26 SalvageCollection.salvage_collection opts.uuid, opts.reason