mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #27641 from rallytime/gate-psutil-diskusage
Gate the psutil import and add depends doc for diskusage beacon
This commit is contained in:
commit
ccbba8656b
1 changed files with 11 additions and 1 deletions
|
@ -3,17 +3,25 @@
|
|||
Beacon to monitor disk usage.
|
||||
|
||||
.. versionadded:: 2015.5.0
|
||||
|
||||
:depends: python-psutil
|
||||
'''
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
import logging
|
||||
import psutil
|
||||
import re
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
|
||||
# Import Third Party Libs
|
||||
try:
|
||||
import psutil
|
||||
HAS_PSUTIL = True
|
||||
except ImportError:
|
||||
HAS_PSUTIL = False
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__virtualname__ = 'diskusage'
|
||||
|
@ -22,6 +30,8 @@ __virtualname__ = 'diskusage'
|
|||
def __virtual__():
|
||||
if salt.utils.is_windows():
|
||||
return False
|
||||
elif HAS_PSUTIL is False:
|
||||
return False
|
||||
else:
|
||||
return __virtualname__
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue