Sha256: 6a4a84fdbba3fe61b844bbf3d7baee1f556201d07647a71e207088b2135f5c69

Contents?: true

Size: 1.22 KB

Versions: 30

Compression:

Stored size: 1.22 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

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/lib/katello/foreman.rb
katello-3.15.3 app/lib/katello/foreman.rb
katello-3.15.2 app/lib/katello/foreman.rb
katello-3.15.1.1 app/lib/katello/foreman.rb
katello-3.15.1 app/lib/katello/foreman.rb
katello-3.15.0.1 app/lib/katello/foreman.rb
katello-3.15.0 app/lib/katello/foreman.rb
katello-3.15.0.rc2 app/lib/katello/foreman.rb
katello-3.15.0.rc1.3 app/lib/katello/foreman.rb
katello-3.15.0.rc1.2 app/lib/katello/foreman.rb
katello-3.15.0.rc1.1 app/lib/katello/foreman.rb
katello-3.15.0.rc1 app/lib/katello/foreman.rb
katello-3.14.1 app/lib/katello/foreman.rb
katello-3.13.4 app/lib/katello/foreman.rb
katello-3.14.0 app/lib/katello/foreman.rb
katello-3.13.3 app/lib/katello/foreman.rb
katello-3.14.0.rc2 app/lib/katello/foreman.rb
katello-3.13.2 app/lib/katello/foreman.rb
katello-3.14.0.rc1 app/lib/katello/foreman.rb
katello-3.13.1 app/lib/katello/foreman.rb