Skip to content

Commit

Permalink
Make the new repository from CloneToVersoin available for superior ac…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
iNecas committed Mar 5, 2014
1 parent c0391a3 commit 39fc122
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
10 changes: 3 additions & 7 deletions app/lib/actions/katello/content_view/publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def plan(content_view)

sequence do
concurrence do
content_view.repositories.each do |repo|
content_view.repositories.each do |repository|
sequence do
plan_action(Repository::CloneToVersion, repo, version)
plan_action(Repository::CloneToEnvironment, version_repo(version, repo), library)
clone_to_version = plan_action(Repository::CloneToVersion, repository, version)
plan_action(Repository::CloneToEnvironment, clone_to_version.new_repository, library)
end
end
repos_to_delete(content_view).each do |repo|
Expand All @@ -46,10 +46,6 @@ def humanized_name

private

def version_repo(version, repo)
version.repositories.find_by_library_instance_id!(repo.id)
end

def repos_to_delete(content_view)
content_view.repos(content_view.organization.library).find_all do |repo|
!content_view.repository_ids.include?(repo.library_instance_id)
Expand Down
11 changes: 7 additions & 4 deletions app/lib/actions/katello/repository/clone_to_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ module Katello
module Repository
class CloneToVersion < Actions::Base

# allows accessing the build object from the superior action
attr_accessor :new_repository

def plan(repository, content_view_version)
content_view = content_view_version.content_view
filters = content_view.filters.applicable(repository)
clone = repository.build_clone(content_view: content_view,
version: content_view_version)
self.new_repository = repository.build_clone(content_view: content_view,
version: content_view_version)
sequence do
plan_action(Repository::Create, clone, true)
plan_action(Repository::CloneContent, repository, clone, filters)
plan_action(Repository::Create, new_repository, true)
plan_action(Repository::CloneContent, repository, new_repository, filters)
end
end

Expand Down
5 changes: 4 additions & 1 deletion app/lib/actions/katello/repository/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def plan(repository, clone = false)
plan_self

org = repository.organization
#check the instance variable, as we do not want to go to pulp
# check the instance variable, as we do not want to go to pulp
checksum_type = repository.checksum_type if self.instance_variable_get('@checksum_type')
if repository.puppet?
path = File.join(::Katello.config.puppet_repo_root,
Expand All @@ -46,6 +46,9 @@ def plan(repository, clone = false)
checksum_type: checksum_type,
path: path,
with_importer: true)

# when creating a clone, the following actions are handled by the
# publish/promote process
unless clone
content_create = plan_action(Katello::Product::ContentCreate, repository)
plan_action(Katello::Repository::MetadataGenerate, repository)
Expand Down

0 comments on commit 39fc122

Please sign in to comment.