def get_policy(name):
 ret = {}
 cmd = __execute_kadmin('get_policy {0}'.format(name))
 if ((cmd['retcode'] != 0) or cmd['stderr']):
  ret['comment'] = cmd['stderr'].splitlines()[(-1)]
  ret['result'] = False
  return ret
 for i in cmd['stdout'].splitlines()[1:]:
  (prop, val) = i.split(':', 1)
  ret[prop] = val
 return ret

def get_policy ( name ) : ret = { } cmd = __execute_kadmin ( 'get_policy {0}' . format ( name ) ) if ( ( cmd [ 'retcode' ] != 0 ) or cmd [ 'stderr' ] ) : ret [ 'comment' ] = cmd [ 'stderr' ] . splitlines ( ) [ ( - 1 ) ] ret [ 'result' ] = False return ret for i in cmd [ 'stdout' ] . splitlines ( ) [ 1 : ] : ( prop , val ) = i . split ( ':' , 1 ) ret [ prop ] = val return ret
check to see if policy exists .