Minor: remove unneded logging

This commit is contained in:
Dmitry Kuzmenko 2019-08-19 22:53:34 +03:00
parent 314bbb3a74
commit a5cccdfc3e
No known key found for this signature in database
GPG Key ID: 4C7CAD30C95651DA
3 changed files with 4 additions and 21 deletions

View File

@ -29,12 +29,8 @@ from salt.ext.six.moves import map
# pylint: enable=import-error # pylint: enable=import-error
# Import third party libs # Import third party libs
log = logging.getLogger(__name__)
try: try:
log.info('IMPORTING pyinotify')
import pyinotify import pyinotify
log.info('IMPORTED pyinotify')
HAS_PYINOTIFY = True HAS_PYINOTIFY = True
DEFAULT_MASK = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY DEFAULT_MASK = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY
MASKS = {} MASKS = {}
@ -48,13 +44,12 @@ except ImportError:
__virtualname__ = 'inotify' __virtualname__ = 'inotify'
log = logging.getLogger(__name__)
def __virtual__(): def __virtual__():
log.info('VIRTUAL: %s', HAS_PYINOTIFY)
if HAS_PYINOTIFY: if HAS_PYINOTIFY:
log.info('VIRTUAL: %s', __virtualname__)
return __virtualname__ return __virtualname__
log.info('VIRTUAL: %s', False)
return False return False

View File

@ -101,18 +101,15 @@ def list_available(return_yaml=True, **kwargs):
salt '*' beacons.list_available salt '*' beacons.list_available
''' '''
log.info('BEACONS.LIST_AVAILABLE started')
beacons = None beacons = None
try: try:
eventer = salt.utils.event.get_event('minion', opts=__opts__, listen=True) eventer = salt.utils.event.get_event('minion', opts=__opts__, listen=True)
res = __salt__['event.fire']({'func': 'list_available'}, 'manage_beacons') res = __salt__['event.fire']({'func': 'list_available'}, 'manage_beacons')
if res: if res:
log.info('BEACONS.LIST_AVAILABLE waiting response with timeout %s', default_event_wait)
event_ret = eventer.get_event( event_ret = eventer.get_event(
tag='/salt/minion/minion_beacons_list_available_complete', tag='/salt/minion/minion_beacons_list_available_complete',
wait=kwargs.get('timeout', default_event_wait)) wait=kwargs.get('timeout', default_event_wait))
log.info('BEACONS.LIST_AVAILABLE event_ret: %s', event_ret)
if event_ret and event_ret['complete']: if event_ret and event_ret['complete']:
beacons = event_ret['beacons'] beacons = event_ret['beacons']
except KeyError: except KeyError:
@ -120,22 +117,16 @@ def list_available(return_yaml=True, **kwargs):
ret = {} ret = {}
ret['result'] = False ret['result'] = False
ret['comment'] = 'Event module not available. Beacon add failed.' ret['comment'] = 'Event module not available. Beacon add failed.'
log.info('BEACONS.LIST_AVAILABLE returning %s', ret)
return ret return ret
if beacons: if beacons:
if return_yaml: if return_yaml:
tmp = {'beacons': beacons} tmp = {'beacons': beacons}
ret = salt.utils.yaml.safe_dump(tmp, default_flow_style=False) return salt.utils.yaml.safe_dump(tmp, default_flow_style=False)
log.info('BEACONS.LIST_AVAILABLE returning %s', ret)
return ret
else: else:
log.info('BEACONS.LIST_AVAILABLE returning %s', beacons)
return beacons return beacons
else: else:
ret = {'beacons': {}} return {'beacons': {}}
log.info('BEACONS.LIST_AVAILABLE returning %s', ret)
return ret
def add(name, beacon_data, **kwargs): def add(name, beacon_data, **kwargs):

View File

@ -14,9 +14,6 @@ from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase from tests.support.case import ModuleCase
from tests.support.unit import skipIf from tests.support.unit import skipIf
import logging
log = logging.getLogger(__name__)
class BeaconsAddDeleteTest(ModuleCase): class BeaconsAddDeleteTest(ModuleCase):
''' '''