mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixes a regression with old versions of python-psutil.
This commit is contained in:
parent
5ff5e97598
commit
fb0432fd21
2 changed files with 4 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue