Class: Command::RunCleanup
Constant Summary collapse
- NAME =
"run:cleanup"- OPTIONS =
[ app_option(required: true), skip_confirm_option ].freeze
- DESCRIPTION =
"Deletes stale run workloads for an app"- LONG_DESCRIPTION =
<<~DESC - Deletes stale run workloads for an app - Workloads are considered stale based on how many days since created - `stale_run_workload_created_days` in the `.controlplane/controlplane.yml` file specifies the number of days after created that the workload is considered stale - Will ask for explicit user confirmation of deletion DESC
Constants inherited from Base
Base::DEFAULT_ARGS, Base::EXAMPLES, Base::HIDE, Base::NO_IMAGE_AVAILABLE, Base::REQUIRES_ARGS, Base::USAGE
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods inherited from Base
all_commands, all_options, all_options_by_key_name, app_option, #args_join, commit_option, #cp, #ensure_workload_deleted, image_option, #initialize, #latest_image, #latest_image_from, #latest_image_next, org_option, #perform, #progress, skip_confirm_option, #step, #step_error, #step_finish, terminal_size_option, upstream_token_option, use_local_token_option, version_option, #wait_for_replica, #wait_for_workload, wait_option, workload_option
Constructor Details
This class inherits a constructor from Command::Base
Instance Method Details
#call ⇒ Object
rubocop:disable Metrics/MethodLength
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/command/run_cleanup.rb', line 18 def call # rubocop:disable Metrics/MethodLength return progress.puts("No stale run workloads found.") if stale_run_workloads.empty? progress.puts("Stale run workloads:") stale_run_workloads.each do |workload| progress.puts(" #{workload[:name]} " \ "(#{Shell.color("#{workload[:date]} - #{workload[:days]} days ago", :red)})") end return unless confirm_delete progress.puts stale_run_workloads.each do |workload| delete_workload(workload) end end |