debian-mirror-gitlab/app/services/clusters/applications/check_uninstall_progress_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.1 KiB
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
module Clusters
module Applications
2019-12-04 20:38:33 +05:30
class CheckUninstallProgressService < CheckProgressService
private
2019-07-31 22:56:46 +05:30
2019-12-04 20:38:33 +05:30
def operation_in_progress?
app.uninstalling?
2019-07-31 22:56:46 +05:30
end
def on_success
2019-09-30 21:07:59 +05:30
app.post_uninstall
2019-07-31 22:56:46 +05:30
app.destroy!
rescue StandardError => e
app.make_errored!(_('Application uninstalled but failed to destroy: %{error_message}') % { error_message: e.message })
ensure
2019-12-04 20:38:33 +05:30
remove_uninstallation_pod
2019-07-31 22:56:46 +05:30
end
def check_timeout
if timed_out?
app.make_errored!(_('Operation timed out. Check pod logs for %{pod_name} for more details.') % { pod_name: pod_name })
else
WaitForUninstallAppWorker.perform_in(WaitForUninstallAppWorker::INTERVAL, app.name, app.id)
end
end
def pod_name
app.uninstall_command.pod_name
end
def timed_out?
2020-05-24 23:13:21 +05:30
Time.current.utc - app.updated_at.utc > WaitForUninstallAppWorker::TIMEOUT
2019-07-31 22:56:46 +05:30
end
2019-12-04 20:38:33 +05:30
def remove_uninstallation_pod
2019-07-31 22:56:46 +05:30
helm_api.delete_pod!(pod_name)
end
end
end
end