From 9c8a08090801cd25a8dd02a889efed610c946bf0 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Tue, 16 Mar 2021 13:01:31 -0600
Subject: [PATCH] Make file name a variable instead of text everywhere.

No functionality change.

Bug 11099
---
 .../job_container/tmpfs/job_container_tmpfs.c  |  4 ++--
 src/plugins/job_container/tmpfs/read_nsconf.c  | 18 +++++++++++-------
 src/plugins/job_container/tmpfs/read_nsconf.h  |  2 ++
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/plugins/job_container/tmpfs/job_container_tmpfs.c b/src/plugins/job_container/tmpfs/job_container_tmpfs.c
index 7421b1dcc81..5e5d5cf77ef 100644
--- a/src/plugins/job_container/tmpfs/job_container_tmpfs.c
+++ b/src/plugins/job_container/tmpfs/job_container_tmpfs.c
@@ -80,8 +80,8 @@ static int _create_paths(uint32_t job_id,
 	ns_conf = get_slurm_ns_conf();
 
 	if (!ns_conf) {
-		error("%s: Configuration not read correctly: did namespace.conf not exist?",
-			__func__);
+		error("%s: Configuration not read correctly: did %s not exist?",
+		      __func__, tmpfs_conf_file);
 		return SLURM_ERROR;
 	}
 
diff --git a/src/plugins/job_container/tmpfs/read_nsconf.c b/src/plugins/job_container/tmpfs/read_nsconf.c
index b0c9b177388..69ab04f11d8 100644
--- a/src/plugins/job_container/tmpfs/read_nsconf.c
+++ b/src/plugins/job_container/tmpfs/read_nsconf.c
@@ -48,6 +48,8 @@
 
 #include "read_nsconf.h"
 
+char *tmpfs_conf_file = "namespace.conf";
+
 static slurm_ns_conf_t slurm_ns_conf;
 static bool slurm_ns_conf_inited = false;
 static bool auto_basepath_set = false;
@@ -75,7 +77,8 @@ static int _parse_ns_conf_internal(void **dest, slurm_parser_enum_t type,
 	if (value)
 		slurm_ns_conf.basepath = xstrdup(value);
 	else if (!s_p_get_string(&slurm_ns_conf.basepath, "BasePath", tbl)) {
-		fatal("empty basepath detected, please verify namespace.conf is correct");
+		fatal("empty basepath detected, please verify %s is correct",
+		      tmpfs_conf_file);
 		rc = 0;
 		goto end_it;
 	}
@@ -137,19 +140,19 @@ static int _read_slurm_ns_conf(void)
 
 	xassert(conf->node_name);
 
-	conf_path = get_extra_conf_path("namespace.conf");
+	conf_path = get_extra_conf_path(tmpfs_conf_file);
 
 	if ((!conf_path) || (stat(conf_path, &buf) == -1)) {
-		error("No namespace.conf file");
+		error("No %s file", tmpfs_conf_file);
 		rc = ENOENT;
 		goto end_it;
 	}
 
-	debug("Reading namespace.conf file %s", conf_path);
+	debug("Reading %s file %s", tmpfs_conf_file, conf_path);
 	tbl = s_p_hashtbl_create(options);
 	if (s_p_parse_file(tbl, NULL, conf_path, false) == SLURM_ERROR) {
-		fatal("Could not open/read/parse namespace.conf file %s",
-		      conf_path);
+		fatal("Could not open/read/parse %s file %s",
+		      tmpfs_conf_file, conf_path);
 		goto end_it;
 	}
 
@@ -159,7 +162,8 @@ static int _read_slurm_ns_conf(void)
 				"AutoBasePath", tbl);
 
 	if (!slurm_ns_conf.basepath) {
-		error("Configuration for this node not found in namespace.conf");
+		error("Configuration for this node not found in %s",
+		      tmpfs_conf_file);
 		rc = SLURM_ERROR;
 	}
 
diff --git a/src/plugins/job_container/tmpfs/read_nsconf.h b/src/plugins/job_container/tmpfs/read_nsconf.h
index 0ba8408565a..1ee690e0501 100644
--- a/src/plugins/job_container/tmpfs/read_nsconf.h
+++ b/src/plugins/job_container/tmpfs/read_nsconf.h
@@ -50,6 +50,8 @@ typedef struct slurm_ns_conf {
 	char *initscript;
 } slurm_ns_conf_t;
 
+extern char *tmpfs_conf_file;
+
 extern slurm_ns_conf_t *get_slurm_ns_conf(void);
 
 extern void free_ns_conf(void);
-- 
GitLab