Sha256: f26ef7383949e71d9a12fc5b58c5caa926837600af88c8e925af06dfc3abb943

Contents?: true

Size: 752 Bytes

Versions: 18

Compression:

Stored size: 752 Bytes

Contents

module ForemanRemoteExecution
  module SmartProxyExtensions
    def self.prepended(base)
      base.instance_eval do
        has_many :host_proxy_invocations, :dependent => :destroy
        has_many :template_invocations, :dependent => :nullify
      end
    end

    def pubkey
      self[:pubkey] || update_pubkey
    end

    def update_pubkey
      return unless has_feature?(%w(SSH Script))

      key = ::ProxyAPI::RemoteExecutionSSH.new(:url => url).pubkey
      self.update_attribute(:pubkey, key) if key
      key
    end

    def drop_host_from_known_hosts(host)
      ::ProxyAPI::RemoteExecutionSSH.new(:url => url).drop_from_known_hosts(host)
    end

    def refresh
      errors = super
      update_pubkey
      errors
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
foreman_remote_execution-13.2.8 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-15.0.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-15.0.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-13.2.7 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-15.0.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.1.4 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.1.3 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.1.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.1.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.1.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.0.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.0.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-13.2.6 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-14.0.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-13.2.5 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-13.2.4 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-13.2.3 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-13.2.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb