Sha256: ded2b06babaf173133a7790b6f900fef8853dbd61c56ba1149190a2e3179097d

Contents?: true

Size: 689 Bytes

Versions: 45

Compression:

Stored size: 689 Bytes

Contents

module ForemanRemoteExecution
  module SmartProxyExtensions
    def self.prepended(base)
      base.instance_eval do
        has_many :host_proxy_invocations, :dependent => :destroy
      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

45 entries across 45 versions & 1 rubygems

Version Path
foreman_remote_execution-8.3.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-10.0.6 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-10.0.5 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-10.0.4 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-10.0.3 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-10.0.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-10.0.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-10.0.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-8.3.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-9.1.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-8.2.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-8.2.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-9.0.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-9.0.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-8.1.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-8.1.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-8.1.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-7.2.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-7.2.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-7.2.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb