Sha256: d150d375de904852d21f5ca5c9b8265e26fa06532ef4352570d178fcd06ece89

Contents?: true

Size: 1.27 KB

Versions: 16

Compression:

Stored size: 1.27 KB

Contents

module Katello
  class Foreman
    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

    def self.update_puppet_environment(content_view, environment)
      User.as_anonymous_admin do
        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 = SmartProxy.with_environment(environment, true)
          unless capsule_contents.blank?
            locations = capsule_contents.map(&:locations).compact.flatten.uniq
            foreman_environment.locations = locations
            foreman_environment.save!
          end

          foreman_smart_proxy = SmartProxy.pulp_master
          if foreman_smart_proxy.has_feature?('Puppet')
            PuppetClassImporter.new(:url => foreman_smart_proxy.url, :env => foreman_environment.name).update_environment
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.16.2 app/lib/katello/foreman.rb
katello-3.16.1.2 app/lib/katello/foreman.rb
katello-3.16.1.1 app/lib/katello/foreman.rb
katello-3.16.1 app/lib/katello/foreman.rb
katello-3.17.0.rc1 app/lib/katello/foreman.rb
katello-3.16.0 app/lib/katello/foreman.rb
katello-3.16.0.rc5.1 app/lib/katello/foreman.rb
katello-3.16.0.rc5 app/lib/katello/foreman.rb
katello-3.16.0.rc4.1 app/lib/katello/foreman.rb
katello-3.16.0.rc4 app/lib/katello/foreman.rb
katello-3.16.0.rc3.1 app/lib/katello/foreman.rb
katello-3.16.0.rc3 app/lib/katello/foreman.rb
katello-3.16.0.rc2.1 app/lib/katello/foreman.rb
katello-3.16.0.rc2 app/lib/katello/foreman.rb
katello-3.16.0.rc1.1 app/lib/katello/foreman.rb
katello-3.16.0.rc1 app/lib/katello/foreman.rb