fill_config.py: add NET_DIR variable

Allow all config files to use a new NET_DIR variable, which always
points to the network folder with the generated configs. We can use
this to place all temporary files (sockets, pid files, ...) there.

Change-Id: Idbdf478ebb9f0b2fcd860e5eff3c414a0a459561
This commit is contained in:
Oliver Smith 2018-10-22 11:59:55 +02:00 committed by Neels Hofmeyr
parent eee671b15d
commit fd7446fcab
2 changed files with 6 additions and 3 deletions

View File

@ -71,7 +71,8 @@ templates. See e.g. config_2g3g.
The fill_config.py script helps to fill the templates with the config values. Simply
invoke fill_config.py with a dir argument (templates dir) and a file argument (specific
config values).
config values). The dir argument can be used in the templates with ${NET_DIR},
temporary files (sockets etc.) should be placed inside this folder.
If one or both are omitted, the script tries to re-use the most recent paths,
they were stored in local files '.last_config' and '.last_templates'.

View File

@ -50,8 +50,9 @@ if not local_config_file or not os.path.isfile(local_config_file):
local_config_file = os.path.realpath(local_config_file)
tmpl_dir = os.path.realpath(tmpl_dir)
net_dir = os.path.realpath(".")
print('using config file %r\non templates %r' % (local_config_file, tmpl_dir))
print('using config file %r\non templates %r\nwith NET_DIR %r' % (local_config_file, tmpl_dir, net_dir))
with open(LAST_LOCAL_CONFIG_FILE, 'w') as last_file:
last_file.write(local_config_file)
@ -59,7 +60,8 @@ with open(LAST_TMPL_DIR, 'w') as last_file:
last_file.write(tmpl_dir)
# read in variable values from config file
local_config = {}
# NET_DIR is the folder where fill_config.py was started
local_config = {"NET_DIR": net_dir}
line_nr = 0
for line in open(local_config_file):