aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-04-14 12:47:32 +0200
committerMarco Capitani <m.capitani@nextworks.it>2017-04-14 12:47:32 +0200
commitfad736c4c6a12e3f73f5d4e100f3f62d7f1467ae (patch)
treed2dfbbd418e2b9db8ba577f245d9c42f7638fe4d
parentfbbc602d9efd9f88ce35b09c02f1226881c32bfb (diff)
downloadrumba-fad736c4c6a12e3f73f5d4e100f3f62d7f1467ae.tar.gz
rumba-fad736c4c6a12e3f73f5d4e100f3f62d7f1467ae.zip
IRATI: moved generated conf files in IRATI_conf folder
-rw-r--r--rumba/prototypes/irati.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py
index dd7086e..edc49c6 100644
--- a/rumba/prototypes/irati.py
+++ b/rumba/prototypes/irati.py
@@ -53,6 +53,16 @@ class Experiment(mod.Experiment):
else:
self.sudo = self.real_sudo
+ self._conf_dir = os.path.join(os.getcwd(), 'IRATI_conf')
+ try:
+ os.mkdir(self._conf_dir)
+ except OSError:
+ # Already there, nothing to do
+ pass
+
+ def conf_dir(self, path):
+ return os.path.join(self._conf_dir, path)
+
def setup(self):
"""Installs IRATI on the vms."""
setup_irati = False
@@ -104,6 +114,8 @@ class Experiment(mod.Experiment):
[gen_files_conf, 'normal.%(name)s.*.dif' % {'name': name}])
dir_path = os.path.dirname(os.path.abspath(__file__))
gen_files_bin = 'enroll.py'
+ gen_files_conf_full = \
+ ' '.join([self.conf_dir(x) for x in gen_files_conf.split()])
gen_files_bin_full = os.path.join(dir_path, 'enroll.py')
ipcm_components = ['scripting', 'console']
@@ -111,7 +123,7 @@ class Experiment(mod.Experiment):
ipcm_components.append('mad')
ipcm_components = ', '.join(ipcm_components)
- gen_files = ' '.join([gen_files_conf, gen_files_bin_full])
+ gen_files = ' '.join([gen_files_conf_full, gen_files_bin_full])
sshopts = ('-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
' -o IdentityFile=%s'
@@ -270,11 +282,11 @@ class Experiment(mod.Experiment):
"difName": shim.name
})
- template_file_name = 'shimeth.%s.%s.dif' \
- % (node.name, shim.name)
+ template_file_name = self.conf_dir('shimeth.%s.%s.dif'
+ % (node.name, shim.name))
ipcmconf["difConfigurations"].append({
"name": shim.name,
- "template": template_file_name
+ "template": os.path.basename(template_file_name)
})
fout = open(template_file_name, 'w')
@@ -334,7 +346,7 @@ class Experiment(mod.Experiment):
difconfs[dif.name][node_name], path, ps, parms=[])
# Dump the DIF Allocator map
- with open('da.map', 'w') as da_map_file:
+ with open(self.conf_dir('da.map'), 'w') as da_map_file:
json.dump(irati_templates.da_map_base,
da_map_file,
indent=4,
@@ -342,7 +354,8 @@ class Experiment(mod.Experiment):
for node in self.nodes:
# Dump the IPCM configuration files
- with open('%s.ipcm.conf' % (node.name,), 'w') as node_file:
+ with open(self.conf_dir('%s.ipcm.conf'
+ % (node.name,)), 'w') as node_file:
json.dump(ipcmconfs[node.name],
node_file,
indent=4,
@@ -353,7 +366,8 @@ class Experiment(mod.Experiment):
if dif_conf:
# Dump the normal DIF configuration files
for node in dif.members:
- with open('normal.%s.%s.dif' % (node.name, dif.name), 'w') \
+ with open(self.conf_dir('normal.%s.%s.dif'
+ % (node.name, dif.name)), 'w') \
as dif_conf_file:
json.dump(dif_conf[node.name],
dif_conf_file,