2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 # Take two input parameters: a collection uuid and reason
7 # Get "src_collection" with the given uuid
8 # Create a new collection with:
9 # src_collection.manifest_text as "invalid_manifest_text.txt"
10 # Locators from src_collection.manifest_text as "salvaged_data"
11 # Update src_collection:
12 # Set src_collection.manifest_text to: ""
13 # Append to src_collection.name: " (reason; salvaged data at new_collection.uuid)"
14 # Set portable_data_hash to "d41d8cd98f00b204e9800998ecf8427e+0"
17 require './lib/salvage_collection'
18 include SalvageCollection
20 opts = Optimist::options do
22 banner "Usage: salvage_collection.rb " +
25 opt :uuid, "uuid of the collection to be salvaged.", type: :string, required: true
26 opt :reason, "Reason for salvaging.", type: :string, required: false
29 # Salvage the collection with the given uuid
30 SalvageCollection.salvage_collection opts.uuid, opts.reason