[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bacula-devel] Accept "spooldata" flag on bconsole "run" cmd


Hi,

On Wednesday 05 November 2008, Eric Bollengier wrote:
>
> FYI, the src/dird/ua_input.c file contains lots of useful functions to
> parse arguments.
>

great. I was not aware of these functions - thanks for your hint.

The attached version uses the is_yesno function, stripping the code down.

> Could you also write something for the manual ?

I added two or three sentences to each of the documents you referred to; 
please find SVN diffs attached.

On my way there I noticed that the "run" statement documentation lacks 
\begin{verbatim} (and \end), compared to some of the other statements. Some 
other statements lack the verbatim mode, too. I like the \verbatim mode 
better for commands. I'll be glad to send a patch that adds them if required.

Best
   Bastian

-- 
Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany
p: +49 (0) 761-45684-28
f: +49 (0) 761-45684-10        www.collax.com

Geschäftsführer: William K. Hite / Boris Nalbach
AG München HRB 158898 . Ust.-IdNr: DE 814464942
\ Englisch für Bayern: Ich heißt I, Ei heißt egg, Eck heißt corner und 
\          koana heißt nobody.
--- bacula-2.5-20081014svn/src/dird/ua_run.c.ori	2008-07-17 22:53:01.000000000 +0200
+++ bacula-2.5-20081014svn/src/dird/ua_run.c	2008-11-04 14:30:04.000000000 +0100
@@ -60,6 +60,8 @@
    int files;
    bool cloned;
    bool mod;
+   bool spool_data;
+   bool spool_data_set;
 
    /* Methods */
    run_ctx() { memset(this, 0, sizeof(run_ctx)); 
@@ -174,6 +176,7 @@
 start_job:
       Dmsg3(100, "JobId=%u using pool %s priority=%d\n", (int)jcr->JobId, 
             jcr->pool->name(), jcr->JobPriority);
+      Dmsg1(900, "Running a job; its spool_data = %d\n", jcr->spool_data);
       JobId = run_job(jcr);
       Dmsg4(100, "JobId=%u NewJobId=%d using pool %s priority=%d\n", (int)jcr->JobId, 
             JobId, jcr->pool->name(), jcr->JobPriority);
@@ -1008,6 +1025,7 @@
       "backupclient",                 /* 23 */
       "restoreclient",                /* 24 */
       "pluginoptions",                /* 25 */
+      "spooldata",                    /* 26 */
       NULL};
 
 #define YES_POS 14
@@ -1021,6 +1039,7 @@
    rc.fileset_name = NULL;
    rc.verify_job_name = NULL;
    rc.previous_job_name = NULL;
+   rc.spool_data_set = 0;
 
 
    for (i=1; i<ua->argc; i++) {
@@ -1225,6 +1244,27 @@
                }
                kw_ok = true;
                break;
+            case 26: /* spooldata */
+	       if (rc.spool_data_set) {
+                  ua->send_msg(_("Spool flag specified twice.\n"));
+                  return false;
+	       }
+	       if ((strncasecmp(ua->argv[i], "yes", strlen(ua->argv[i])) == 0) ||
+	           (strncasecmp(ua->argv[i], _("yes"), strlen(ua->argv[i])) == 0) ||
+	           (strncmp(ua->argv[i], "1", strlen(ua->argv[i])) == 0)) {
+	          rc.spool_data = 1;
+	          rc.spool_data_set = 1;
+		  kw_ok = true;
+	       } else if ((strncasecmp(ua->argv[i], "no", strlen(ua->argv[i])) == 0) ||
+	           (strncasecmp(ua->argv[i], _("no"), strlen(ua->argv[i])) == 0) ||
+	           (strncmp(ua->argv[i], "0", strlen(ua->argv[i])) == 0)) {
+	          rc.spool_data = 0;
+	          rc.spool_data_set = 1;
+		  kw_ok = true;
+               } else {
+                  ua->send_msg(_("Invalid spooldata flag.\n"));
+               }
+               break;
             default:
                break;
             }
@@ -1305,6 +1343,11 @@
    }
    Dmsg1(100, "Using pool %s\n", rc.pool->name());
 
+   if (rc.spool_data_set) {
+      rc.job->spool_data = rc.spool_data;
+   }
+   Dmsg1(900, "Spooling data: %s\n", (rc.job->spool_data ? "Yes" : "No"));
+
    if (rc.store_name) {
       rc.store->store = GetStoreResWithName(rc.store_name);
       pm_strcpy(rc.store->store_source, _("command line"));
Index: bconsole.tex
===================================================================
--- bconsole.tex	(Revision 7978)
+++ bconsole.tex	(Arbeitskopie)
@@ -917,7 +917,7 @@
 run job=\lt{}job-name\gt{} client=\lt{}client-name\gt{}
   fileset=\lt{}FileSet-name\gt{}  level=\lt{}level-keyword\gt{}
   storage=\lt{}storage-name\gt{}  where=\lt{}directory-prefix\gt{}
-  when=\lt{}universal-time-specification\gt{}  yes  
+  when=\lt{}universal-time-specification\gt{} spooldata=yes|no yes  
 
    Any information that is needed but not specified will be listed for
    selection, and before starting the job, you will be prompted to accept,
@@ -982,8 +982,12 @@
 
 If you wish to start a job at a later time, you can do so by setting  the When
 time. Use the {\bf mod} option and select {\bf When} (no. 6).  Then enter the
-desired start time in YYYY-MM-DD HH:MM:SS format.  
+desired start time in YYYY-MM-DD HH:MM:SS format.
 
+The spooldata argument of the run command cannot be modified through the menu
+and is only accessible by setting its value on the intial command line. If
+no spooldata flag is set, the job's flag is used.
+
 \item [setdebug]
    \index[general]{setdebug}
    \index[general]{setdebug}
Index: spooling.tex
===================================================================
--- spooling.tex	(Revision 7978)
+++ spooling.tex	(Arbeitskopie)
@@ -61,6 +61,12 @@
 
 {\bf SpoolData = yes|no} 
 
+\item To override the Job specification in a bconsole session using the run 
+   command. Please note that this does {\bf not } refer to a configuration
+   statement, but to an argument for the run command.
+
+{\bf SpoolData=yes|no} 
+
 \item To limit the the maximum spool file size for a particular job in the Job
   resource
 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilot Consulting.