Sha256: 917f94721245752984bee9fe30133f8863905e904a85d607b779bb59bf04b248

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

# rubocop:disable AccessModifierIndentation

module Katello
  module Services
    module PuppetClassImporterExtensions
      extend ActiveSupport::Concern

      included do
        def update_environment
          change_types = %w(new obsolete updated)
          changed  = self.changes

          change_types.each do |kind|
            changed[kind].slice!(@environment) unless changed[kind].empty?
          end

          #prevent the puppet environment from being deleted, by removing special '_destroy_' String
          if changed['obsolete'][@environment]
            changed['obsolete'][@environment] =
              changed['obsolete'][@environment].select { |klass| klass != '_destroy_' }
          end

          # PuppetClassImporter expects [kind][env] to be in json format
          change_types.each do |kind|
            unless (envs = changed[kind]).empty?
              envs.keys.sort.each do |env|
                changed[kind][env] = changed[kind][env].to_json
              end
            end
          end

          self.obsolete_and_new(changed)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.4 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.3 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.2 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.1 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.0 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.0.rc3 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.0.rc2 app/services/katello/puppet_class_importer_extensions.rb
katello-2.4.0.rc1 app/services/katello/puppet_class_importer_extensions.rb