Example #1
0
 def handle(self, request, data):
     try:
         LOG.info('Importing keypair "%s"' % data['name'])
         api.keypair_import(request, data['name'], data['public_key'])
         messages.success(request, 'Successfully imported public key: %s'
                                    % data['name'])
         return redirect('dash_keypairs', request.user.tenant_id)
     except novaclient_exceptions.ClientException, e:
         LOG.exception("ClientException in ImportKeypair")
         messages.error(request, 'Error Importing Keypair: %s' % e.message)
         return redirect(request.build_absolute_uri())