Class: Registration::SmtStatus

Inherits:
Object
  • Object
show all
Includes:
Yast::Logger
Defined in:
src/lib/registration/smt_status.rb

Overview

Check SMT server status, check supported API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, insecure: false) ⇒ SmtStatus


14
15
16
17
# File 'src/lib/registration/smt_status.rb', line 14

def initialize(url, insecure: false)
  @url = url.is_a?(URI) ? url : URI(url)
  @insecure = insecure
end

Instance Attribute Details

#insecureObject (readonly)

Returns the value of attribute insecure


12
13
14
# File 'src/lib/registration/smt_status.rb', line 12

def insecure
  @insecure
end

#urlObject (readonly)

Returns the value of attribute url


12
13
14
# File 'src/lib/registration/smt_status.rb', line 12

def url
  @url
end

Instance Method Details

#ncc_api_present?Boolean

check whether (old) NCC API is present at the server


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'src/lib/registration/smt_status.rb', line 20

def ncc_api_present?
  download_url = ncc_api_url
  log.info "Checking NCC API presence: #{download_url}"

  begin
    Downloader.download(download_url, insecure: insecure)
    log.info "NCC API found"
    return true
  rescue DownloadError
    log.info "Download failed, NCC API probably not present"
    return false
  end
end