Skip to content

Commit

Permalink
Merge pull request Katello#79 from thomasmckay/system-release-version
Browse files Browse the repository at this point in the history
818711 - pull available release versions from CDN
  • Loading branch information
iNecas committed May 7, 2012
2 parents 7c77ad2 + 2af3191 commit 012f5e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/models/kt_environment.rb
Expand Up @@ -407,7 +407,7 @@ def available_releases
if AppConfig.katello?
self.repositories.enabled.map(&:minor).compact.uniq.sort
else
self.organization.library.repositories.map(&:minor).compact.uniq.sort
self.organization.redhat_provider.available_releases
end
end

Expand Down
19 changes: 19 additions & 0 deletions src/app/models/provider.rb
Expand Up @@ -206,6 +206,25 @@ def refresh_products
end
end

def available_releases
releases = []
CDN::CdnVarSubstitutor.with_cache do
self.products.engineering.each do |product|
cdn_var_substitutor = CDN::CdnVarSubstitutor.new(product.provider[:repository_url],
:ssl_client_cert => OpenSSL::X509::Certificate.new(product.certificate),
:ssl_client_key => OpenSSL::PKey::RSA.new(product.key))
product.productContent.each do |pc|
if url_to_releases = pc.content.contentUrl[/^.*\$releasever/]
cdn_var_substitutor.substitute_vars(url_to_releases).each do |(substitutions, path)|
releases << CDN::Utils.parse_version(substitutions['releasever'])[:minor]
end
end
end
end
end
releases.uniq.sort
end

protected

def sanitize_repository_url
Expand Down

0 comments on commit 012f5e5

Please sign in to comment.