[libvirt-ci PATCH 03/13] lcitool: Prefer tempfile's native wrappers over low level primitives

Andrea Bolognani abologna at redhat.com
Mon Apr 27 14:42:46 UTC 2020

On Wed, 2020-04-22 at 15:28 +0200, Erik Skultety wrote:
> Rather than requiring shutil module to get rid of the temporary
> directory we're creating for virt-install, let's use the
> TemporaryDirectory method instead which returns a file-like object which
> can be used to clean up the standard Python way.
> Although the internal exit handlers will take care of closing the
> temporary directories (and thus removing their contents) automatically,
> let's be explicit anyway and use the 'finally' clause to clean these up
> on both success and failure.
> Signed-off-by: Erik Skultety <eskultet at redhat.com>
> ---
>  guests/lcitool | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Reviewed-by: Andrea Bolognani <abologna at redhat.com>

Andrea Bolognani / Red Hat / Virtualization

More information about the libvir-list mailing list