*
*/
/*
- Copyright (C) 2004-2005 Kern Sibbald
+ Copyright (C) 2004-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
/* Read-only variables */
static struct s_vars getvars[] = {
- { N_("Job"), "s"},
- { N_("Level"), "s"},
- { N_("Type"), "s"},
- { N_("JobId"), "i"},
- { N_("Client"), "s"},
- { N_("NumVols"), "i"},
- { N_("Pool"), "s"},
- { N_("Storage"), "s"},
- { N_("Catalog"), "s"},
- { N_("MediaType"), "s"},
- { N_("JobName"), "s"},
- { N_("JobStatus"), "s"},
- { N_("Priority"), "i"},
- { N_("CatalogRes"), "(sssssis)"},
+ { "Job", "s"},
+ { "Level", "s"},
+ { "Type", "s"},
+ { "JobId", "i"},
+ { "Client", "s"},
+ { "NumVols", "i"},
+ { "Pool", "s"},
+ { "Storage", "s"},
+ { "Catalog", "s"},
+ { "MediaType", "s"},
+ { "JobName", "s"},
+ { "JobStatus", "s"},
+ { "Priority", "i"},
+ { "VolumeName", "s"},
+ { "CatalogRes", "(sssssis)"},
{ NULL, NULL}
};
/* Writable variables */
static struct s_vars setvars[] = {
- { N_("JobReport"), "s"},
- { N_("VolumeName"), "s"},
- { N_("Priority"), "i"},
+ { "JobReport", "s"},
+ { "VolumeName", "s"},
+ { "Priority", "i"},
{ NULL, NULL}
};
Dmsg0(100, "In job_getattr.\n");
jcr = get_jcr_from_PyObject(self);
if (!jcr) {
- bstrncpy(errmsg, "Job pointer not found.", sizeof(errmsg));
+ bstrncpy(errmsg, _("Job pointer not found."), sizeof(errmsg));
goto bail_out;
}
for (i=0; getvars[i].name; i++) {
jcr->NumVols = pr.NumVols;
return Py_BuildValue(getvars[i].fmt, jcr->NumVols);
} else {
- bsnprintf(errmsg, sizeof(errmsg), "Pool record not found.");
+ bsnprintf(errmsg, sizeof(errmsg), _("Pool record not found."));
goto bail_out;
}
case 6: /* Pool */
return Py_BuildValue(getvars[i].fmt, buf);
case 12: /* Priority */
return Py_BuildValue(getvars[i].fmt, jcr->JobPriority);
- case 13: /* CatalogRes */
+ case 13:
+ return Py_BuildValue(getvars[i].fmt, jcr->VolumeName);
+ case 14: /* CatalogRes */
return Py_BuildValue(getvars[i].fmt,
jcr->catalog->db_name, jcr->catalog->db_address,
jcr->catalog->db_user, jcr->catalog->db_password,
catalog_db);
}
- bsnprintf(errmsg, sizeof(errmsg), "Attribute %s not found.", attrname);
+ bsnprintf(errmsg, sizeof(errmsg), _("Attribute %s not found."), attrname);
bail_out:
PyErr_SetString(PyExc_AttributeError, errmsg);
return NULL;
switch (setvars[i].fmt[0]) {
case 's':
if (!PyArg_Parse(value, setvars[i].fmt, &strval)) {
- PyErr_SetString(PyExc_TypeError, "Read-only attribute");
+ PyErr_SetString(PyExc_TypeError, _("Read-only attribute"));
return -1;
}
break;
case 'i':
if (!PyArg_Parse(value, setvars[i].fmt, &intval)) {
- PyErr_SetString(PyExc_TypeError, "Read-only attribute");
+ PyErr_SetString(PyExc_TypeError, _("Read-only attribute"));
return -1;
}
break;
return -1;
}
-
+/*
+ * Set pointer to instantiated events class
+ */
static PyObject *set_job_events(PyObject *self, PyObject *arg)
{
PyObject *eObject;
return Py_None;
}
-/* Run a Bacula command */
+/* Run a Bacula job */
static PyObject *job_run(PyObject *self, PyObject *arg)
{
JCR *jcr;
}
foreach_jcr(jcr) {
if (jcr->JobId == 0) {
- free_jcr(jcr);
continue;
}
if (jcr->JobId == JobId) {
break;
}
}
+ /* endeach_jcr(jcr) not needed because freed below */
+
if (!found) {
/* ***FIXME*** raise exception */
return NULL;