mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Remove stderr spam when using salt-cloud with libvirt
Install error handler and redirect stderr output to debug log.
This commit is contained in:
parent
47cd8723c6
commit
9aecf5f847
1 changed files with 12 additions and 3 deletions
|
@ -82,9 +82,6 @@ from salt.exceptions import (
|
|||
SaltCloudSystemExit
|
||||
)
|
||||
|
||||
# Get logging started
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
VIRT_STATE_NAME_MAP = {0: 'running',
|
||||
1: 'running',
|
||||
2: 'running',
|
||||
|
@ -99,6 +96,18 @@ IP_LEARNING_XML = """<filterref filter='clean-traffic'>
|
|||
|
||||
__virtualname__ = 'libvirt'
|
||||
|
||||
# Set up logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def libvirtErrorHandler(ctx, error):
|
||||
'''
|
||||
Redirect stderr prints from libvirt to salt logging.
|
||||
'''
|
||||
log.debug("libvirt error {0}".format(error))
|
||||
|
||||
|
||||
if HAS_LIBVIRT:
|
||||
libvirt.registerErrorHandler(f=libvirtErrorHandler, ctx=None)
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue