Sha256: e8af283156f55061220677a7d54d2f67f02dc45e87fbbe4d01c49029f0006173

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

module Kontena
  module Callbacks
    class SetServerProviderAfterDeploy < 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]
        return unless command.result[:provider]

        require 'shellwords'

        cmd = ['master', 'config', 'set', "server.provider=#{command.result[:provider]}"]
        spinner "Setting Master configuration server.provider to '#{command.result[:provider]}'" do |spin|
          spin.fail! unless Kontena.run(cmd)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kontena-cli-1.3.0.pre1 lib/kontena/callbacks/master/deploy/56_set_server_provider_after_deploy.rb