code: def deleteAllGroups(server):
      '''
      Delete all server groups from Spacewalk
      '''
  
      try:
          client, key = _get_session(server)
      except Exception as exc:
          err_msg = 'Exception raised when connecting to spacewalk server ({0}): {1}'.format(server, exc)
          log.error(err_msg)
          return {'Error': err_msg}
  
      groups = client.systemgroup.listAllGroups(key)
  
      deleted_groups = []
      failed_groups = []
  
      for group in groups:
          if client.systemgroup.delete(key, group['name']) == 1:
              deleted_groups.append(group['name'])
          else:
              failed_groups.append(group['name'])
  
      ret = {'deleted': deleted_groups}
      if failed_groups:
          ret['failed'] = failed_groups
      return ref deleteAllGroups(server):
      '''
      Delete all server groups from Spacewalk
      '''
  
      try:
          client, key = _get_session(server)
      except Exception as exc:
          err_msg = 'Exception raised when connecting to spacewalk server ({0}): {1}'.format(server, exc)
          log.error(err_msg)
          return {'Error': err_msg}
  
      groups = client.systemgroup.listAllGroups(key)
  
      deleted_groups = []
      failed_groups = []
  
      for group in groups:
          if client.systemgroup.delete(key, group['name']) == 1:
              deleted_groups.append(group['name'])
          else:
              failed_groups.append(group['name'])
  
      ret = {'deleted': deleted_groups}
      if failed_groups:
          ret['failed'] = failed_groups
      return ret
docs: Delete all server groups from Spacewalk