def deleteAllActivationKeys(server):
 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}
 activation_keys = client.activationkey.listActivationKeys(key)
 deleted_keys = []
 failed_keys = []
 for aKey in activation_keys:
  if (client.activationkey.delete(key, aKey['key']) == 1):
   deleted_keys.append(aKey['key'])
  else:
   failed_keys.append(aKey['key'])
 ret = {'deleted': deleted_keys}
 if failed_keys:
  ret['failed'] = failed_keys
 return ret

def deleteAllActivationKeys ( server ) : 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 } activation_keys = client . activationkey . listActivationKeys ( key ) deleted_keys = [ ] failed_keys = [ ] for aKey in activation_keys : if ( client . activationkey . delete ( key , aKey [ 'key' ] ) == 1 ) : deleted_keys . append ( aKey [ 'key' ] ) else : failed_keys . append ( aKey [ 'key' ] ) ret = { 'deleted' : deleted_keys } if failed_keys : ret [ 'failed' ] = failed_keys return ret
delete all activation keys from spacewalk cli example: .