From b32a0d0a83b2b5ed5989b0189843b2728dfb66db Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 11 Sep 2024 11:06:25 -0400 Subject: [PATCH] Make alias swap more explicit and safer --- lib/med_installer/indexing_steps.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/med_installer/indexing_steps.rb b/lib/med_installer/indexing_steps.rb index 634bb3d..aab8467 100644 --- a/lib/med_installer/indexing_steps.rb +++ b/lib/med_installer/indexing_steps.rb @@ -55,7 +55,7 @@ def index a.delete! unless [Dromedary::Services[:production_alias], Dromedary::Services[:preview_alias]].include? a.name end - create_solr_documents + create_unified_documents # TODO: SolrCloud::Collection should have a `#url` method, for god's sake collection_url = @build_collection.connection.url.chomp("/") + "/solr/#{@build_collection.name}" @@ -73,6 +73,8 @@ def index @build_dir.rmtree logger.info "Point #{Services[:preview_alias]} at the new #{@build_collection.name} collection " + preview_alias = connection.get_alias(Dromedary::Services[:preview_alias]) + preview_alias && preview_alias.delete! @build_collection.alias_as(Services[:preview_alias], force: true) end @@ -103,7 +105,7 @@ def verify_unzipped_files!(build_directory = build_dir) # This: # * creates entries.json.gz in the build_directory (build in tmp, then copied) # * creates the hyp_to_bibid.json file in the build directory, based on the bib_all.xml file - def create_solr_documents(build_directory: build_dir) + def create_unified_documents(build_directory: build_dir) MedInstaller::Convert.new(command_name: "convert").call(build_directory: build_directory) end