Sha256: 63c9804a09201c954541031144a54ce01049239dd67f23921fc3a0de9f1e77e2

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

module Kontena
  module Callbacks
    # Runs kontena master auth-provider config after deployment if
    # auth provider configuration options have been supplied.
    #
    # Runs the config command with --preset kontena if the user has
    # authenticated to Kontena unless --no-auth-config is used.
    class CreateInitialGridAfterDeploy < Kontena::Callback

      include Kontena::Cli::Common

      matches_commands 'master create'

      def after
        return unless command.exit_code == 0
        return unless config.current_master
        return unless config.current_master.name == command.result[:name]

        cmd = "grid create --silent test"
        ENV["DEBUG"] && puts("Running: #{cmd}")
      
        spinner "Creating initial grid 'test'" do
          Kontena.run(cmd)
        end

        spinner "Selecting 'test' as current grid" do
          Kontena.run("grid use test")
        end
      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/master/deploy/55_create_initial_grid_after_deploy.rb
kontena-cli-0.16.0.pre1 lib/kontena/callbacks/master/deploy/55_create_initial_grid_after_deploy.rb