lib/runcible/extensions/consumer_group.rb in runcible-1.2.0 vs lib/runcible/extensions/consumer_group.rb in runcible-1.3.0

- old
+ new

@@ -19,15 +19,13 @@ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - module Runcible module Extensions class ConsumerGroup < Runcible::Resources::ConsumerGroup - # Add consumers by ID to a consumer group # # @param [String] id the consumer group ID # @param [Array] consumer_ids array of consumer IDs to add to the group # @return [RestClient::Response] list of consumer IDs @@ -49,11 +47,11 @@ # @param [Array] consumer_ids array of consumer IDs # @return [Hash] the formatted query for consumers def make_consumer_criteria(consumer_ids) {:criteria => {:filters => - {:id =>{"$in" =>consumer_ids}} + {:id => {'$in' => consumer_ids}} } } end # Install content to a consumer group @@ -61,22 +59,22 @@ # @param [String] id the consumer group ID # @param [String] type_id the type of content to install (e.g. rpm, errata) # @param [Array] units array of units to install # @param [Hash] options to pass to content install # @return [RestClient::Response] task representing the install operation - def install_content(id, type_id, units, options={}) + def install_content(id, type_id, units, options = {}) install_units(id, generate_content(type_id, units), options) end # Update content on a consumer group # # @param [String] id the consumer group ID # @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 update_content(id, type_id, units, options={}) + def update_content(id, type_id, units, options = {}) update_units(id, generate_content(type_id, units, options), options) end # Uninstall content from a consumer group # @@ -92,20 +90,20 @@ # # @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 generate_content(type_id, units, options={}) + def generate_content(type_id, units, options = {}) content = [] case type_id - when 'rpm', 'package_group' - unit_key = :name - when 'erratum' - unit_key = :id - else - unit_key = :id + when 'rpm', 'package_group' + unit_key = :name + when 'erratum' + unit_key = :id + else + unit_key = :id end if options[:all] content_unit = {} content_unit[:type_id] = type_id @@ -119,9 +117,8 @@ content.push(content_unit) end end content end - end end end