Class: Bosh::Cli::Command::Task
Constant Summary collapse
- INCLUDE_ALL =
"Include all task types (ssh, logs, vms, etc)"
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#args, #exit_code, #options, #out, #runner, #work_dir
Instance Method Summary collapse
- #cancel(task_id) ⇒ Object
- #list_recent(count = 30) ⇒ Object
- #list_running ⇒ Object
- #track(task_id = nil) ⇒ Object
Methods inherited from Base
#add_option, #blob_manager, #blobstore, #cache_dir, #config, #confirmed?, #credentials, #deployment, #director, #initialize, #interactive?, #logged_in?, #non_interactive?, #progress_renderer, #redirect, #release, #remove_option, #target, #target_name, #verbose?
Methods included from Bosh::Cli::CommandDiscovery
#desc, #method_added, #option, #register_command, #usage
Methods included from DeploymentHelper
#cancel_deployment, #deployment_changed?, #inspect_deployment_changes, #job_exists_in_deployment?, #job_must_exist_in_deployment, #job_unique_in_deployment?, #jobs_and_indexes, #latest_release_versions, #prepare_deployment_manifest, #prompt_for_errand_name, #prompt_for_job_and_index, #resolve_release_aliases, #warn_about_stemcell_changes
Constructor Details
This class inherits a constructor from Bosh::Cli::Command::Base
Instance Method Details
#cancel(task_id) ⇒ Object
93 94 95 96 97 98 |
# File 'lib/cli/commands/task.rb', line 93 def cancel(task_id) auth_required task = Bosh::Cli::DirectorTask.new(director, task_id) task.cancel say("Task #{task_id} is getting canceled") end |
#list_recent(count = 30) ⇒ Object
81 82 83 84 85 86 87 88 |
# File 'lib/cli/commands/task.rb', line 81 def list_recent(count = 30) auth_required use_filter = !.key?(:no_filter) tasks = director.list_recent_tasks(count, get_verbose_level(use_filter)) err("No recent tasks") if tasks.empty? show_tasks_table(tasks) say("Showing #{tasks.size} recent #{tasks.size == 1 ? "task" : "tasks"}") end |
#list_running ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/cli/commands/task.rb', line 68 def list_running auth_required use_filter = !.key?(:no_filter) tasks = director.list_running_tasks(get_verbose_level(use_filter)) err("No running tasks") if tasks.empty? show_tasks_table(tasks.sort_by { |t| t["id"].to_i * -1 }) say("Total tasks running now: %d" % [tasks.size]) end |
#track(task_id = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/cli/commands/task.rb', line 15 def track(task_id = nil) auth_required use_filter = !.key?(:no_filter) raw_output = [:raw] log_type = "event" n_types = 0 if [:cpi] log_type = "cpi" n_types += 1 end if [:debug] log_type = "debug" n_types += 1 end if [:event] log_type = "event" n_types += 1 end if [:result] log_type = "result" raw_output = true n_types += 1 end if n_types > 1 err("Cannot track more than one log type") end = { :log_type => log_type, :raw_output => raw_output } if task_id.nil? || %w(last latest).include?(task_id) task_id = get_last_task_id(get_verbose_level(use_filter)) end if task_id.to_i <= 0 err("Task id must be a positive integer") end tracker = Bosh::Cli::TaskTracking::TaskTracker.new(director, task_id, ) tracker.track end |