From 5d553ff4dfb064c65f88350b8d35c00f47c9182d Mon Sep 17 00:00:00 2001 From: Lasse Tjernaes Wardenaer <lasse.tjernaes.wardenaer@cern.ch> Date: Mon, 19 Dec 2022 13:25:07 +0100 Subject: [PATCH] Resolve "Clean up messages printed in the terminal for cta-readtp" --- ReleaseNotes.md | 1 + tapeserver/readtp/ReadtpCmdMain.cpp | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index ad6aeda97d..1b54392377 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -8,6 +8,7 @@ - cta/CTA#224 - Improve error message for cta-verify-file whn VID does not exist - cta/CTA#230 - Modify CTA code to enforce VID uppercase - cta/CTA#239 - Add improvments to the cta-change-storage-class tool +- cta/CTA#248 - Clean up output from cta-readtp ### Bug Fixes - cta/CTA#234 - Replace stoi with toUint64 in standalone cli tool - cta/CTA#238 - Compilation fails when using cta::common::Configuration::getConfEntInt(...) diff --git a/tapeserver/readtp/ReadtpCmdMain.cpp b/tapeserver/readtp/ReadtpCmdMain.cpp index a6facb6732..d34ae19b10 100644 --- a/tapeserver/readtp/ReadtpCmdMain.cpp +++ b/tapeserver/readtp/ReadtpCmdMain.cpp @@ -17,6 +17,7 @@ #include <iostream> +#include "common/exception/Exception.hpp" #include "tapeserver/castor/tape/tapeserver/daemon/EncryptionControl.hpp" #include "tapeserver/daemon/TapedConfiguration.hpp" #include "tapeserver/readtp/ReadtpCmd.hpp" @@ -46,16 +47,14 @@ int main(const int argc, char *const *const argv) { try { // Config file needed to find the cta-get-encryption-key script const cta::tape::daemon::TapedConfiguration tapedConfig = - cta::tape::daemon::TapedConfiguration::createFromCtaConf(DAEMON_CONFIG, log); + cta::tape::daemon::TapedConfiguration::createFromCtaConf(DAEMON_CONFIG, dummyLog); externalEncryptionKeyScript = tapedConfig.externalEncryptionKeyScript.value(); - useEncryption = tapedConfig.useEncryption.value() == "yes" ? true : false; - } - catch(...) { - cta::exception::Exception ex; - ex.getMessage() << "ReadtpCmd: Error while trying to read TapedConfiguration config file: " << DAEMON_CONFIG; - throw ex; - } + useEncryption = tapedConfig.useEncryption.value() == "yes"; - cta::tapeserver::readtp::ReadtpCmd cmd(std::cin, std::cout, std::cerr, log, dummyLog, mc, useEncryption, externalEncryptionKeyScript); - return cmd.main(argc, argv); + cta::tapeserver::readtp::ReadtpCmd cmd(std::cin, std::cout, std::cerr, log, dummyLog, mc, useEncryption, externalEncryptionKeyScript); + return cmd.main(argc, argv); + } catch(cta::exception::Exception &ex) { + std::cerr << ex.getMessageValue() << std::endl; + return 1; + } } \ No newline at end of file -- GitLab