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)
Related issues
Bug #19631: ActiveRecord::RecordNotSaved when deleting compute resources with key pairs
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)