lib/runcible/extensions/consumer_group.rb in runcible-0.4.10 vs lib/runcible/extensions/consumer_group.rb in runcible-0.4.11
- old
+ new
@@ -73,11 +73,11 @@
# @param [String] type_id the type of content to update (e.g. rpm, errata)
# @param [Array] units array of units to update
# @param [Hash] options to pass to content update
# @return [RestClient::Response] task representing the update operation
def self.update_content(id, type_id, units, options={})
- self.update_units(id, generate_content(type_id, units), options)
+ self.update_units(id, generate_content(type_id, units, options), options)
end
# Uninstall content from a consumer group
#
# @param [String] id the consumer group ID
@@ -90,12 +90,13 @@
# Generate the content units used by other functions
#
# @param [String] type_id the type of content (e.g. rpm, errata)
# @param [Array] units array of units
+ # @param [Hash] options contains options which may impact the format of the content (e.g :all => true)
# @return [Array] array of formatted content units
- def self.generate_content(type_id, units)
+ def self.generate_content(type_id, units, options={})
content = []
case type_id
when 'rpm', 'package_group'
unit_key = :name
@@ -103,14 +104,21 @@
unit_key = :id
else
unit_key = :id
end
- units.each do |unit|
+ if options[:all]
content_unit = {}
content_unit[:type_id] = type_id
- content_unit[:unit_key] = { unit_key => unit }
+ content_unit[:unit_key] = {}
content.push(content_unit)
+ else
+ units.each do |unit|
+ content_unit = {}
+ content_unit[:type_id] = type_id
+ content_unit[:unit_key] = { unit_key => unit }
+ content.push(content_unit)
+ end
end
content
end
end