1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-01 00:21:59 +03:00

examples: Replace sys.exit() with exit()

No need to import sys.

Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
Philipp Hahn
2020-07-28 07:15:55 +02:00
committed by Philipp Hahn
parent f496dc55ee
commit b801ff31fa
10 changed files with 18 additions and 28 deletions

View File

@ -4,7 +4,6 @@ Print information about the domain DOMAIN
"""
import libvirt
import sys
import libxml2
from argparse import ArgumentParser
from typing import Any
@ -37,14 +36,14 @@ try:
conn = libvirt.openReadOnly(None)
except libvirt.libvirtError:
print('Failed to open connection to the hypervisor')
sys.exit(1)
exit(1)
try:
dom = conn.lookupByName(args.domain)
# Annoyiingly, libvirt prints its own error message here
except libvirt.libvirtError:
print("Domain %s is not running" % args.domain)
sys.exit(0)
exit(0)
info = dom.info()
print_section("Domain info")