Whamcloud - gitweb
LU-17358 lprocfs: make job_stats job_id valid yaml 24/53424/2
authorNathaniel Clark <nclark@whamcloud.com>
Tue, 12 Dec 2023 18:05:22 +0000 (13:05 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 20 Dec 2023 02:00:38 +0000 (02:00 +0000)
Fix quoting job_id to account for leading '@' being reserved.

Test-Parameters: trivial
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Change-Id: Ifce3edc9b636db2f059ab9960488972a152d2e7a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53424
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/obdclass/lprocfs_jobstats.c

index 2d40d14..c2d27e2 100644 (file)
@@ -519,6 +519,9 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v)
                                quote = "\"";
                }
        }
+       /* '@' is reserved in YAML, so it cannot start a bare string. */
+       if (escaped[0] == '@')
+               quote = "\"";
 
        seq_printf(p, "- %-16s %s%*s%s\n",
                   "job_id:", quote, joblen, escaped, quote);