def process_user_data( fn, vars = [] ):
    """
        Given filename of user-data file and a list of environment
        variable names, replaces @@...@@ tokens with the values of the
        environment variables.  Returns the user-data string on success
        raises exception on failure.
    """
    # Get user_data string.
    buf = read_user_data( fn )
    for e in vars:
        if not e in environ:
            raise SpinupError( "Missing environment variable {}!".format( e ) )
        buf = template_token_subst( buf, '@@'+e+'@@', environ[e] )
    return buf