Class: Kontena::Cli::Stacks::YAML::Opto::Resolvers::ServiceInstances
- Inherits:
-
Opto::Resolver
- Object
- Opto::Resolver
- Kontena::Cli::Stacks::YAML::Opto::Resolvers::ServiceInstances
show all
- Includes:
- Common
- Defined in:
- lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
Instance Method Summary
collapse
Methods included from Common
#access_token=, #add_master, #any_key_to_continue, #any_key_to_continue_with_timeout, #api_url, #api_url=, #caret, #clear_current_grid, #client, #cloud_auth?, #cloud_client, #config, #confirm, #confirm_command, #current_grid, #current_master_index, #debug?, #display_account_login_info, #display_login_info, display_logo, #display_master_login_info, #error, exit_with_error, #kontena_account, #logger, #pastel, #print, #prompt, #puts, #require_api_url, #require_token, #reset_client, #reset_cloud_client, #running_quiet?, #running_silent?, #running_verbose?, #spin_if, #spinner, #sprint, #sputs, #stdin_input, #use_refresh_token, #vfakespinner, #vputs, #vspinner, #warning
Instance Method Details
#resolve ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb', line 6
def resolve
return nil unless current_master && current_grid
require 'kontena/cli/stacks/show_command'
stack = client.get("stacks/#{current_grid}/#{self.stack}")
service = stack['services'].find { |s| s['name'] == hint }
if service
service['instances']
else
nil
end
rescue Kontena::Errors::StandardError
nil
end
|
#stack ⇒ Object
20
21
22
|
# File 'lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb', line 20
def stack
ENV['STACK']
end
|