Class: Katello::Foreman
- Inherits:
-
Object
- Object
- Katello::Foreman
- Defined in:
- app/lib/katello/foreman.rb
Class Method Summary collapse
- .build_puppet_environment(org, env, content_view) ⇒ Object
- .update_puppet_environment(content_view, environment) ⇒ Object
Class Method Details
.build_puppet_environment(org, env, content_view) ⇒ Object
3 4 5 6 7 |
# File 'app/lib/katello/foreman.rb', line 3 def self.build_puppet_environment(org, env, content_view) unless content_view.default? Environment.find_or_build_by_katello_id(org, env, content_view) end end |
.update_puppet_environment(content_view, environment) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/lib/katello/foreman.rb', line 9 def self.update_puppet_environment(content_view, environment) content_view_puppet_env = content_view.version(environment).puppet_env(environment) if !content_view.default? && content_view_puppet_env foreman_environment = content_view_puppet_env.puppet_environment # Associate the puppet environment with the locations that are currently # associated with the capsules that have the target lifecycle environment. capsule_contents = Katello::CapsuleContent.with_environment(environment, true) unless capsule_contents.blank? locations = capsule_contents.map(&:capsule).map(&:locations).compact.flatten.uniq foreman_environment.locations = locations foreman_environment.save! end if (foreman_smart_proxy = SmartProxy.default_capsule) PuppetClassImporter.new(:url => foreman_smart_proxy.url, :env => foreman_environment.name).update_environment end end end |