Module: Katello::Concerns::HostManagedExtensions::Overrides

Defined in:
app/models/katello/concerns/host_managed_extensions.rb

Instance Method Summary collapse

Instance Method Details

#inherited_attributesObject



14
15
16
17
18
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 14

def inherited_attributes
  inherited_attrs = super
  inherited_attrs.delete('medium_id') if content_facet && !content_facet.kickstart_repository.blank?
  inherited_attrs
end

#remote_execution_proxies(provider, *_rest) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 39

def remote_execution_proxies(provider, *_rest)
  proxies = super
  name = subscription_facet&.registered_through
  result = []
  if name.present?
    result = SmartProxy.with_features(provider)
                                   .authorized
                                   .where(name: name)
    if result.blank?
      result = SmartProxy.authorized.behind_load_balancer(name)
    end
  end
  proxies[:registered_through] = result
  proxies
end

#smart_proxy_idsObject



20
21
22
23
24
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 20

def smart_proxy_ids
  ids = super
  ids << content_source_id
  ids.uniq.compact
end

#update_os_from_factsObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 26

def update_os_from_facts
  super

  # If facts causes the OS to change, our kickstart repo might not be
  # valid anymore. Let's reset it, either to nil or a valid one
  ks_repo = content_facet&.kickstart_repository
  valid_repos = operatingsystem.respond_to?(:kickstart_repos) ? (operatingsystem.kickstart_repos(self)&.pluck(:id) || []) : []

  if ks_repo && valid_repos.exclude?(ks_repo.id)
    content_facet.kickstart_repository_id = valid_repos.first
  end
end

#validate_media?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 10

def validate_media?
  (content_source_id.blank? || (content_facet && content_facet.kickstart_repository.blank?)) && super
end