Sha256: aa2789231bde43e7932e288647801dc1c25f61fcb1debca68353ea021c55951f

Contents?: true

Size: 1009 Bytes

Versions: 4

Compression:

Stored size: 1009 Bytes

Contents

module Kontena
  module Callbacks
    class ConfigureAuthProviderAfterDeploy < Kontena::Callback

      matches_commands 'master create'

      def init_cloud_args
        args = []
        args << '--force'
        args << "--cloud-master-id #{command.cloud_master_id}" if command.cloud_master_id
        args << "--provider #{command.result[:provider]}" if command.result[:provider]
        args << "--version #{command.result[:version]}" if command.result[:version]
        args
      end

      def after
        extend Kontena::Cli::Common
        return unless command.exit_code == 0
        return unless command.result.kind_of?(Hash)
        return unless command.result.has_key?(:name)
        return unless config.current_master
        return unless config.current_master.name == command.result[:name]

        unless command.respond_to?(:skip_auth_provider?) && command.skip_auth_provider?
          Kontena.run(['master', 'init-cloud'] + init_cloud_args)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kontena-cli-1.3.0.rc3 lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb
kontena-cli-1.3.0.rc2 lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb
kontena-cli-1.3.0.rc1 lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb
kontena-cli-1.3.0.pre2 lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb