Class: Kontena::Callbacks::SetServerProviderAfterDeploy

Inherits:
Kontena::Callback show all
Defined in:
lib/kontena/callbacks/master/deploy/56_set_server_provider_after_deploy.rb

Instance Attribute Summary

Attributes inherited from Kontena::Callback

#command

Instance Method Summary collapse

Methods inherited from Kontena::Callback

callbacks, #initialize, matches_commands, run_callbacks

Constructor Details

This class inherits a constructor from Kontena::Callback

Instance Method Details

#afterObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kontena/callbacks/master/deploy/56_set_server_provider_after_deploy.rb', line 7

def after
  extend Kontena::Cli::Common
  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