Class: Polisher::Errata

Inherits:
Object
  • Object
show all
Includes:
ConfHelpers
Defined in:
lib/polisher/targets/errata.rb

Class Method Summary collapse

Methods included from ConfHelpers

included, #require_cmd!, #require_dep!

Class Method Details

.buildsObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/polisher/targets/errata.rb', line 34

def self.builds
  @cached_url    ||= advisory_url
  @cached_builds ||= nil

  if @cached_url != advisory_url || @cached_builds.nil?
    client.url     = "#{advisory_url}/builds"
    @cached_builds = client.get
    @cached_builds = JSON.parse(client.body_str)
  end

  @cached_builds
end

.clear!Object



28
29
30
31
32
# File 'lib/polisher/targets/errata.rb', line 28

def self.clear!
  @cached_url = nil
  @cached_builds = nil
  self
end

.clientObject

Initialize/return singleton curl handle to query errata



17
18
19
20
21
22
23
24
25
26
# File 'lib/polisher/targets/errata.rb', line 17

def self.client
  @curl ||= begin
    curl = Curl::Easy.new
    curl.ssl_verify_peer = false
    curl.ssl_verify_host = false
    curl.http_auth_types = :negotiate
    curl.userpwd = ':'
    curl
  end
end

.versions_for(name, &bl) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/polisher/targets/errata.rb', line 47

def self.versions_for(name, &bl)
  versions = builds.collect do |_tag, builds|
    ErrataBuild.builds_matching(builds, name)
  end.flatten
  bl.call(:errata, name, versions) unless bl.nil?
  versions
end