Class: ForemanPipeline::JenkinsInstance

Inherits:
Katello::Model
  • Object
show all
Includes:
Authorization::JenkinsInstance, Katello::Glue
Defined in:
app/models/foreman_pipeline/jenkins_instance.rb

Constant Summary collapse

FILEPATH_REGEX =
/\A(\/|~)[a-z0-9\-_.\/]*[^\/]\z/i

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject

Returns the value of attribute client.



7
8
9
# File 'app/models/foreman_pipeline/jenkins_instance.rb', line 7

def client
  @client
end

#server_versionObject

Returns the value of attribute server_version.



7
8
9
# File 'app/models/foreman_pipeline/jenkins_instance.rb', line 7

def server_version
  @server_version
end

Instance Method Details

#create_client(username = nil, password = nil) ⇒ Object

TODO: loose coupling



27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/foreman_pipeline/jenkins_instance.rb', line 27

def create_client(username = nil, password = nil)
  fail "Cannot create Jenkins client: no url in Jenkins Instance" if url.nil?
  fail "Token required if username given." if !username.nil? && password.nil?

  if !@client.nil? && @client.username.nil? && !username.nil?
    @client = new_client username, password
  else
    @client ||= new_client username, password
  end
  @client
end

#timeout_secObject



39
40
41
# File 'app/models/foreman_pipeline/jenkins_instance.rb', line 39

def timeout_sec
  timeout * 60
end