Skip to content

Commit

Permalink
dummed down get_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-moody authored and georgejhunt committed Nov 22, 2016
1 parent fc344b4 commit b02d3e8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions roles/xsce-admin/files/cmdsrv/xsce-cmdsrv
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,35 @@ def get_mem_info(cmd_info):
json_outp = json_array("system_memory", outp)
return (json_outp)

def get_space_avail(cmd_info):
space_avail = {}
space_avail['library_on_root'] = True
libr_attr = {}
cmd = "/usr/bin/df -m"
cmd_args = shlex.split(cmd)
outp = subprocess.check_output(cmd_args)
dev_arr = outp.split('\n')
for dev_str in dev_arr[1:-1]:
dev_attr = dev_str.split()
if dev_attr[5] == '/':
space_avail['root'] = parse_df_str(dev_str)
if dev_attr[5] == '/library':
space_avail['library'] = parse_df_str(dev_str)
space_avail['library_on_root'] = False
if ('root' in space_avail):
resp = json.dumps(space_avail)
else:
resp = cmd_error(cmd_info['cmd'], "No root partition found")
return (resp)

def get_storage_info_lite(cmd_info):
outp = subprocess.check_output(["/usr/bin/df", "-lh"])
json_outp = json_array("system_fs", outp)
return (json_outp)

# the following does not work on lvm or raid or iso usb drives
# we wil fix later

def get_storage_info(cmd_info):
system_storage = []
cmd = "lsblk -aP -o NAME,FSTYPE,TYPE,SIZE,MOUNTPOINT,LABEL,UUID,PARTLABEL,PARTUUID,MODEL"
Expand Down

0 comments on commit b02d3e8

Please sign in to comment.