This commit is contained in:
guange 2019-01-18 19:19:00 +08:00
parent bae393196c
commit 3caeda1461
1 changed files with 5 additions and 5 deletions

View File

@ -39,11 +39,11 @@ def get_platform_info():
#硬盘使用
out = get_execute_out('df -h')
m = re.match(r'\/dev\/vda1\s+?(.+?)G\s+(.+?)G\s+(.+?)G', out)
if m:
info['disk_total'] = m.group(1)
info['disk_used'] = m.group(2)
info['disk_freed'] = m.group(3)
m = re.findall(r'\/dev\/vda1\s+(.+?)G\s+(.+?)G\s+(.+?)G', out)
if len(m)>0:
info['disk_total'] = m[0][0]
info['disk_used'] = m[0][1]
info['disk_freed'] = m[0][2]
return info