Sha256: 2a3272da23b1eff0a9b49593fc46ded9c3ebaf17bdbea07bf752fccb9d0dcc53

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

module Kontena
  module Callbacks
    class ListAndSelectGrid < Kontena::Callback

      include Kontena::Cli::Common

      matches_commands 'master auth'

      def after_load
        command.class_eval do
          option ['--skip-grid-auto-select'], :flag, 'Do not auto select grid'
        end
      end

      # Runs kontena grids list --use which will auto join the first available
      # grid
      def after
        return if command.skip_grid_auto_select?
        return unless current_master
        return unless command.exit_code == 0
        return unless current_master.grid.nil?

        Kontena.run('grid list --use --verbose')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kontena-cli-0.16.0.pre2 lib/kontena/callbacks/auth/01_list_and_select_grid_after_master_auth.rb
kontena-cli-0.16.0.pre1 lib/kontena/callbacks/auth/01_list_and_select_grid_after_master_auth.rb