Class: Katello::Pulp::Server

Inherits:
Object
  • Object
show all
Defined in:
app/services/katello/pulp/server.rb

Class Method Summary collapse

Class Method Details

.config(url, user_remote_id) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/services/katello/pulp/server.rb', line 4

def self.config(url, user_remote_id)
  uri = URI.parse(url)

  runcible_params = {
    :url => "#{uri.scheme}://#{uri.host.downcase}",
    :api_path => uri.path,
    :user => user_remote_id,
    :timeout => SETTINGS[:katello][:rest_client_timeout],
    :open_timeout => SETTINGS[:katello][:rest_client_timeout],
    :logging => {
      :logger => ::Foreman::Logging.logger('katello/pulp_rest'),
      :exception => true,
      :info => true,
      :debug => true
    }
  }

  if Setting[:use_pulp_oauth]
    runcible_params[:oauth] = {
      :oauth_secret => SETTINGS[:katello][:pulp][:oauth_secret],
      :oauth_key => SETTINGS[:katello][:pulp][:oauth_key]
    }
  else
    runcible_params[:cert_auth] = {
      :ssl_client_cert => ::Cert::Certs.ssl_client_cert,
      :ssl_client_key => ::Cert::Certs.ssl_client_key
    }
  end

  Runcible::Instance.new(runcible_params)
end