Project

General

Profile

Revision 1a2d49fd

Added by Justin Sherrill almost 6 years ago

Fixes #16466 - Add support for applicable rpms

View differences:

lib/runcible/extensions/consumer.rb
141 141
      # Retrieve the set of errata that is applicable to a consumer(s)
142 142
      #
143 143
      # @param  [String, Array]         ids             string containing a single consumer id or an array of ids
144
      # @param  [Array]                 repoids         array of repository ids
145
      # @param  [Boolean]               consumer_report if true, result will list consumers and their
146
      #                                                 applicable errata; otherwise, it will list
147
      #                                                 errata and the consumers they are applicable to
148 144
      # @return [RestClient::Response]  content applicability hash with details of errata available to consumer(s)
149 145
      def applicable_errata(ids)
146
        applicable_for_type(ids, Runcible::Extensions::Errata.content_type)
147
      end
148

  
149
      # Retrieve the set of rpms that are applicable to a consumer(s)
150
      #
151
      # @param  [String, Array]         ids             string containing a single consumer id or an array of ids
152
      # @return [RestClient::Response]  content applicability hash with details of rpms available to consumer(s)
153
      def applicable_rpms(ids)
154
        applicable_for_type(ids, Runcible::Extensions::Rpm.content_type)
155
      end
156

  
157
      private
158

  
159
      def applicable_for_type(ids, type)
150 160
        ids = [ids] if ids.is_a? String
151 161

  
152 162
        criteria = {
153 163
          'criteria' => { 'filters' => { 'id' => { '$in' => ids } } },
154
          'content_types' => [Runcible::Extensions::Errata.content_type]
164
          'content_types' => [type]
155 165
        }
156 166
        applicability(criteria)
157 167
      end
158 168

  
159
      private
160

  
161 169
      def repository_extension
162 170
        Runcible::Extensions::Repository.new(self.config)
163 171
      end

Also available in: Unified diff