Skip to content
Snippets Groups Projects
Commit fb1f14e3 authored by Lasse Tjernaes Wardenaer's avatar Lasse Tjernaes Wardenaer
Browse files

Resolve "Use --eos.instance instead of --instance in cta-send-event"

parent 6e6ddd8a
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
- cta/CTA#214 - Update manual page for cta-admin to include info about user defined config files. - cta/CTA#214 - Update manual page for cta-admin to include info about user defined config files.
### Bug fixes ### Bug fixes
- cta/CTA#93 - Refactor Frontend code to allow code sharing between SSI and gRPC implementations - cta/CTA#93 - Refactor Frontend code to allow code sharing between SSI and gRPC implementations
- cta/CTA#221 - Change option in cta-send-event from instance to eos.instance
# v4.7.14-1 # v4.7.14-1
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "CtaFrontendApi.hpp" #include "CtaFrontendApi.hpp"
#include "version.h" #include "version.h"
#include "common/CmdLineArgs.hpp" #include "common/CmdLineArgs.hpp"
#include "common/exception/CommandLineNotParsed.hpp"
const std::string config_file = "/etc/cta/cta-cli.conf"; const std::string config_file = "/etc/cta/cta-cli.conf";
...@@ -111,9 +112,7 @@ void parseFileInfo(std::istream &in, AttrMap &attr, AttrMap &xattr) ...@@ -111,9 +112,7 @@ void parseFileInfo(std::istream &in, AttrMap &attr, AttrMap &xattr)
void fillNotification(cta::eos::Notification &notification, const std::string &wf_command, void fillNotification(cta::eos::Notification &notification, const std::string &wf_command,
const int argc, char *const *const argv) const int argc, char *const *const argv)
{ {
cta::cliTool::CmdLineArgs cmdLineArgs(argc, argv, cta::cliTool::StandaloneCliTool::CTA_SEND_EVENT); cta::cliTool::CmdLineArgs cmdLineArgs(argc, argv, cta::cliTool::StandaloneCliTool::CTA_SEND_EVENT);
const std::string &eos_instance = cmdLineArgs.m_diskInstance.value(); const std::string &eos_instance = cmdLineArgs.m_diskInstance.value();
const std::string &eos_endpoint = cmdLineArgs.m_eosEndpoint.has_value() ? cmdLineArgs.m_eosEndpoint.value() : "localhost:1095"; const std::string &eos_endpoint = cmdLineArgs.m_eosEndpoint.has_value() ? cmdLineArgs.m_eosEndpoint.value() : "localhost:1095";
const std::string &requester_user = cmdLineArgs.m_requestUser.value(); const std::string &requester_user = cmdLineArgs.m_requestUser.value();
...@@ -135,10 +134,10 @@ void fillNotification(cta::eos::Notification &notification, const std::string &w ...@@ -135,10 +134,10 @@ void fillNotification(cta::eos::Notification &notification, const std::string &w
std::string accessUrl = "root://" + eos_endpoint + "/" + attr["path"] + "?eos.lfn=fxid:" + attr["fxid"]; std::string accessUrl = "root://" + eos_endpoint + "/" + attr["path"] + "?eos.lfn=fxid:" + attr["fxid"];
std::string reportUrl = "eosQuery://" + eos_endpoint + "//eos/wfe/passwd?mgm.pcmd=event&mgm.fid=" + attr["fxid"] + std::string reportUrl = "eosQuery://" + eos_endpoint + "//eos/wfe/passwd?mgm.pcmd=event&mgm.fid=" + attr["fxid"] +
"&mgm.logid=cta&mgm.event=sync::archived&mgm.workflow=default&mgm.path=/dummy_path&mgm.ruid=0&mgm.rgid=0&cta_archive_file_id=" + "&mgm.logid=cta&mgm.event=sync::archived&mgm.workflow=default&mgm.path=/dummy_path&mgm.ruid=0&mgm.rgid=0&cta_archive_file_id=" +
xattrs["sys.archive.file_id"]; xattrs["sys.archive.file_id"];
std::string destUrl = "root://" + eos_endpoint + "/" + attr["path"] + "?eos.lfn=fxid:" + attr["fxid"] + std::string destUrl = "root://" + eos_endpoint + "/" + attr["path"] + "?eos.lfn=fxid:" + attr["fxid"] +
"&eos.ruid=0&eos.rgid=0&eos.injection=1&eos.workflow=retrieve_written&eos.space=default"; "&eos.ruid=0&eos.rgid=0&eos.injection=1&eos.workflow=retrieve_written&eos.space=default";
// WF // WF
notification.mutable_wf()->mutable_instance()->set_name(eos_instance); notification.mutable_wf()->mutable_instance()->set_name(eos_instance);
...@@ -257,10 +256,12 @@ int exceptionThrowingMain(int argc, char *const *const argv) ...@@ -257,10 +256,12 @@ int exceptionThrowingMain(int argc, char *const *const argv)
* Start here * Start here
*/ */
int main(int argc, char *const *const argv) { int main(int argc, char *const *const argv) {
try { try {
return exceptionThrowingMain(argc, argv); return exceptionThrowingMain(argc, argv);
} catch (XrdSsiPb::PbException &ex) { } catch (XrdSsiPb::PbException &ex) {
std::cerr << "Error in Google Protocol Buffers: " << ex.what() << std::endl; std::cerr << "Error in Google Protocol Buffers: " << ex.what() << std::endl;
} catch(cta::exception::CommandLineNotParsed &ex) {
std::cerr << ex.what() << std::endl;
} catch (XrdSsiPb::XrdSsiException &ex) { } catch (XrdSsiPb::XrdSsiException &ex) {
std::cerr << "Error from XRootD SSI Framework: " << ex.what() << std::endl; std::cerr << "Error from XRootD SSI Framework: " << ex.what() << std::endl;
} catch (std::exception &ex) { } catch (std::exception &ex) {
......
...@@ -44,8 +44,8 @@ static struct option restoreFilesLongOption[] = { ...@@ -44,8 +44,8 @@ static struct option restoreFilesLongOption[] = {
{nullptr, 0, nullptr, 0} {nullptr, 0, nullptr, 0}
}; };
static struct option sendFileLongOption[] = { static struct option sendEventLongOption[] = {
{"instance", required_argument, nullptr, 'i'}, {"eos.instance", required_argument, nullptr, 'i'},
{"eos.endpoint", required_argument, nullptr, 'e'}, {"eos.endpoint", required_argument, nullptr, 'e'},
{"request.user", required_argument, nullptr, 'u'}, {"request.user", required_argument, nullptr, 'u'},
{"request.group", required_argument, nullptr, 'g'}, {"request.group", required_argument, nullptr, 'g'},
...@@ -74,7 +74,7 @@ static struct option changeStorageClassLongOption[] = { ...@@ -74,7 +74,7 @@ static struct option changeStorageClassLongOption[] = {
std::map<StandaloneCliTool, const option*> longopts = { std::map<StandaloneCliTool, const option*> longopts = {
{StandaloneCliTool::RESTORE_FILES, restoreFilesLongOption}, {StandaloneCliTool::RESTORE_FILES, restoreFilesLongOption},
{StandaloneCliTool::CTA_SEND_EVENT, sendFileLongOption}, {StandaloneCliTool::CTA_SEND_EVENT, sendEventLongOption},
{StandaloneCliTool::CTA_VERIFY_FILE, verifyFileLongOption}, {StandaloneCliTool::CTA_VERIFY_FILE, verifyFileLongOption},
{StandaloneCliTool::CTA_CHANGE_STORAGE_CLASS, changeStorageClassLongOption}, {StandaloneCliTool::CTA_CHANGE_STORAGE_CLASS, changeStorageClassLongOption},
}; };
...@@ -170,7 +170,7 @@ m_help(false), m_debug(false), m_standaloneCliTool{standaloneCliTool} { ...@@ -170,7 +170,7 @@ m_help(false), m_debug(false), m_standaloneCliTool{standaloneCliTool} {
} }
case ':': // Missing parameter case ':': // Missing parameter
{ {
exception::CommandLineNotParsed ex; exception::CommandLineNotParsed ex("", false);
ex.getMessage() << "The -" << static_cast<char>(optopt) << " option requires a parameter"; ex.getMessage() << "The -" << static_cast<char>(optopt) << " option requires a parameter";
throw ex; throw ex;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment