Sha256: b1d4f2b477ba7ede9df1d459ae2dc9226bfd90801a97f752679af60cb47f9d6a

Contents?: true

Size: 596 Bytes

Versions: 13

Compression:

Stored size: 596 Bytes

Contents

module Kontena::Cli::Stacks
  module YAML
    class Opto::Resolvers::ServiceInstances < ::Opto::Resolver
      def resolve
        return nil unless current_master && current_grid
        read_command = Kontena::Cli::Stacks::ShowCommand.new([self.stack])
        stack = read_command.fetch_stack(self.stack)
        service = stack['services'].find { |s| s['name'] == hint }
        if service
          service['instances']
        else
          nil
        end
      rescue Kontena::Errors::StandardError
        nil
      end

      def stack
        ENV['STACK']
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kontena-cli-1.3.0.pre2 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.3.0.pre1 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.2 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.2.rc2 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.2.rc1 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.1 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.1.rc1 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.0 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.0.rc3 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.0.rc2 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.0.rc1 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.0.pre3 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb