def _gluster_xml(cmd):
 if (_get_minor_version() < 6):
  result = __salt__['cmd.run']('script -q -c "gluster --xml --mode=script"', stdin='{0}\n\x04'.format(cmd))
 else:
  result = __salt__['cmd.run']('gluster --xml --mode=script', stdin='{0}\n'.format(cmd))
 try:
  root = ET.fromstring(_gluster_output_cleanup(result))
 except ET.ParseError:
  raise CommandExecutionError('\n'.join(result.splitlines()[:(-1)]))
 if _gluster_ok(root):
  output = root.find('output')
  if (output is not None):
   log.info('Gluster call "{0}" succeeded: {1}'.format(cmd, root.find('output').text))
  else:
   log.info('Gluster call "{0}" succeeded'.format(cmd))
 else:
  log.error('Failed gluster call: {0}: {1}'.format(cmd, root.find('opErrstr').text))
 return root

def _gluster_xml ( cmd ) : if ( _get_minor_version ( ) < 6 ) : result = __salt__ [ 'cmd.run' ] ( 'script -q -c "gluster --xml --mode=script"' , stdin = '{0}\n\x04' . format ( cmd ) ) else : result = __salt__ [ 'cmd.run' ] ( 'gluster --xml --mode=script' , stdin = '{0}\n' . format ( cmd ) ) try : root = ET . fromstring ( _gluster_output_cleanup ( result ) ) except ET . ParseError : raise CommandExecutionError ( '\n' . join ( result . splitlines ( ) [ : ( - 1 ) ] ) ) if _gluster_ok ( root ) : output = root . find ( 'output' ) if ( output is not None ) : log . info ( 'Gluster call "{0}" succeeded: {1}' . format ( cmd , root . find ( 'output' ) . text ) ) else : log . info ( 'Gluster call "{0}" succeeded' . format ( cmd ) ) else : log . error ( 'Failed gluster call: {0}: {1}' . format ( cmd , root . find ( 'opErrstr' ) . text ) ) return root
perform a gluster --xml command and log result .