mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Added __virtual__ and __virtualname__ to inotify beacon module
This commit is contained in:
parent
b777d3cba1
commit
2f7376ad6b
@ -3,10 +3,22 @@ Watch files and translate the changes into salt events
|
||||
'''
|
||||
# Import python libs
|
||||
import collections
|
||||
# Import third party libs
|
||||
import pyinotify
|
||||
|
||||
DEFAULT_MASK = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY
|
||||
# Import third party libs
|
||||
try:
|
||||
import pyinotify
|
||||
HAS_PYINOTIFY = True
|
||||
DEFAULT_MASK = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY
|
||||
except ImportError:
|
||||
HAS_PYINOTIFY = False
|
||||
DEFAULT_MASK = None
|
||||
|
||||
__virtualname__ = 'inotify'
|
||||
|
||||
def __virtual__():
|
||||
if HAS_PYINOTIFY:
|
||||
return __virtualname__
|
||||
return False
|
||||
|
||||
|
||||
def _enqueue(revent):
|
||||
@ -27,6 +39,7 @@ def _get_notifier():
|
||||
__context__['inotify.notifier'] = pyinotify.Notifier(wm, _enqueue)
|
||||
return __context__['inotify.notifier']
|
||||
|
||||
|
||||
def beacon(config):
|
||||
'''
|
||||
Watch the configured files
|
||||
|
Loading…
Reference in New Issue
Block a user