class Bicho::Plugins::Novell
Novell
bugzilla is behind ichain
Plugin that rewrites the bugzilla API url to the Novell
internal endpoint without ichain.
Also, it takes your credentials from your oscrc.
Constants
- DEFAULT_OSCRC_PATH
- DOMAINS
- OSCRC_CREDENTIALS
- XMLRPC_DOMAINS
Attributes
oscrc_path[W]
Public Class Methods
oscrc_credentials()
click to toggle source
# File lib/bicho/plugins/novell.rb, line 59 def self.oscrc_credentials oscrc = IniFile.load(oscrc_path) urls = [OSCRC_CREDENTIALS] urls << "#{OSCRC_CREDENTIALS}/" unless OSCRC_CREDENTIALS.end_with?('/') urls.each do |section| next unless oscrc.has_section?(section) user = oscrc[section]['user'] pass = oscrc[section]['pass'] return { user: user, password: pass } if user && pass end raise "No valid .oscrc credentials for Novell/SUSE bugzilla (#{oscrc_path})" end
oscrc_path()
click to toggle source
# File lib/bicho/plugins/novell.rb, line 51 def self.oscrc_path @oscrc_path ||= DEFAULT_OSCRC_PATH end
Public Instance Methods
to_s()
click to toggle source
# File lib/bicho/plugins/novell.rb, line 55 def to_s self.class.to_s end
transform_api_url_hook(url, logger)
click to toggle source
# File lib/bicho/plugins/novell.rb, line 81 def transform_api_url_hook(url, logger) return url unless DOMAINS.map { |domain| url.host&.include?(domain) }.any? begin url = url.clone url.host = url.host.gsub(/bugzilla\.novell.com/, 'apibugzilla.novell.com') url.host = url.host.gsub(/bugzilla\.suse.com/, 'apibugzilla.suse.com') url.scheme = 'https' logger.debug("#{self} : Rewrote url to '#{url}'") rescue StandardError => e logger.warn e end url end
transform_site_url_hook(url, _logger)
click to toggle source
# File lib/bicho/plugins/novell.rb, line 72 def transform_site_url_hook(url, _logger) case url.to_s when 'bnc', 'novell' then 'https://bugzilla.novell.com' when 'bsc', 'suse' then 'https://bugzilla.suse.com' when 'boo', 'opensuse' then 'https://bugzilla.opensuse.org' else url end end
transform_xmlrpc_client_hook(client, logger)
click to toggle source
# File lib/bicho/plugins/novell.rb, line 97 def transform_xmlrpc_client_hook(client, logger) return unless XMLRPC_DOMAINS.map { |domain| client.http.address.include?(domain) }.any? auth = Novell.oscrc_credentials client.user = auth[:user] client.password = auth[:password] logger.debug("#{self} : updated XMLRPC client with oscrc auth information") rescue StandardError => e logger.error e end