Project

General

Profile

Actions

Bug #19631

closed

ActiveRecord::RecordNotSaved when deleting compute resources with key pairs

Added by Ondřej Pražák over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
High
Category:
Compute resources
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Steps to Reproduce:
1.goto Infrastructure>Compute resources
2.Create EC2 compute resource
3.goto Infrastructure>Compute resources
4.delete the created compute resource

2017-05-23T11:30:56 24905450 [app] [I] Started DELETE "/compute_resources/6-ec2" for ::1 at 2017-05-23 11:30:56 +0000
2017-05-23T11:30:56 24905450 [app] [I] Processing by ComputeResourcesController#destroy as HTML
2017-05-23T11:30:56 24905450 [app] [I]   Parameters: {"authenticity_token"=>"...", "id"=>"6-ec2"}
2017-05-23T11:30:56 24905450 [app] [I] Current user: admin (administrator)
2017-05-23T11:30:56 24905450 [app] [D] Setting current user thread-local variable to admin
2017-05-23T11:30:56 24905450 [app] [D] Setting current organization thread-local variable to none
2017-05-23T11:30:56 24905450 [app] [D] Setting current location thread-local variable to none
2017-05-23T11:30:56 24905450 [app] [I] removing EC2: ec2 key foreman-6532cca12-32bf-4841-b323-5d205e563e99
D, [2017-05-23T11:30:56.334010 #14496] DEBUG -- : String does not start with the prefix 'encrypted-', so Foreman::Model::EC2 ec2 was not decrypted
2017-05-23T11:30:56 24905450 [app] [D] String does not start with the prefix 'encrypted-', so Foreman::Model::EC2 ec2 was not decrypted
2017-05-23T11:30:57 24905450 [app] [I] Completed 422 Unprocessable Entity in 1251ms (ActiveRecord: 15.8ms)
2017-05-23T11:30:57 24905450 [app] [F] 
 | ActiveRecord::RecordNotSaved (You cannot call create unless the parent is saved):
 |   app/models/concerns/key_pair_compute_resource.rb:44:in `destroy_key_pair'
 |   app/controllers/compute_resources_controller.rb:69:in `destroy'
 |   app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 |   app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 |   app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 |   /home/vagrant/projects/katello/lib/katello/params_parser_wrapper.rb:12:in `call'
 |   lib/middleware/catch_json_parse_errors.rb:8:in `call'
 |   lib/middleware/tagged_logging.rb:18:in `call'

Related issues 2 (0 open2 closed)

Related to Foreman - Feature #17015: Add ability to get private keys or use existing key pairs when provisioning on EC2ClosedShlomi Zadok10/19/2016Actions
Related to Foreman - Refactor #22938: test 'should remove the key pair on compute resource deletion' fails with Rails 5.2ClosedActions
Actions #1

Updated by Ondřej Pražák over 7 years ago

  • Subject changed from Not able to delete EC2 compute resource to Not able to delete EC2 compute resource
  • Category changed from VM management to Compute resources - EC2
  • Target version set to 115
Actions #2

Updated by Ondřej Pražák over 7 years ago

  • Priority changed from Normal to High
Actions #3

Updated by Dominic Cleal over 7 years ago

  • Related to Feature #17015: Add ability to get private keys or use existing key pairs when provisioning on EC2 added
Actions #4

Updated by Dominic Cleal over 7 years ago

  • Translation missing: en.field_release set to 248

The CR's key pair concern appears to have changed in #17015 from calling .destroy to .destroy! on the key pair associated to the CR when the CR's destroyed. It could have been failing silently prior to this change. It is probably superfluous as the CR to key pair association has dependent => destroy.

Setting 1.15.1 release as it appears to be a regression.

Actions #5

Updated by Dominic Cleal over 7 years ago

  • Subject changed from Not able to delete EC2 compute resource to ActiveRecord::RecordNotSaved when deleting compute resources with key pairs
  • Category changed from Compute resources - EC2 to Compute resources
Actions #6

Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4554 added
Actions #7

Updated by Anonymous over 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #8

Updated by Anonymous over 6 years ago

  • Related to Refactor #22938: test 'should remove the key pair on compute resource deletion' fails with Rails 5.2 added
Actions

Also available in: Atom PDF