Sha256: 2526be3440c59f23afd61d7e764b8cc6157fb2ac853db69e47a24ed157a17a68

Contents?: true

Size: 531 Bytes

Versions: 12

Compression:

Stored size: 531 Bytes

Contents

module Kontena
  module Callbacks
    class ClearCurrentMasterAfterTerminate < Kontena::Callback

      include Kontena::Cli::Common

      matches_commands 'master terminate'

      def after
        return unless command.exit_code == 0
        return unless config.current_master

        ENV["DEBUG"] && $stderr.puts("Removing current master from config")
        config.servers.delete_at(config.find_server_index(config.current_master.name))
        config.current_server = nil
        config.write
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kontena-cli-1.3.0.pre1 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.2 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.2.rc2 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.2.rc1 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.1 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.1.rc1 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.0 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.0.rc3 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.0.rc2 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.0.rc1 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.0.pre3 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb
kontena-cli-1.2.0.pre2 lib/kontena/callbacks/master/01_clear_current_master_after_terminate.rb