Project

General

Profile

« Previous | Next » 

Revision 2d6c6f18

Added by Daniel Lobato Garcia almost 7 years ago

Fixes #19631 - ComputeResource with KeyPair can be removed

The concern for removing the compute resources with keypairs was trying
to destroy the compute resource too early. Also, this deletion already
happened because of the has_one :dependency => :destroy relation

This fixes the problem and adds tests to ensure the relation works.

(cherry picked from commit 91f8ffb1fbd210057fbdc9c4613c9805f62ea0ac)

View differences:

app/controllers/key_pairs_controller.rb
def destroy
key_to_delete = params[:id]
return not_found unless key_to_delete
if @compute_resource.delete_key_pair(key_to_delete)
if @compute_resource.delete_key_from_resource(key_to_delete)
process_success :success_msg => _('Successfully delete %s') % key_to_delete,
:success_redirect => compute_resource_path(@compute_resource)
else

Also available in: Unified diff