if (job.JobId < 2):
startid = job.run("run kernsave")
job.JobReport = "Python started new Job: jobid=%d\n" % startid
+ print "name=%s version=%s conf=%s working=%s" % (bacula.Name, bacula.Version, bacula.ConfigFile, bacula.WorkingDir)
def JobRun(self, job):
noop = 1
self.fd = open('m.py', 'rb')
jobid = self.job.JobId
print "Open: JobId=%d" % jobid
- print "name=%s" % bacula.name
# Read file data into Bacula memory buffer (mem)
# return length read. 0 => EOF, -1 => error
Kern's ToDo List
- 15 July 2005
+ 18 July 2005
Major development:
Project Developer
======= =========
-TLS Landon Fuller
-Unicode in Win32 Thorsten Engel (done)
-VSS Thorsten Engel (in beta testing)
Version 1.37 Kern (see below)
========================================================
Final items for 1.37 before release:
-1. Fix the remaining bugs that I am aware of and new ones that come up
- during testing.
+1. Fix bugs
- --without-openssl breaks at least on Solaris.
-- bsr-opt-test fails. bsr deleted. Fix.
-- Allow cancel of unknown Job
-- State not saved when closing Win32 FD by icon
- Move Python daemon variables from Job to Bacula object.
WorkingDir, ConfigFile
7. Write a bacula-web document
8. Take one more try at making DVD writing work.
9. Run the regression scripts on Solaris and FreeBSD
-- Figure out how to package docs and gui programs.
+- Figure out how to package gui, and rescue programs.
- Test TLS.
Document:
- Port limiting -m in iptables to prevent DoS attacks
could cause broken pipes on Bacula.
6. Build and test the Volume Shadow Copy (VSS) for Win32.
+- Allow cancel of unknown Job
+- State not saved when closing Win32 FD by icon
+- bsr-opt-test fails. bsr deleted. Fix.
+
General:
Changes to 1.37.31:
+18Jul05
+- Move Python variables from Job to Bacula. They are
+ DirName, Version, ConfigFile, and WorkingDir
+- Fix delete of bootstrap to only occur on Bacula created
+ filenames.
+- Allow cancelling a Job name that is not active. It is
+ sent to the daemons.
17Jul05
- Fix name space pollution by OpenSSL 0.9.8 reported by
Matthias Kurz -- applied his patch.
}
bnet_sig(fd, BNET_EOD);
fclose(bs);
- unlink(jcr->RestoreBootstrap);
+ if (jcr->unlink_bsr) {
+ unlink(jcr->RestoreBootstrap);
+ jcr->unlink_bsr = false;
+ }
if (!response(jcr, fd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
set_jcr_job_status(jcr, JS_ErrorTerminated);
return 0;
* Cancel a job -- typically called by the UA (Console program), but may also
* be called by the job watchdog.
*
- * Returns: 1 if cancel appears to be successful
- * 0 on failure. Message sent to ua->jcr.
+ * Returns: true if cancel appears to be successful
+ * false on failure. Message sent to ua->jcr.
*/
-int cancel_job(UAContext *ua, JCR *jcr)
+bool cancel_job(UAContext *ua, JCR *jcr)
{
BSOCK *sd, *fd;
bsendmsg(ua, _("JobId %d, Job %s marked to be canceled.\n"),
jcr->JobId, jcr->Job);
jobq_remove(&job_queue, jcr); /* attempt to remove it from queue */
- return 1;
+ return true;
default:
}
if (!connect_to_storage_daemon(ua->jcr, 10, SDConnectTimeout, 1)) {
bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
- return 0;
+ return false;
}
Dmsg0(200, "Connected to storage daemon\n");
sd = ua->jcr->store_bsock;
}
}
- return 1;
+ return true;
}
/* fd_cmds.c */
extern int connect_to_file_daemon(JCR *jcr, int retry_interval,
- int max_retry_time, int verbose);
+ int max_retry_time, int verbose);
extern bool send_include_list(JCR *jcr);
extern bool send_exclude_list(JCR *jcr);
extern bool send_bootstrap_file(JCR *jcr);
extern int get_attributes_and_put_in_catalog(JCR *jcr);
extern int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId);
extern int put_file_into_catalog(JCR *jcr, long file_index, char *fname,
- char *link, char *attr, int stream);
+ char *link, char *attr, int stream);
extern void get_level_since_time(JCR *jcr, char *since, int since_len);
extern int send_run_before_and_after_commands(JCR *jcr);
extern bool get_or_create_client_record(JCR *jcr);
extern bool get_or_create_fileset_record(JCR *jcr, FILESET_DBR *fsr);
extern JobId_t run_job(JCR *jcr);
-extern int cancel_job(UAContext *ua, JCR *jcr);
+extern bool cancel_job(UAContext *ua, JCR *jcr);
extern void init_jcr_job_record(JCR *jcr);
extern void copy_storage(JCR *new_jcr, JCR *old_jcr);
extern void set_storage(JCR *jcr, STORE *store);
/* msgchan.c */
extern bool connect_to_storage_daemon(JCR *jcr, int retry_interval,
- int max_retry_time, int verbose);
+ int max_retry_time, int verbose);
extern int start_storage_daemon_job(JCR *jcr, alist *store, int append);
extern int start_storage_daemon_message_thread(JCR *jcr);
extern int bget_dirmsg(BSOCK *bs);
void free_ua_context(UAContext *ua);
/* ua_select.c */
-STORE *select_storage_resource(UAContext *ua);
-JOB *select_job_resource(UAContext *ua);
-JOB *select_restore_job_resource(UAContext *ua);
-CLIENT *select_client_resource(UAContext *ua);
+STORE *select_storage_resource(UAContext *ua);
+JOB *select_job_resource(UAContext *ua);
+JOB *select_restore_job_resource(UAContext *ua);
+CLIENT *select_client_resource(UAContext *ua);
FILESET *select_fileset_resource(UAContext *ua);
-int select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
-int select_media_dbr(UAContext *ua, MEDIA_DBR *mr);
-bool select_pool_dbr(UAContext *ua, POOL_DBR *pr);
-int select_client_dbr(UAContext *ua, CLIENT_DBR *cr);
-
-void start_prompt(UAContext *ua, const char *msg);
-void add_prompt(UAContext *ua, const char *prompt);
-int do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, int max_prompt);
+int select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
+int select_media_dbr(UAContext *ua, MEDIA_DBR *mr);
+bool select_pool_dbr(UAContext *ua, POOL_DBR *pr);
+int select_client_dbr(UAContext *ua, CLIENT_DBR *cr);
+
+void start_prompt(UAContext *ua, const char *msg);
+void add_prompt(UAContext *ua, const char *prompt);
+int do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, int max_prompt);
CAT *get_catalog_resource(UAContext *ua);
STORE *get_storage_resource(UAContext *ua, int use_default);
-int get_media_type(UAContext *ua, char *MediaType, int max_media);
-bool get_pool_dbr(UAContext *ua, POOL_DBR *pr);
-int get_client_dbr(UAContext *ua, CLIENT_DBR *cr);
+int get_media_type(UAContext *ua, char *MediaType, int max_media);
+bool get_pool_dbr(UAContext *ua, POOL_DBR *pr);
+int get_client_dbr(UAContext *ua, CLIENT_DBR *cr);
POOL *get_pool_resource(UAContext *ua);
POOL *select_pool_resource(UAContext *ua);
CLIENT *get_client_resource(UAContext *ua);
-int get_job_dbr(UAContext *ua, JOB_DBR *jr);
+int get_job_dbr(UAContext *ua, JOB_DBR *jr);
int find_arg_keyword(UAContext *ua, const char **list);
int find_arg(UAContext *ua, const char *keyword);
/* Read-only variables */
static struct s_vars getvars[] = {
{ N_("Job"), "s"},
- { N_("DirName"), "s"},
{ N_("Level"), "s"},
{ N_("Type"), "s"},
{ N_("JobId"), "i"},
{ N_("JobName"), "s"},
{ N_("JobStatus"), "s"},
{ N_("Priority"), "i"},
- { N_("Version"), "(ss)"},
- { N_("ConfigFile"), "s"},
- { N_("WorkingDir"), "s"},
{ N_("CatalogRes"), "(sssssis)"},
{ NULL, NULL}
switch (i) {
case 0: /* Job */
return Py_BuildValue(getvars[i].fmt, jcr->job->hdr.name);
- case 1: /* Director's name */
- return Py_BuildValue(getvars[i].fmt, my_name);
- case 2: /* level */
+ case 1: /* level */
return Py_BuildValue(getvars[i].fmt, job_level_to_str(jcr->JobLevel));
- case 3: /* type */
+ case 2: /* type */
return Py_BuildValue(getvars[i].fmt, job_type_to_str(jcr->JobType));
- case 4: /* JobId */
+ case 3: /* JobId */
return Py_BuildValue(getvars[i].fmt, jcr->JobId);
- case 5: /* Client */
+ case 4: /* Client */
return Py_BuildValue(getvars[i].fmt, jcr->client->hdr.name);
- case 6: /* NumVols */
+ case 5: /* NumVols */
POOL_DBR pr;
memset(&pr, 0, sizeof(pr));
bstrncpy(pr.Name, jcr->pool->hdr.name, sizeof(pr.Name));
bsnprintf(errmsg, sizeof(errmsg), "Pool record not found.");
goto bail_out;
}
- case 7: /* Pool */
+ case 6: /* Pool */
return Py_BuildValue(getvars[i].fmt, jcr->pool->hdr.name);
- case 8: /* Storage */
+ case 7: /* Storage */
return Py_BuildValue(getvars[i].fmt, jcr->store->hdr.name);
- case 9:
+ case 8:
return Py_BuildValue(getvars[i].fmt, jcr->catalog->hdr.name);
- case 10: /* MediaType */
+ case 9: /* MediaType */
return Py_BuildValue(getvars[i].fmt, jcr->store->media_type);
- case 11: /* JobName */
+ case 10: /* JobName */
return Py_BuildValue(getvars[i].fmt, jcr->Job);
- case 12: /* JobStatus */
+ case 11: /* JobStatus */
buf[1] = 0;
buf[0] = jcr->JobStatus;
return Py_BuildValue(getvars[i].fmt, buf);
- case 13: /* Priority */
+ case 12: /* Priority */
return Py_BuildValue(getvars[i].fmt, jcr->JobPriority);
- case 14: /* Version */
- return Py_BuildValue(getvars[i].fmt, VERSION, BDATE);
- case 15: /* Config Dir */
- return Py_BuildValue(getvars[i].fmt, configfile);
- case 16: /* Working Dir */
- return Py_BuildValue(getvars[i].fmt, director->working_directory);
- case 17: /* CatalogRes */
+ case 13: /* CatalogRes */
return Py_BuildValue(getvars[i].fmt,
jcr->catalog->db_name, jcr->catalog->db_address,
jcr->catalog->db_user, jcr->catalog->db_password,
}
JobId = str_to_int64(ua->argv[i]);
if (!(jcr=get_jcr_by_id(JobId))) {
- bsendmsg(ua, _("JobId %s is not running.\n"), ua->argv[i]);
+ bsendmsg(ua, _("JobId %s is not running. Use Job name to cancel inactive jobs.\n"), ua->argv[i]);
return 1;
}
break;
break;
}
if (!(jcr=get_jcr_by_partial_name(ua->argv[i]))) {
- bsendmsg(ua, _("Job %s is not running.\n"), ua->argv[i]);
- return 1;
+ bsendmsg(ua, _("Warning Job %s is not running. Continuing anyway ...\n"), ua->argv[i]);
+ jcr = new_jcr(sizeof(JCR), dird_free_jcr);
+ bstrncpy(jcr->Job, ua->argv[i], sizeof(jcr->Job));
}
break;
}
ret = cancel_job(ua, jcr);
free_jcr(jcr);
-
return ret;
}
#define CONFIG_FILE "./bacula-fd.conf" /* default config file */
-static char *configfile = NULL;
+char *configfile = NULL;
static bool foreground = false;
static bool inetd_request = false;
static workq_t dir_workq; /* queue of work from Director */
#undef _POSIX_C_SOURCE
#include <Python.h>
+extern char *configfile;
+
/* Imported subroutines */
//extern PyMethodDef JobMethods[];
extern PyObject *job_getattr(PyObject *self, char *attrname);
{NULL, NULL, 0, NULL} /* last item */
};
+static char my_version[] = VERSION " " BDATE;
/*
* This is a Bacula Job type as defined in Python. We store a pointer
Py_Initialize();
PyEval_InitThreads();
bacula_module = Py_InitModule("bacula", BaculaMethods);
- PyModule_AddStringConstant(bacula_module, "name", my_name);
+ PyModule_AddStringConstant(bacula_module, "Name", my_name);
+ PyModule_AddStringConstant(bacula_module, "Version", my_version);
+ PyModule_AddStringConstant(bacula_module, "ConfigFile", configfile);
+ PyModule_AddStringConstant(bacula_module, "WorkingDir", (char *)working_directory);
if (!bacula_module) {
Jmsg0(NULL, M_ERROR_TERM, 0, "Could not initialize Python\n");
}
/*
- Copyright (C) 2000-2004 Kern Sibbald and John Walker
+ Copyright (C) 2001-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
-
/*
Derived from a SMTPclient:
Copyright (C) 2002-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
* Version $Id$
*
*/
-
/*
- Copyright (C) 2004 Kern Sibbald
+ Copyright (C) 2004-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
/*
* Test program for find files
*/
-
/*
- Copyright (C) 2000-2003 Kern Sibbald and John Walker
+ Copyright (C) 2000-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
/* */
#undef VERSION
#define VERSION "1.37.31"
-#define BDATE "17 July 2005"
-#define LSMDATE "17Jul05"
+#define BDATE "18 July 2005"
+#define LSMDATE "18Jul05"
/* Debug flags */
#undef DEBUG