]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Allow to list objects by category
authorEric Bollengier <eric@baculasystems.com>
Thu, 15 Oct 2020 09:54:18 +0000 (11:54 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:57 +0000 (09:02 +0100)
bacula/src/cats/sql_list.c
bacula/src/dird/ua_cmds.c
bacula/src/dird/ua_output.c

index d5d3f075794a3653556138bdd5feae96f73c895c..8354fbbdfec07aabdb1ddd2b542ce6b9f8ea12ed 100644 (file)
@@ -182,6 +182,12 @@ void BDB::bdb_list_plugin_objects(JCR *jcr, OBJECT_DBR *obj_r, DB_LIST_HANDLER *
       append_filter(where.addr(), tmp.c_str());
    }
 
+   if (obj_r->ObjectCategory[0] != 0) {
+      bdb_escape_string(jcr, esc.c_str(), obj_r->ObjectCategory, strlen(obj_r->ObjectCategory));
+      Mmsg(tmp, " Object.ObjectCategory='%s'", esc.c_str());
+      append_filter(where.addr(), tmp.c_str());
+   }
+
    if (obj_r->ObjectId != 0) {
       Mmsg(tmp, " Object.ObjectId=%d", obj_r->ObjectId);
       append_filter(where.addr(), tmp.c_str());
index bb74722c808cd8a386a43f140ffeb483d12b75e1..f2f4959dd0450e70b86d267f5c2aa168325037de 100644 (file)
@@ -135,6 +135,7 @@ static struct cmdstruct commands[] = {                                      /* C
        "\tjoblog jobid=<nn> | pluginrestoreconf jobid=<nn> restoreobjectid=<nn> | snapshot | \n"
        "\tfilemedia jobid=<nn> fileindex=<mm> | clients\n"
        "\tevents [type=<str> | limit=<int> | order=<asc|desc> | days=<int> | start=<time-specification> | end=<time-specification> ]\n"
+       "\tobjects [jobid=<jobid> client=<cli> type=<str> | category=<str> | limit=<int> | order=<asc|desc> ]\n"
       ), false},
 
  { NT_("llist"),      llist_cmd,     _("Full or long list like list command"),
@@ -142,7 +143,8 @@ static struct cmdstruct commands[] = {                                      /* C
        "\tjobtotals | pools | volume | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn> |\n"
        "\tjoblog jobid=<nn> | pluginrestoreconf jobid=<nn> restoreobjectid=<nn> | snapshot |\n"
        "\tfilemedia jobid=<nn> fileindex=<mm> | clients\n"
-      "\tobject [jobid=<jobid> client=<cli> type=<name>  [order=<asc/desc>] [limit=<n>\n"), false},
+       "\tevents [type=<str> | limit=<int> | order=<asc|desc> | days=<int> | start=<time-specification> | end=<time-specification> ]\n"
+       "\tobject [jobid=<jobid> client=<cli> type=<name> category=<str> order=<asc/desc> limit=<n>\n"), false},
 
  { NT_("messages"),   messagescmd,   _("Display pending messages"),   NT_(""),    false},
  { NT_("memory"),     memory_cmd,    _("Print current memory usage"), NT_(""),    true},
index 28e1a923b9565582bbb9c6896cd6066a8a0d1b9c..0ae7ce06db639038c97b604e9e4173ba1eff77b8 100644 (file)
@@ -698,6 +698,9 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
             } else if (strcasecmp(ua->argk[j], NT_("type")) == 0) {
                bstrncpy(obj_r.ObjectType, ua->argv[j], sizeof(obj_r.ObjectType));
 
+            } else if (strcasecmp(ua->argk[j], NT_("category")) == 0) {
+               bstrncpy(obj_r.ObjectCategory, ua->argv[j], sizeof(obj_r.ObjectCategory));
+
             } else if (strcasecmp(ua->argk[j], NT_("limit")) == 0 && ua->argv[j]) {
                obj_r.limit = atoi(ua->argv[j]);