aeolusproject / conductor

Aeolus Conductor
http://www.aeolusproject.org/
Apache License 2.0
32 stars 27 forks source link

act_as_paranoid integrity breakage for instances #386

Open martinpovolny opened 11 years ago

martinpovolny commented 11 years ago

The logic taking care of the referencial integrity between Instance and ProviderAccount is probably twisted.

Below is an error I got after adding a FK constraint to instances that references ProviderAccounts.

While it should be possible from the database point of view to delete the provider accout that is referenced byt an instance (because the soft delete just sets the deleted_at and the record remains in the database).

It should not be possible on the application level which I suspect is the case of the test in this issue.

However I am not sure, have to check later on.

features/provider_account.feature:48 ... Then I should be on the mockprovider's show provider page # features/step_definitions/web_steps.rb:203 And I should see "was deleted" # features/step_definitions/web_steps.rb:121 expected there to be content "was deleted" in "\nInternal Server Error\nAeolus Conductor\n\n\n\n //<![CDATA[\n window.Conductor = {}\n window.Conductor.PATH_PREFIX = \"/\"\n // This hack prevents Backbone from switching to the #/pools/1 type URLs\n // when the browser doesn't support the HTML5 History API.\n window.history || (window.history = {});\n window.history.pushState || (window.history.pushState = function(){});\n window.history.replaceState || (window.history.replaceState = function(){});\n //]]>\n\n\n\n\n\n\nAeolus Conductor\n\n\n\n\nMonitorAdminister\n\nJohn Smith\nLog Out\n\n\n\n\nERROR: update or delete on table \"provider_accounts\" violates foreign key constraint \"instances_provider_account_id_fk\" on table \"instances\"\nDETAIL: Key (id)=(1) is still referenced from table \"instances\".\n\n\n\n\n\n\n\n\n\n\n" (RSpec::Expectations::ExpectationNotMetError) ./features/step_definitions/web_steps.rb:123:in /^(?:|I )should see "([^"]*)"$/' features/provider_account.feature:63:inAnd I should see "was deleted"' And there should be no provider account "testaccount" #

martinpovolny commented 11 years ago

https://github.com/aeolusproject/conductor/issues/387 -- the same problem for deployment