Skip to content

Commit

Permalink
Allow to specify jobtype=<jobtype> for prune jobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent 43c9324 commit af00299
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/dird/ua_cmds.c
Expand Up @@ -159,7 +159,7 @@ static struct cmdstruct commands[] = {
{ NT_("move"), move_cmd, _("Move slots in an autochanger"),
NT_("storage=<storage-name> srcslots=<slot-selection> dstslots=<slot-selection>"), true },
{ NT_("prune"), prune_cmd, _("Prune records from catalog"),
NT_("files | jobs | pool=<pool-name> | client=<client-name> | volume=<volume-name> | directory=<directory> | recursive"), true },
NT_("files | jobs | jobtype=<jobtype> | pool=<pool-name> | client=<client-name> | volume=<volume-name> | directory=<directory> | recursive"), true },
{ NT_("purge"), purge_cmd, _("Purge records from catalog"),
NT_("files jobs volume=<volume-name> [ action=<action> devicetype=<type> pool=<pool-name>\n"
"\tallpools storage=<storage-name> drive=<num> ]"), true },
Expand Down
23 changes: 16 additions & 7 deletions src/dird/ua_prune.c
Expand Up @@ -173,21 +173,30 @@ int prune_cmd(UAContext *ua, const char *cmd)
/*
* Ask what jobtype to prune.
*/
start_prompt(ua, _("Jobtype to prune:\n"));
for (i = 0; jobtypes[i].type_name; i++) {
add_prompt(ua, jobtypes[i].type_name);
}
if (find_arg_with_value(ua, NT_("jobtype")) >= 0) {
bstrncpy(jobtype, ua->argv[i], sizeof(jobtype));
} else {
start_prompt(ua, _("Jobtype to prune:\n"));
for (i = 0; jobtypes[i].type_name; i++) {
add_prompt(ua, jobtypes[i].type_name);
}

if (do_prompt(ua, _("JobType"), _("Select Job Type"), jobtype, sizeof(jobtype)) < 0) {
return true;
if (do_prompt(ua, _("JobType"), _("Select Job Type"), jobtype, sizeof(jobtype)) < 0) {
return true;
}
}

for (i = 0; jobtypes[i].type_name; i++) {
if (bstrcmp(jobtypes[i].type_name, jobtype)) {
if (bstrcasecmp(jobtypes[i].type_name, jobtype)) {
break;
}
}

if (!jobtypes[i].type_name) {
ua->warning_msg(_("Illegal jobtype %s.\n"), jobtype);
return false;
}

/*
* Pool Job Retention takes precedence over client Job Retention
*/
Expand Down

0 comments on commit af00299

Please sign in to comment.