- if node_type == 'regular':
-
- build_sh_options=""
- if "cramfs" in build_sh_spec:
- type += "_cramfs"
- if "serial" in build_sh_spec:
- build_sh_options += " -s %s"%build_sh_spec['serial']
- if "variant" in build_sh_spec:
- build_sh_options += " -V %s"%build_sh_spec['variant']
-
- for karg in build_sh_spec['kargs']:
- build_sh_options += ' -k "%s"'%karg
-
- log_file="%s.log"%node_image
-
- command = '%s -f "%s" -o "%s" -t "%s" %s &> %s' % (self.BOOTCDBUILD,
- floppy_file,
- node_image,
- type,
- build_sh_options,
- log_file)
- # dummynet node
- elif node_type == 'dummynet':
- # the build script expect the following parameters:
- # the package base directory
- # the working directory
- # the full path of the configuration file
- # the name of the resulting image file
- # the type of the generated image
- # the name of the log file
- command = "%s -b %s -w %s -f %s -o %s -t %s -l %s" \
- % (self.BOOTCDBUILD, self.BOOTCDDIR, self.WORKDIR,
- floppy_file, node_image, type, log_file)
- command = "touch %s %s; echo 'dummynet build script not yet supported'" \
- % (log_file, node_image)
-
- if self.DEBUG:
- print "The build command line is %s" % command
-
- return command
+ if node_type not in [ 'regular', 'reservable' ]:
+ logger.error("GetBootMedium.build_command: unexpected node_type {}".format(node_type))
+ return command, None
+
+ build_sh_options=""
+ if "cramfs" in build_sh_spec:
+ type += "_cramfs"
+ if "serial" in build_sh_spec:
+ build_sh_options += " -s {}".format(build_sh_spec['serial'])
+ if "variant" in build_sh_spec:
+ build_sh_options += " -V {}".format(build_sh_spec['variant'])
+
+ for karg in build_sh_spec['kargs']:
+ build_sh_options += ' -k "{}"'.format(karg)
+
+ import time
+ date = time.strftime('%Y-%m-%d-%H-%M', time.gmtime())
+ if not os.path.isdir(self.LOGDIR):
+ os.makedirs(self.LOGDIR)
+ log_file = "{}/{}-{}.log".format(self.LOGDIR, date, nodename)
+
+ command = '{} -f "{}" -o "{}" -t "{}" {} > {} 2>&1'\
+ .format(self.BOOTCDBUILD,
+ floppy_file,
+ node_image,
+ type,
+ build_sh_options,
+ log_file)
+
+ logger.info("The build command line is {}".format(command))
+
+ return command, log_file