Class: Actions::Katello::Repository::CloneToEnvironment
- Inherits:
-
Base
- Object
- Base
- Actions::Katello::Repository::CloneToEnvironment
- Defined in:
- app/lib/actions/katello/repository/clone_to_environment.rb
Overview
Clones the contnet of the repository into the environment effectively promotion the repository to the environment
Instance Method Summary collapse
-
#find_or_build_environment_clone(repository, environment) ⇒ Object
The environment clone clone of the repository is the one visible for the systems in the environment.
- #plan(repository, environment) ⇒ Object
Instance Method Details
#find_or_build_environment_clone(repository, environment) ⇒ Object
The environment clone clone of the repository is the one visible for the systems in the environment
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/lib/actions/katello/repository/clone_to_environment.rb', line 29 def find_or_build_environment_clone(repository, environment) version = repository.content_view_version clone = version.content_view.get_repo_clone(environment, repository).first if clone clone = ::Katello::Repository.find(clone.id) # reload readonly object clone.update_attributes!(content_view_version_id: version.id) else clone = repository.build_clone(environment: environment, content_view: version.content_view) end return clone end |
#plan(repository, environment) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/lib/actions/katello/repository/clone_to_environment.rb', line 7 def plan(repository, environment) clone = find_or_build_environment_clone(repository, environment) sequence do if clone.new_record? plan_action(Repository::Create, clone, true, false) else plan_action(Repository::Clear, clone) end if repository.yum? plan_action(Repository::CloneYumContent, repository, clone, [], false) elsif repository.docker? plan_action(Repository::CloneDockerContent, repository, clone) elsif repository.ostree? plan_action(Repository::CloneOstreeContent, repository, clone) end end end |