Skip to content

Allow cta-objectstore-dump-object tool to print JSON-only output

At the moment, the cta-objectstore-dump-object does not print its output in fully-compliant JSON.

This makes it not possible to use it directly with tools such as jq.

Example:

[root@ctaproductionfrontend11 ~]# cta-objectstore-dump-object RepackIndex-cta-objectstore-create-missing-repack-index-ctaproductionfrontend11.cern.ch-2800352-20250411-12:46:34-0-0
Object store path: rados://cta-production@tapecta:cta-production
Object name: RepackIndex-cta-objectstore-create-missing-repack-index-ctaproductionfrontend11.cern.ch-2800352-20250411-12:46:34-0-0
Header dump:
{
 "type": "RepackIndex_t",
 "version": "0",
 "owner": "root",
 "backupowner": "root",
 "payload": "ovQFZILuBQZJMDQ0MDbS7gVWUmVwYWNrUmVxdWVzdC1Gcm9udGVuZC1jdGFwcm9kdWN0aW9uZnJvbnRlbmQxMS5jZXJuLmNoLTE5MjMwMDAtMjAyNTA1MTYtMDk6Mzg6NTQtMC0yMjii9AVkgu4FBkkwMzQ4MtLuBVZSZXBhY2tSZXF1ZXN0LUZyb250ZW5kLWN0YXByb2R1Y3Rpb25mcm9udGVuZDExLmNlcm4uY2gtMTkyMzAwMC0yMDI1MDUxNi0wOTozODo1NC0wLTIyOaL0BWSC7gUGSTA0NDA50u4FVlJlcGFja1JlcXVlc3QtRnJvbnRlbmQtY3RhcHJvZHVjdGlvbmZyb250ZW5kMTEuY2Vybi5jaC0xOTIzMDAwLTIwMjUwNTE2LTA5OjM4OjU0LTAtMjMz"
}
Body dump:
{
 "repackrequestpointers": [
  {
   "vid": "I04406",
   "address": "RepackRequest-Frontend-ctaproductionfrontend11.cern.ch-1923000-20250516-09:38:54-0-228"
  },
  {
   "vid": "I03482",
   "address": "RepackRequest-Frontend-ctaproductionfrontend11.cern.ch-1923000-20250516-09:38:54-0-229"
  },
  {
   "vid": "I04409",
   "address": "RepackRequest-Frontend-ctaproductionfrontend11.cern.ch-1923000-20250516-09:38:54-0-233"
  }
 ]
}

We could do a few things... For example:

  • Allow the body and header to be printed individually in JSON.
  • Simply wrap the entire output above in JSON format.
    • The headers Object store path:, Object name:, Header dump:, Body dump: would become keys in a larger JSON object that includes the same output.