'Generates a controle file from a template'

def _generate_control_file(self):

    custom_job_cfg = self._generate_job_config()
    input_file = self.command_line_options.control_file
    logging.debug(('Generating    control    file    from    template:    %s' % input_file))
    template = string.Template(open(input_file).read())
    (output_fd, path) = tempfile.mkstemp(prefix='atest_control_', dir='/tmp')
    logging.debug(('Generated    control    file    to    be    saved    at:    %s' % path))
    parameters_dict = {'custom_job_cfg': custom_job_cfg}
    control_file_text = template.substitute(parameters_dict)
    os.write(output_fd, control_file_text)
    os.close(output_fd)
    return path
