Class: Kontena::Callbacks::ConfigureAuthProviderAfterDeploy

Inherits:
Kontena::Callback show all
Defined in:
lib/kontena/callbacks/master/deploy/60_configure_auth_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



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb', line 16

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

#init_cloud_argsObject



7
8
9
10
11
12
13
14
# File 'lib/kontena/callbacks/master/deploy/60_configure_auth_provider_after_deploy.rb', line 7

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