From c65107687169f4b9168f049abe48514195417407 Mon Sep 17 00:00:00 2001 From: Samuel Sciolla Date: Fri, 26 Apr 2024 14:06:10 -0400 Subject: [PATCH] Remove staging stuff --- lib/config.rb | 14 +------------- restore_from_aptrust.rb | 26 ++------------------------ 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/lib/config.rb b/lib/config.rb index f4c36c8..071f3a0 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -179,16 +179,9 @@ def get_subset_by_key_stem(stem) keyword_init: true ) - DarkBlueStagingConfig = Struct.new( - "DarkBlueStagingConfig", - :remote, - keyword_init: true - ) - DarkBlueConfig = Struct.new( "DarkBlueConfig", :archivematicas, - :staging, keyword_init: true ) @@ -303,12 +296,7 @@ def self.create_config(data) description: data.get_value(key: "REPOSITORY_DESCRIPTION") ), database: (db_data.keys.length > 0) ? create_database_config(db_data) : nil, - dark_blue: DarkBlueConfig.new( - archivematicas: arch_configs, - staging: DarkBlueStagingConfig.new( - remote: create_remote_config(data.get_subset_by_key_stem("DARK_BLUE_STAGING_REMOTE_")) - ) - ), + dark_blue: DarkBlueConfig.new(archivematicas: arch_configs), aptrust: APTrustConfig.new( api: APTrustAPIConfig.new( username: data.get_value(key: "APTRUST_API_USERNAME"), diff --git a/restore_from_aptrust.rb b/restore_from_aptrust.rb index 8a8e8b1..08fdb9c 100644 --- a/restore_from_aptrust.rb +++ b/restore_from_aptrust.rb @@ -24,23 +24,10 @@ def initialize(config:, base_path: "umich.edu") region: aws_config.region, bucket_name: aws_config.restore_bucket ) - staging_remote_config = config.dark_blue.staging.remote - @staging_client = RemoteClient::RemoteClientFactory.from_config( - type: staging_remote_config.type, - settings: staging_remote_config.settings - ) - end - - def send_to_staging - logger.info("Sending all files in restore directory to #{staging_client.remote_text}") - Dir[@restore_path].each do |bag_path| - logger.debug(bag_path) - @staging_client.send_file(local_file_path: bag_path) - end end def restore_all - logger.info("Retrieving all files in #{@aptrust_client.remote_text}from path: #{@base_path}") + logger.info("Retrieving all files in #{@aptrust_client.remote_text} from path: #{@base_path}") @aptrust_client.retrieve_from_path(remote_path: @base_path, local_path: @restore_dir) end @@ -54,7 +41,7 @@ def restore_bags(bag_identifiers) end end -RestoreOptions = Struct.new(:bags, :send_to_staging) +RestoreOptions = Struct.new(:bags) class RestoreParser def self.parse(options) @@ -69,14 +56,6 @@ def self.parse(options) ) do |b| args.bags = b end - parser.on( - "-s", - "--send-to-staging", - TrueClass, - "Flag determing whether to send bags to staging" - ) do |s| - args.send_to_staging = s - end parser.on("-h", "--help", "Prints this help") do puts parser exit @@ -95,4 +74,3 @@ def self.parse(options) else restore_job.restore_all end -restore_job.send_to_staging if options.send_to_staging