'Create cluster configuration files.'

def _write_config(self, master, user, profile_dir):

    log.info('Writing    IPython    cluster    config    files')
    master.ssh.execute(("rm    -rf    '%s'" % profile_dir))
    master.ssh.execute('ipython    profile    create')
    f = master.ssh.remote_file(('%s/ipcontroller_config.py' % profile_dir))
    ssh_server = '@'.join([user, master.public_dns_name])
    f.write('\n'.join(['c    =    get_config()', ("c.HubFactory.ip='%s'" % master.private_ip_address), ("c.IPControllerApp.ssh_server='%s'" % ssh_server), ("c.Application.log_level    =    '%s'" % self.log_level), '']))
    f.close()
    f = master.ssh.remote_file(('%s/ipengine_config.py' % profile_dir))
    f.write('\n'.join(['c    =    get_config()', 'c.EngineFactory.timeout    =    10', 'c.IPEngineApp.wait_for_url_file    =    30', ("c.Application.log_level    =    '%s'" % self.log_level), '']))
    f.close()
    f = master.ssh.remote_file(('%s/ipython_config.py' % profile_dir))
    f.write('\n'.join(['c    =    get_config()', 'c.EngineFactory.timeout    =    10', 'c.IPEngineApp.wait_for_url_file    =    30', ("c.Application.log_level    =    '%s'" % self.log_level), '']))
    if (self.packer == 'msgpack'):
        f.write('\n'.join(["c.Session.packer='msgpack.packb'", "c.Session.unpacker='msgpack.unpackb'", '']))
    elif (self.packer == 'pickle'):
        f.write('\n'.join(["c.Session.packer='pickle'", '']))
    f.close()
