]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_cmds.c
Check if the ScratchPool points to the current Pool and print a warning message in...
[bacula/bacula] / bacula / src / dird / ua_cmds.c
index bb8f55e6f9eed94d45e0735207ea32af5b77a9a7..d2e007b320126351d1d72a6215b5a15fce33df65 100644 (file)
@@ -118,11 +118,14 @@ static struct cmdstruct commands[] = {                                      /* C
 
  { NT_("label"),      label_cmd,     _("Label a tape"), NT_("storage=<storage> volume=<vol> pool=<pool> slot=<slot> barcodes"), false},
  { NT_("list"),       list_cmd,      _("List objects from catalog"),
-   NT_("pools | jobs | jobtotals | volume | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn> |\n"
-       "\tjoblog jobid=<nn> | snapshot"), false},
+   NT_("jobs [client=<cli>] [jobid=<nn>] [ujobid=<name>] [job=<name>] [joberrors] [jobstatus=<s>] [limit=<n>]|\n"
+       "\tjobtotals | pools | volume | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn> |\n"
+       "\tjoblog jobid=<nn> | pluginrestoreconf jobid=<nn> restoreobjectid=<nn> | snapshot"), false},
 
  { NT_("llist"),      llist_cmd,     _("Full or long list like list command"),
-   NT_("pools | jobs | joblog jobid=<nn> | jobtotals | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn> | snapshot"), false},
+   NT_("jobs [client=<cli>] [jobid=<nn>] [ujobid=<name>] [job=<name>] [joberrors] [jobstatus=<s>] [limit=<n>]|\n"
+       "\tjobtotals | pools | volume | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn> |\n"
+       "\tjoblog jobid=<nn> | pluginrestoreconf jobid=<nn> restoreobjectid=<nn> | snapshot"), false},
 
  { NT_("messages"),   messagescmd,   _("Display pending messages"),   NT_(""),    false},
  { NT_("memory"),     memory_cmd,    _("Print current memory usage"), NT_(""),    true},
@@ -194,7 +197,7 @@ static struct cmdstruct commands[] = {                                      /* C
        "\n\t pool=<pool> recycle=<yes/no> slot=<number>\n\t inchanger=<yes/no>"
        "\n\t maxvolbytes=<size> maxvolfiles=<nb> maxvoljobs=<nb>"
        "\n\t enabled=<yes/no> recyclepool=<pool> actiononpurge=<action>"
-       "\n\t allfrompool=<pool> fromallpools"),true},
+       "\n\t allfrompool=<pool> fromallpools frompool"),true},
  { NT_("use"),        use_cmd,       _("Use catalog xxx"), NT_("catalog=<catalog>"),     false},
  { NT_("var"),        var_cmd,       _("Does variable expansion"), NT_(""),  false},
  { NT_("version"),    version_cmd,   _("Print Director version"),  NT_(""),  true},
@@ -225,8 +228,10 @@ bool do_a_command(UAContext *ua)
       return false;
    }
 
-   while (ua->jcr->wstorage->size()) {
-      ua->jcr->wstorage->remove(0);
+   if (ua->jcr->wstorage) {
+      while (ua->jcr->wstorage->size()) {
+         ua->jcr->wstorage->remove(0);
+      }
    }
 
    len = strlen(ua->argk[0]);
@@ -524,6 +529,13 @@ int update_pool_references(JCR *jcr, BDB *db, POOL *pool)
 {
    POOL_DBR  pr;
 
+   if (pool->ScratchPool == pool) {
+      Jmsg(NULL, M_WARNING, 0,
+           _("The ScratchPool directive for Pool \"%s\" is incorrect. Using default Scratch pool instead.\n"),
+           pool->name());
+      pool->ScratchPool = NULL;
+   }
+
    if (!pool->RecyclePool && !pool->ScratchPool) {
       return 1;
    }
@@ -911,6 +923,14 @@ static int disable_cmd(UAContext *ua, const char *cmd)
    return 1;
 }
 
+static void do_dir_setdebug(UAContext *ua, int64_t level, int trace_flag, char *options, int64_t tags)
+{
+   debug_level = level;
+   debug_level_tags = tags;
+   set_trace(trace_flag);
+   set_debug_flags(options);
+}
+
 static void do_storage_setdebug(UAContext *ua, STORE *store,
                int64_t level, int trace_flag, int hangup, int blowup,
                char *options, char *tags)
@@ -996,9 +1016,11 @@ static void do_all_setdebug(UAContext *ua, int64_t level,
    STORE *store, **unique_store;
    CLIENT *client, **unique_client;
    int i, j, found;
+   int64_t t=0;
 
    /* Director */
-   debug_level = level;
+   debug_parse_tags(tags, &t);
+   do_dir_setdebug(ua, level, trace_flag, options, t);
 
    /* Count Storage items */
    LockRes();
@@ -1146,10 +1168,7 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
       }
       if (strcasecmp(ua->argk[i], "dir") == 0 ||
           strcasecmp(ua->argk[i], "director") == 0) {
-         debug_level = level;
-         debug_level_tags = tags;
-         set_trace(trace_flag);
-         set_debug_flags(options);
+         do_dir_setdebug(ua, level, trace_flag, options, tags);
          return 1;
       }
       if (strcasecmp(ua->argk[i], "client") == 0 ||
@@ -1202,9 +1221,7 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
    add_prompt(ua, _("All"));
    switch(do_prompt(ua, "", _("Select daemon type to set debug level"), NULL, 0)) {
    case 0:                         /* Director */
-      debug_level = level;
-      set_trace(trace_flag);
-      set_debug_flags(options);
+      do_dir_setdebug(ua, level, trace_flag, options, tags);
       break;
    case 1:
       store = get_storage_resource(ua, false/*no default*/, true/*unique*/);
@@ -1832,7 +1849,7 @@ int wait_cmd(UAContext *ua, const char *cmd)
       for (bool running=true; running; ) {
          running = false;
          foreach_jcr(jcr) {
-            if (jcr->JobId != 0) {
+            if (!jcr->is_internal_job()) {
                running = true;
                break;
             }
@@ -1892,7 +1909,7 @@ int wait_cmd(UAContext *ua, const char *cmd)
       } else if (strcasecmp(ua->argk[i], "mount") == 0) {
          for (bool waiting=false; !waiting; ) {
             foreach_jcr(jcr) {
-               if (jcr->JobId != 0 &&
+               if (!jcr->is_internal_job() &&
                    (jcr->JobStatus == JS_WaitMedia || jcr->JobStatus == JS_WaitMount)) {
                   waiting = true;
                   break;
@@ -2203,6 +2220,9 @@ bool open_db(UAContext *ua)
                              ua->catalog->db_user,
                              ua->catalog->db_password, ua->catalog->db_address,
                              ua->catalog->db_port, ua->catalog->db_socket,
+                             ua->catalog->db_ssl_key, ua->catalog->db_ssl_cert,
+                             ua->catalog->db_ssl_ca, ua->catalog->db_ssl_capath,
+                             ua->catalog->db_ssl_cipher,
                              mult_db_conn, ua->catalog->disable_batch_insert); 
    if (!ua->db || !db_open_database(ua->jcr, ua->db)) {
       ua->error_msg(_("Could not open catalog database \"%s\".\n"),