def keynamelist():
     try:
         fl = api.keypair_list(request)
         sel = [(f.key_name, f.key_name) for f in fl]
         return sel
     except api_exceptions.ApiException:
         LOG.error("Unable to retrieve list of keypairs", exc_info=True)
         return []
def index(request, tenant_id):
    delete_form, handled = DeleteKeypair.maybe_handle(request)

    if handled:
        return handled

    try:
        keypairs = api.keypair_list(request)
    except api_exceptions.ApiException, e:
        keypairs = []
        LOG.error("ApiException in keypair index", exc_info=True)
        messages.error(request, "Error fetching keypairs: %s" % e.message)