Sha256: 3e8463ab1af491a2d302a0c5ca79a27730e63feb38499498942df76812e022e3

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module Kontena
  module Callbacks
    class ConfigureAuthProviderAfterDeploy < Kontena::Callback

      include Kontena::Cli::Common

      matches_commands 'master create'

      def configure_auth_provider_using_id(cloud_id)
        Kontena.run("master init-cloud --force --cloud-master-id #{cloud_id.shellescape}")
      end

      def configure_auth_provider
        Kontena.run("master init-cloud --force")
      end

      def after
        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]
        if command.respond_to?(:skip_auth_provider) && command.skip_auth_provider?
          return
        end

        if command.respond_to?(:cloud_master_id) && command.cloud_master_id
          configure_auth_provider_using_id(command.cloud_master_id)
        else
          configure_auth_provider
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kontena-cli-0.16.0.rc1 lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb
kontena-cli-0.16.0.pre9 lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb
kontena-cli-0.16.0.pre8 lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb