Commit 2f2783b1 authored by Steven Murray's avatar Steven Murray
Browse files

Renamed Catalogue::modifyTapeEncryptionKey() to modifyTapeEncryptionKeyName()

parent 2993aba4
......@@ -379,7 +379,7 @@ public:
virtual void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) = 0;
virtual void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) = 0;
virtual void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) = 0;
virtual void modifyTapeEncryptionKey(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKey) = 0;
virtual void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) = 0;
/**
* Sets the full status of the specified tape.
......
......@@ -265,8 +265,8 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeCapacityInBytes(admin, vid, capacityInBytes);}, m_maxTriesToConnect);
}
void modifyTapeEncryptionKey(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKey) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeEncryptionKey(admin, vid, encryptionKey);}, m_maxTriesToConnect);
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeEncryptionKeyName(admin, vid, encryptionKeyName);}, m_maxTriesToConnect);
}
void setTapeFull(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool fullValue) override {
......
......@@ -4398,7 +4398,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeCapacityInBytes_nonExistentTape) {
ASSERT_THROW(m_catalogue->modifyTapeCapacityInBytes(m_admin, vid, capacityInBytes), exception::UserError);
}
 
TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey) {
TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKeyName) {
using namespace cta;
 
ASSERT_TRUE(m_catalogue->getTapes().empty());
......@@ -4456,8 +4456,8 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey) {
ASSERT_EQ(creationLog, lastModificationLog);
}
 
const std::string modifiedEncryptionKey = "modified_encryption_key";
m_catalogue->modifyTapeEncryptionKey(m_admin, vid, modifiedEncryptionKey);
const std::string modifiedEncryptionKeyName = "modified_encryption_key_name";
m_catalogue->modifyTapeEncryptionKeyName(m_admin, vid, modifiedEncryptionKeyName);
 
{
const std::list<common::dataStructures::Tape> tapes = m_catalogue->getTapes();
......@@ -4471,7 +4471,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey) {
ASSERT_EQ(logicalLibraryName, tape.logicalLibraryName);
ASSERT_EQ(tapePoolName, tape.tapePoolName);
ASSERT_EQ(vo, tape.vo);
ASSERT_EQ(modifiedEncryptionKey, tape.encryptionKey);
ASSERT_EQ(modifiedEncryptionKeyName, tape.encryptionKey);
ASSERT_EQ(capacityInBytes, tape.capacityInBytes);
ASSERT_TRUE(disabledValue == tape.disabled);
ASSERT_TRUE(fullValue == tape.full);
......@@ -4488,7 +4488,7 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey) {
}
}
 
TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey_emptyStringEncryptionKey) {
TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKeyName_emptyStringEncryptionKey) {
using namespace cta;
 
ASSERT_TRUE(m_catalogue->getTapes().empty());
......@@ -4546,8 +4546,8 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey_emptyStringEncryptio
ASSERT_EQ(creationLog, lastModificationLog);
}
 
const std::string modifiedEncryptionKey;
m_catalogue->modifyTapeEncryptionKey(m_admin, vid, modifiedEncryptionKey);
const std::string modifiedEncryptionKeyName;
m_catalogue->modifyTapeEncryptionKeyName(m_admin, vid, modifiedEncryptionKeyName);
 
{
const std::list<common::dataStructures::Tape> tapes = m_catalogue->getTapes();
......@@ -4578,15 +4578,15 @@ TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey_emptyStringEncryptio
}
}
 
TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKey_nonExistentTape) {
TEST_P(cta_catalogue_CatalogueTest, modifyTapeEncryptionKeyName_nonExistentTape) {
using namespace cta;
 
ASSERT_TRUE(m_catalogue->getTapes().empty());
 
const std::string vid = "vid";
const std::string encryptionKey = "encryption_key";
const std::string encryptionKeyName = "encryption_key_name";
 
ASSERT_THROW(m_catalogue->modifyTapeEncryptionKey(m_admin, vid, encryptionKey), exception::UserError);
ASSERT_THROW(m_catalogue->modifyTapeEncryptionKeyName(m_admin, vid, encryptionKeyName), exception::UserError);
}
 
TEST_P(cta_catalogue_CatalogueTest, tapeLabelled) {
......
......@@ -96,7 +96,7 @@ public:
void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& name, const uint64_t nbCopies) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const uint64_t capacityInBytes) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeComment(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeEncryptionKey(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKey) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKeyName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeMediaType(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& mediaType) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeVendor(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& vendor) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& logicalLibraryName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......
......@@ -2922,14 +2922,14 @@ void RdbmsCatalogue::modifyTapeCapacityInBytes(const common::dataStructures::Sec
}
//------------------------------------------------------------------------------
// modifyTapeEncryptionKey
// modifyTapeEncryptionKeyName
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyTapeEncryptionKey(const common::dataStructures::SecurityIdentity &admin,
const std::string &vid, const std::string &encryptionKey) {
void RdbmsCatalogue::modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin,
const std::string &vid, const std::string &encryptionKeyName) {
try {
optional<std::string> optionalEncryptionKey;
if(!encryptionKey.empty()) {
optionalEncryptionKey = encryptionKey;
optional<std::string> optionalEncryptionKeyName;
if(!encryptionKeyName.empty()) {
optionalEncryptionKeyName = encryptionKeyName;
}
const time_t now = time(nullptr);
......@@ -2943,7 +2943,7 @@ void RdbmsCatalogue::modifyTapeEncryptionKey(const common::dataStructures::Secur
"VID = :VID";
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindOptionalString(":ENCRYPTION_KEY_NAME", optionalEncryptionKey);
stmt.bindOptionalString(":ENCRYPTION_KEY_NAME", optionalEncryptionKeyName);
stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username);
stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host);
stmt.bindUint64(":LAST_UPDATE_TIME", now);
......@@ -2957,11 +2957,11 @@ void RdbmsCatalogue::modifyTapeEncryptionKey(const common::dataStructures::Secur
log::LogContext lc(m_log);
log::ScopedParamContainer spc(lc);
spc.add("vid", vid)
.add("encryptionKey", optionalEncryptionKey ? optionalEncryptionKey.value() : "NULL")
.add("encryptionKeyName", optionalEncryptionKeyName ? optionalEncryptionKeyName.value() : "NULL")
.add("lastUpdateUserName", admin.username)
.add("lastUpdateHostName", admin.host)
.add("lastUpdateTime", now);
lc.log(log::INFO, "Catalogue - user modified tape - encryptionKey");
lc.log(log::INFO, "Catalogue - user modified tape - encryptionKeyName");
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
......
......@@ -399,7 +399,7 @@ public:
void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) override;
void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) override;
void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) override;
void modifyTapeEncryptionKey(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKey) override;
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override;
/**
* Sets the full status of the specified tape.
......
......@@ -1367,7 +1367,7 @@ void RequestMessage::processTape_Ch(cta::xrd::Response &response)
m_catalogue.modifyTapeComment(m_cliIdentity, vid, comment.value());
}
if(encryptionkey) {
m_catalogue.modifyTapeEncryptionKey(m_cliIdentity, vid, encryptionkey.value());
m_catalogue.modifyTapeEncryptionKeyName(m_cliIdentity, vid, encryptionkey.value());
}
if(disabled) {
m_catalogue.setTapeDisabled(m_cliIdentity, vid, disabled.value());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment