Class: Katello::CdnConfiguration

Inherits:
Model
  • Object
show all
Includes:
Encryptable
Defined in:
app/models/katello/cdn_configuration.rb

Constant Summary collapse

CDN_TYPE =
'redhat_cdn'.freeze
NETWORK_SYNC =
'network_sync'.freeze
EXPORT_SYNC =
'export_sync'.freeze
CUSTOM_CDN_TYPE =
'custom_cdn'.freeze
TYPES =
[CDN_TYPE, NETWORK_SYNC, EXPORT_SYNC, CUSTOM_CDN_TYPE].freeze
REDHAT_CDN_HOST_PATTERN =
/\Acdn(-[a-z]+)?\.redhat\.com\z/

Instance Method Summary collapse

Instance Method Details

#custom_cdn?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/models/katello/cdn_configuration.rb', line 37

def custom_cdn?
  type == CUSTOM_CDN_TYPE
end

#custom_cdn_auth_enabled?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/katello/cdn_configuration.rb', line 41

def custom_cdn_auth_enabled?
  custom_cdn_auth_enabled
end

#export_sync?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/katello/cdn_configuration.rb', line 51

def export_sync?
  type == EXPORT_SYNC
end

#network_sync?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'app/models/katello/cdn_configuration.rb', line 55

def network_sync?
  type == NETWORK_SYNC
end

#redhat_cdn?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/models/katello/cdn_configuration.rb', line 33

def redhat_cdn?
  type == CDN_TYPE
end

#redhat_cdn_host?Boolean

Returns:

  • (Boolean)


45
46
47
48
49
# File 'app/models/katello/cdn_configuration.rb', line 45

def redhat_cdn_host?
  URI.parse(url).host&.match?(REDHAT_CDN_HOST_PATTERN)
rescue URI::InvalidURIError
  false
end

#ssl_caObject



29
30
31
# File 'app/models/katello/cdn_configuration.rb', line 29

def ssl_ca
  ssl_ca_credential&.content
end