def with_ephemeral_vagrant_box(images=None, verbose=False):
if not images:<EOL><INDENT>images = []<EOL><DEDENT>def decorator(func):<EOL><INDENT>def wrapper(*args, **kwargs):<EOL><INDENT>for image in images:<EOL><INDENT>vagrant_up(image=image)<EOL>user, ip, port, pkey = vagrant_ssh_config()<EOL>hs = build_host_string(user, ip, port)<EOL>if verbose:<EOL><INDENT>fabric_flags = show('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>fabric_flags = hide('<STR_LIT>')<EOL><DEDENT>with settings(fabric_flags,<EOL>host_string=hs,<EOL>key_filename=pkey,<EOL>disable_known_hosts=True):<EOL><INDENT>try:<EOL><INDENT>print("<STR_LIT>" % (<EOL>func.func_name, image))<EOL>func(*args, **kwargs)<EOL>vagrant_destroy()<EOL><DEDENT>except:<EOL><INDENT>vagrant_destroy()<EOL>raise<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
A decorator that creates ephemeral vagrant instances, executes the
wrapped function and destroys the vagrant instance.

takes a list of vagrants images, and executes the wrapped function for each
one of those images.

params:
    list images: array containing a list of vagrant images
    bool verbose: print out debug information