Module: Katello::Concerns::RedhatExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/katello/concerns/redhat_extensions.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#boot_files_uri_with_content(medium, architecture, host = nil) ⇒ Object

overwrite foreman method in operatingsystem.rb



82
83
84
85
86
87
88
# File 'app/models/katello/concerns/redhat_extensions.rb', line 82

def boot_files_uri_with_content(medium, architecture, host = nil)
  return boot_files_uri_without_content(medium, architecture, host) unless host.try(:content_source)
  family_class = self.family.constantize
  family_class::PXEFILES.values.collect do |img|
    "#{medium_uri(host)}/#{pxedir}/#{img}"
  end
end

#distribution_repositories(host) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/katello/concerns/redhat_extensions.rb', line 67

def distribution_repositories(host)
  content_view = host.try(:content_facet).try(:content_view) || host.try(:content_view)
  lifecycle_environment = host.try(:content_facet).try(:lifecycle_environment) || host.try(:lifecycle_environment)

  if content_view && lifecycle_environment
    Katello::Repository.in_environment(lifecycle_environment).in_content_views([content_view]).
        where(:distribution_version => host.os.release,
              :distribution_arch => host.architecture.name,
              :distribution_bootable => true)
  else
    []
  end
end

#kickstart_repos(host) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'app/models/katello/concerns/redhat_extensions.rb', line 56

def kickstart_repos(host)
  distros = distribution_repositories(host)
  if distros && host.content_source
    distros.map do |distro|
      {:id => distro.id, :name => distro.name, :path => distro.full_path(host.content_source)}
    end
  else
    []
  end
end

#medium_uri_with_content_uri(host, url = nil) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'app/models/katello/concerns/redhat_extensions.rb', line 46

def medium_uri_with_content_uri(host, url = nil)
  kickstart_repo = host.try(:content_facet).try(:kickstart_repository) || host.try(:kickstart_repository)

  if host.try(:content_source) && kickstart_repo.present?
    return URI.parse(kickstart_repo.full_path(host.content_source))
  else
    medium_uri_without_content_uri(host, url)
  end
end