Skip to content

Commit

Permalink
Remove staging stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ssciolla committed Apr 26, 2024
1 parent e45f4cc commit c651076
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 37 deletions.
14 changes: 1 addition & 13 deletions lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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"),
Expand Down
26 changes: 2 additions & 24 deletions restore_from_aptrust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand All @@ -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
Expand All @@ -95,4 +74,3 @@ def self.parse(options)
else
restore_job.restore_all
end
restore_job.send_to_staging if options.send_to_staging

0 comments on commit c651076

Please sign in to comment.