]> git.ipfire.org Git - people/ms/nitsi.git/commit
Refactoring of Disk class
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 May 2018 13:28:49 +0000 (14:28 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 May 2018 13:28:49 +0000 (14:28 +0100)
commitd24c7017819b5b80a1004e8ea242a773c79d505d
tree2c2325b9551dd0c71f45785fca7b51a3828cfc7e
parentdc21d887c0a88b9fa30a3e78e5e47c77b6957ec6
Refactoring of Disk class

This is an example of how the code could take advantage of
Python contexts. The with statement will open the context
and when it is left (either normally or because of an exception),
the __exit__() method is called and can be used to cleanup.

Cleaning up is in this case umounting the image file, but could
also be used to shutdown and destroy a virtual machine or
network.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/nitsi/disk.py
src/nitsi/machine.py