Class: Kontena::Callbacks::InstallSslCertificateAfterDeploy
- Inherits:
-
Kontena::Callback
- Object
- Kontena::Callback
- Kontena::Callbacks::InstallSslCertificateAfterDeploy
- Defined in:
- lib/kontena/callbacks/master/deploy/40_install_ssl_certificate_after_deploy.rb
Instance Attribute Summary
Attributes inherited from Kontena::Callback
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
#after ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kontena/callbacks/master/deploy/40_install_ssl_certificate_after_deploy.rb', line 7 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?(:ssl_certificate) return unless command.result.has_key?(:public_ip) cert_dir = File.join(Dir.home, '.kontena/certs') unless File.directory?(cert_dir) require 'fileutils' FileUtils.mkdir_p(cert_dir) end cert_file = File.join(cert_dir, "#{command.result[:public_ip]}.pem") spinner "Installing SSL certificate to #{cert_file}" do File.unlink(cert_file) if File.exist?(cert_file) File.write(cert_file, command.result[:ssl_certificate]) end end |