pycontribs / python-vagrant

Python bindings for interacting with Vagrant virtual machines.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

err_cm doesn't execute code after yielding

retr0h opened this issue · comments

wow never gets printed.

@contextlib.contextmanager
def stderr_cm():
    print 'hi'
    yield
    print 'wow'


v = vagrant.Vagrant(err_cm=stderr_cm)
try:
    v.up(provision=False,)
except:
    pass
[jodewey:~/git/molecule_2] [molecule2-env-2.7.13] master(+30/-11)+* ± python foo.py
hi
There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
an invalid or undefined variable.

Path: /Users/jodewey/git/molecule_2/Vagrantfile
Line number: 0
Message: undefined local variable or method `foo'