Sha256: c99b3151cf87ff3c5aa5a98b98105d4bfc7d695e37856f0ac44c2cf77e48d88b

Contents?: true

Size: 680 Bytes

Versions: 20

Compression:

Stored size: 680 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?('SSH')

      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

20 entries across 20 versions & 1 rubygems

Version Path
foreman_remote_execution-5.0.8 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.7 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.6 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.5 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-6.1.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.4 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.3 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-6.0.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.1.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-5.0.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.8.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.5.6 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.5.5 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.5.4 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.7.0 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.5.3 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.5.2 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
foreman_remote_execution-4.5.1 app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb