From 203fdaf138035b6bb71fa8238c45c9748d3f70de Mon Sep 17 00:00:00 2001 From: Jorge Camarero Vera <jorge.camarero@cern.ch> Date: Mon, 10 Oct 2022 11:29:58 +0200 Subject: [PATCH] Allow verification status to be cleared with cta-admin --- ReleaseNotes.md | 6 ++---- catalogue/CatalogueTest.cpp | 11 +++++++++++ catalogue/RdbmsCatalogue.cpp | 6 +++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index f6366bef8a..8b4b237b20 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -2,10 +2,8 @@ ## Summary ### Features -- cta/CTA#146 - Refactoring of operation tools cmd line parsing -### Building and Packaging -- cta/CTA#107 - Check latest version of gtest suite -### Bug fixes +- cta/CTA#153 - Allow verification status to be cleared with cta-admin +### Bug fixes - cta/CTA#161 - Fix bug when using temporary tables with PostgreSQL # v4.7.12-1 diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp index 77ff7875ce..d38b93b715 100644 --- a/catalogue/CatalogueTest.cpp +++ b/catalogue/CatalogueTest.cpp @@ -6352,7 +6352,18 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeVerificationStatus) { ASSERT_EQ(m_admin.username, creationLog.username); ASSERT_EQ(m_admin.host, creationLog.host); ASSERT_EQ(tape.verificationStatus.value(), modifiedVerificationStatus); + } + + // Clear verification status + m_catalogue->modifyTapeVerificationStatus(m_admin, m_tape1.vid, ""); + { + const std::list<common::dataStructures::Tape> tapes = m_catalogue->getTapes(); + ASSERT_EQ(1, tapes.size()); + + const common::dataStructures::Tape tape = tapes.front(); + ASSERT_EQ(m_tape1.vid, tape.vid); + ASSERT_EQ(tape.verificationStatus.has_value(), false); } } diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index f134c9fd15..677d715bd8 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -5107,7 +5107,11 @@ void RdbmsCatalogue::modifyTapeVerificationStatus(const common::dataStructures:: "VID = :VID"; auto conn = m_connPool.getConn(); auto stmt = conn.createStmt(sql); - stmt.bindString(":VERIFICATION_STATUS", verificationStatus); + if (verificationStatus.empty()) { + stmt.bindString(":VERIFICATION_STATUS", std::nullopt); + } else { + stmt.bindString(":VERIFICATION_STATUS", verificationStatus); + } stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); stmt.bindUint64(":LAST_UPDATE_TIME", now); -- GitLab