typedef enum
{
- ITEM_ARG, /* item with simple list like .job */
+ ITEM_ARG, /* item with simple list like .jobs */
ITEM_HELP /* use help item=xxx and detect all arguments */
} cpl_item_t;
{"pool=", ".pool" },
{"fileset=", ".fileset" },
{"client=", ".client" },
- {"job=", ".job" },
+ {"job=", ".jobs" },
+ {"restore_job=",".jobs type=R" },
{"level=", ".level" },
{"storage=", ".storage" },
{"schedule=", ".schedule" },
bool get_pool_dbr(UAContext *ua, POOL_DBR *pr, const char *argk="pool");
bool get_client_dbr(UAContext *ua, CLIENT_DBR *cr);
POOL *get_pool_resource(UAContext *ua);
+JOB *get_restore_job(UAContext *ua);
POOL *select_pool_resource(UAContext *ua);
CLIENT *get_client_resource(UAContext *ua);
int get_job_dbr(UAContext *ua, JOB_DBR *jr);
{ NT_("quit"), quit_cmd, _("Terminate Bconsole session"), NT_(""), false},
{ NT_("query"), querycmd, _("Query catalog"), NT_(""), false},
{ NT_("restore"), restore_cmd, _("Restore files"),
- NT_("where=</path> client=<client> storage=<storage> bootstrap=<file>"
+ NT_("where=</path> client=<client> storage=<storage> bootstrap=<file> "
+ "restore_job=<job>"
"\n\tcomment=<text> jobid=<jobid> done select all"), false},
{ NT_("relabel"), relabel_cmd, _("Relabel a tape"),
if (rx.restore_jobs == 1) {
job = rx.restore_job;
} else {
- job = select_restore_job_resource(ua);
+ job = get_restore_job(ua);
}
if (!job) {
goto bail_out;
"restoreclient", /* 19 */
"copies", /* 20 */
"comment", /* 21 */
+ "restore_job", /* 22 */
NULL
};
return job;
}
+/*
+ * Select a Restore Job resource from argument or prompt
+ */
+JOB *get_restore_job(UAContext *ua)
+{
+ JOB *job;
+ int i = find_arg_with_value(ua, "restore_job");
+ if (i >= 0 && acl_access_ok(ua, Job_ACL, ua->argv[i])) {
+ job = (JOB *)GetResWithName(R_JOB, ua->argv[i]);
+ if (job && job->JobType == JT_RESTORE) {
+ return job;
+ }
+ ua->error_msg(_("Error: Restore Job resource \"%s\" does not exist.\n"),
+ ua->argv[i]);
+ }
+ return select_restore_job_resource(ua);
+}
+
/*
* Select a Restore Job resource from prompt list
*/