def fileinfo(path):
 cmd = ('mfsfileinfo ' + path)
 ret = {}
 chunknum = ''
 out = __salt__['cmd.run_all'](cmd, python_shell=False)
 output = out['stdout'].splitlines()
 for line in output:
  if (not line):
   continue
  if ('/' in line):
   comps = line.split('/')
   chunknum = comps[0].strip().split(':')
   meta = comps[1].strip().split(' ')
   chunk = chunknum[0].replace('chunk ', '')
   loc = chunknum[1].strip()
   id_ = meta[0].replace('(id:', '')
   ver = meta[1].replace(')', '').replace('ver:', '')
   ret[chunknum[0]] = {'chunk': chunk, 'loc': loc, 'id': id_, 'ver': ver}
  if ('copy' in line):
   copyinfo = line.strip().split(':')
   ret[chunknum[0]][copyinfo[0]] = {'copy': copyinfo[0].replace('copy ', ''), 'ip': copyinfo[1].strip(), 'port': copyinfo[2]}
 return ret

def fileinfo ( path ) : cmd = ( 'mfsfileinfo ' + path ) ret = { } chunknum = '' out = __salt__ [ 'cmd.run_all' ] ( cmd , python_shell = False ) output = out [ 'stdout' ] . splitlines ( ) for line in output : if ( not line ) : continue if ( '/' in line ) : comps = line . split ( '/' ) chunknum = comps [ 0 ] . strip ( ) . split ( ':' ) meta = comps [ 1 ] . strip ( ) . split ( ' ' ) chunk = chunknum [ 0 ] . replace ( 'chunk ' , '' ) loc = chunknum [ 1 ] . strip ( ) id_ = meta [ 0 ] . replace ( '(id:' , '' ) ver = meta [ 1 ] . replace ( ')' , '' ) . replace ( 'ver:' , '' ) ret [ chunknum [ 0 ] ] = { 'chunk' : chunk , 'loc' : loc , 'id' : id_ , 'ver' : ver } if ( 'copy' in line ) : copyinfo = line . strip ( ) . split ( ':' ) ret [ chunknum [ 0 ] ] [ copyinfo [ 0 ] ] = { 'copy' : copyinfo [ 0 ] . replace ( 'copy ' , '' ) , 'ip' : copyinfo [ 1 ] . strip ( ) , 'port' : copyinfo [ 2 ] } return ret
return information on a file located on the moose cli example: .