def getgoal(path, opts=None):
 cmd = 'mfsgetgoal'
 ret = {}
 if opts:
  cmd += (' -' + opts)
 else:
  opts = ''
 cmd += (' ' + path)
 out = __salt__['cmd.run_all'](cmd, python_shell=False)
 output = out['stdout'].splitlines()
 if ('r' not in opts):
  goal = output[0].split(': ')
  ret = {'goal': goal[1]}
 else:
  for line in output:
   if (not line):
    continue
   if (path in line):
    continue
   comps = line.split()
   keytext = (comps[0] + ' with goal')
   if (keytext not in ret):
    ret[keytext] = {}
   ret[keytext][comps[3]] = comps[5]
 return ret

def getgoal ( path , opts = None ) : cmd = 'mfsgetgoal' ret = { } if opts : cmd += ( ' -' + opts ) else : opts = '' cmd += ( ' ' + path ) out = __salt__ [ 'cmd.run_all' ] ( cmd , python_shell = False ) output = out [ 'stdout' ] . splitlines ( ) if ( 'r' not in opts ) : goal = output [ 0 ] . split ( ': ' ) ret = { 'goal' : goal [ 1 ] } else : for line in output : if ( not line ) : continue if ( path in line ) : continue comps = line . split ( ) keytext = ( comps [ 0 ] + ' with goal' ) if ( keytext not in ret ) : ret [ keytext ] = { } ret [ keytext ] [ comps [ 3 ] ] = comps [ 5 ] return ret
return goal(s) for a file or directory cli example: .