Fixes a regression with old versions of python-psutil.

This commit is contained in:
Michael Lustfield 2017-01-24 23:00:09 -06:00
parent 5ff5e97598
commit fb0432fd21
2 changed files with 4 additions and 1 deletions

View file

@ -76,7 +76,7 @@ def _gather_buffer_space():
Result is in bytes.
'''
if HAS_PSUTIL:
if HAS_PSUTIL and psutil.version_info >= (0, 6, 0):
# Oh good, we have psutil. This will be quick.
total_mem = psutil.virtual_memory().total
else:

View file

@ -496,6 +496,9 @@ def total_physical_memory():
salt '*' ps.total_physical_memory
'''
if psutil.version_info < (0, 6, 0):
msg = 'virtual_memory is only available in psutil 0.6.0 or greater'
raise CommandExecutionError(msg)
try:
return psutil.virtual_memory().total
except AttributeError: