Skip to content
Snippets Groups Projects
Commit dc662d14 authored by Michael Davis's avatar Michael Davis
Browse files

[cta-admin] Adds "cta-admin tape ls --fidfile <file>" option

parent 39f4eb7b
Branches
Tags
No related merge requests found
......@@ -398,7 +398,20 @@ void CtaAdminCmd::readListFromFile(cta::admin::OptionStrList &str_list, const st
while(!ss.eof()) {
std::string item;
ss >> item;
if(!item.empty()) {
// skip blank lines or lines consisting only of whitespace
if(item.empty()) continue;
if(str_list.key() == OptionStrList::FILE_ID) {
// Special handling for file id lists. The output from "eos find --fid <fid> /path" is:
// path=/path fid=<fid>
// We are only interested in the list of <fid>s
if(item.substr(0, 4) == "fid=") {
str_list.add_item(item.substr(4));
} else {
continue;
}
} else {
// default case: add all items
str_list.add_item(item);
}
}
......
......@@ -328,6 +328,7 @@ const std::map<std::string, OptionString::Key> strOptions = {
* Map string list options to Protocol Buffer enum values
*/
const std::map<std::string, OptionStrList::Key> strListOptions = {
{ "--fidfile", OptionStrList::FILE_ID },
{ "--vidfile", OptionStrList::VID }
};
......@@ -413,6 +414,7 @@ const Option opt_drivename_cmd { Option::OPT_CMD, "--drive",
const Option opt_encrypted { Option::OPT_BOOL, "--encrypted", "-e", " <\"true\" or \"false\">" };
const Option opt_encryptionkeyname { Option::OPT_STR, "--encryptionkeyname", "-k", " <encryption_key_name>" };
const Option opt_extended { Option::OPT_FLAG, "--extended", "-x", "" };
const Option opt_fidfile { Option::OPT_STR_LIST, "--fidfile", "-i", " <filename>" };
const Option opt_filename { Option::OPT_STR, "--file", "-f", " <filename>" };
const Option opt_firstfseq { Option::OPT_UINT, "--firstfseq", "-f", " <first_fseq>" };
const Option opt_force { Option::OPT_BOOL, "--force", "-f", " <\"true\" or \"false\">" };
......@@ -573,7 +575,7 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = {
{{ AdminCmd::CMD_TAPE, AdminCmd::SUBCMD_LS },
{ opt_vid.optional(), opt_mediatype.optional(), opt_vendor.optional(),
opt_logicallibrary.optional(), opt_tapepool.optional(), opt_vo.optional(), opt_capacity.optional(),
opt_disabled.optional(), opt_full.optional(), opt_readonly.optional(), opt_all.optional() }},
opt_disabled.optional(), opt_full.optional(), opt_readonly.optional(), opt_fidfile.optional(), opt_all.optional() }},
{{ AdminCmd::CMD_TAPE, AdminCmd::SUBCMD_LABEL },
{ opt_vid, opt_force.optional() }},
/*----------------------------------------------------------------------------------------------------*/
......
Subproject commit 877182104dfc54c73724924a98f94350d1aff2a4
Subproject commit dfafb9fbd6bf91c9040852c20bd30059e0b6ee7b
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment