old_contents: '''
  Riak Salt Module
  =======================
  
  Author: David Boucha <boucha@gmail.com>
  
  '''
  
  # Import salt libs
  import salt.utils
  
  def __virtual__():
      '''
      Only available on systems with Riak installed.
      '''
      if salt.utils.which('riak'):
          return 'riak'
      return False
  
  
  def start():
      '''
      Start Riak
  
      CLI Example::
  
          salt '*' riak.start
      '''
      return not bool(__salt__['cmd.retcode']('riak start'))
  
  
  def stop():
      '''
      Stop Riak
  
      CLI Example::
  
          salt '*' riak.stop
      '''
      return not bool(__salt__['cmd.retcode']('riak stop'))
  
  
  def cluster_join(riak_user=None, riak_host=None):
      '''
      Join a Riak cluster
      
      CLI Example::
  
          salt '*' riak.cluster_join <user> <host>
      '''
      if not all((riak_user, riak_host)):
          return False
      return not bool(__salt__['cmd.retcode']('riak-admin cluster join {0}@{1}'.format(riak_user, riak_host)))
  
  
  
  def cluster_plan():
      '''
      Review Cluster Plan
      
      CLI Example::
  
          salt '*' riak.cluster_plan
      '''
      return not bool( __salt__['cmd.run']('riak-admin cluster plan'))
  
  
  def cluster_commit():
      '''
      Commit Cluster Changes
      
      CLI Example::
  
          salt '*' riak.cluster_commit
      '''
      return not bool(__salt__['cmd.retcode']('riak-admin cluster commit'))
  
  
  def member_status():
      '''
      Get cluster member status
  
      CLI Example::
  
          salt '*' riak.member_status
      '''
      return __salt__['cmd.run']('riak-admin member-status')
  
new_contents: '''
  Riak Salt Module
  =======================
  
  Author: David Boucha <boucha@gmail.com>
  
  '''
  
  # Import salt libs
  import salt.utils
  
  def __virtual__():
      '''
      Only available on systems with Riak installed.
      '''
      if salt.utils.which('riak'):
          return 'riak'
      return False
  
  
  def start():
      '''
      Start Riak
  
      CLI Example::
  
          salt '*' riak.start
      '''
      return not bool(__salt__['cmd.retcode']('riak start'))
  
  
  def stop():
      '''
      Stop Riak
  
      CLI Example::
  
          salt '*' riak.stop
      '''
      return not bool(__salt__['cmd.retcode']('riak stop'))
  
  
  def cluster_join(riak_user=None, riak_host=None):
      '''
      Join a Riak cluster
      
      CLI Example::
  
          salt '*' riak.cluster_join <user> <host>
      '''
      if not all((riak_user, riak_host)):
          return False
      return not bool(__salt__['cmd.retcode']('riak-admin cluster join {0}@{1}'.format(riak_user, riak_host)))
  
  
  
  def cluster_plan():
      '''
      Review Cluster Plan
      
      CLI Example::
  
          salt '*' riak.cluster_plan
      '''
      return not bool( __salt__['cmd.run']('riak-admin cluster plan'))
  
  
  def cluster_commit():
      '''
      Commit Cluster Changes
      
      CLI Example::
  
          salt '*' riak.cluster_commit
      '''
      return not bool(__salt__['cmd.retcode']('riak-admin cluster commit'))
  
  
  def member_status():
      '''
      Get cluster member status
  
      CLI Example::
  
          salt '*' riak.member_status
      '''
      ret = {'membership': {},
              'summary': {'Valid': 0,
                          'Leaving': 0,
                          'Exiting': 0,
                          'Joining': 0,
                          'Down': 0,
                          }
              }
      cmd = 'riak-admin member-status'
      out = __salt__['cmd.run'](cmd).splitlines()
      for line in out:
          if line.startswith(('=', '-', 'Status')):
              continue
          if '/' in line:
              comps = line.split('/')
              for item in comps:
                  key, val = item.split(':')
                  ret['summary'][key.strip()] = val.strip()
          vals = line.split()
          if len(vals) == 4:
              ret['membership'][vals[3]] = {'Status': vals[0],
                                            'Ring': vals[1],
                                            'Pending': vals[2],
                                            }
      return ret 
  
subject: Return proper data structure from member_status