diff options
author | João Cunha <j.a.cunha@gmail.com> | 2019-09-12 10:08:20 +0100 |
---|---|---|
committer | João Cunha <j.a.cunha@gmail.com> | 2019-09-12 10:28:25 +0100 |
commit | c296be25bc8c8923c10380fd07535df78ceb7daa (patch) | |
tree | c24e597c08150eec528ca860980f3b1420902d6e | |
parent | b9d9b01ee8d605ffe26c1c999b4b066d7cada2bc (diff) | |
download | gitlab-ce-improve-logic-to-define-if-an-app-can-be-uninstalled-27679-ce.tar.gz |
States updated and update_errored also allow for uninstallationimprove-logic-to-define-if-an-app-can-be-uninstalled-27679-ce
-rw-r--r-- | app/models/clusters/concerns/application_core.rb | 6 | ||||
-rw-r--r-- | spec/support/shared_examples/models/cluster_application_core_shared_examples.rb | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/app/models/clusters/concerns/application_core.rb b/app/models/clusters/concerns/application_core.rb index 84875f4e6a3..f87e0ff6407 100644 --- a/app/models/clusters/concerns/application_core.rb +++ b/app/models/clusters/concerns/application_core.rb @@ -19,7 +19,7 @@ module Clusters end def can_uninstall? - allowed_to_uninstall? && uninstall_errored_or_installed? + allowed_to_uninstall? && can_uninstall_state? end # All new applications should uninstall by default @@ -59,8 +59,8 @@ module Clusters private - def uninstall_errored_or_installed? - uninstall_errored? || installed? + def can_uninstall_state? + uninstall_errored? || installed? || update_errored? || updated? end end end diff --git a/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb b/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb index 1925673f121..90fbc063350 100644 --- a/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb +++ b/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb @@ -20,6 +20,8 @@ shared_examples 'cluster application core specs' do |application_name| where(:expected_value, :status_name) do true | :uninstall_errored true | :installed + true | :updated + true | :update_errored false | :scheduled false | :uninstalling end @@ -35,6 +37,8 @@ shared_examples 'cluster application core specs' do |application_name| where(:expected_value, :status_name) do false | :uninstall_errored false | :installed + false | :updated + false | :update_errored false | :scheduled false | :uninstalling end |