Sha256: 856adb60d22b99e5bb0d631d2510efa03049673b597de33d57d19accab9a5de7

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

#   Copyright 2011 Red Hat, Inc.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

module Aeolus
  module Image
    module Warehouse
      class Icicle < WarehouseModel
        @bucket_name = 'icicles'

        def packages
          unless @packages
            begin
              package_elems = get_icicle.xpath('icicle/packages/package')
              @packages = package_elems.map { |node| node.attributes['name'].text }
            rescue
              @packages = []
            end
          end
          @packages
        end

        def description
          unless @description
            begin
              @description = get_icicle.xpath('icicle/description').text
            rescue
              @description = []
            end
          end
          @description
        end

        def get_icicle
          unless @icicle_xml
              icicle = Icicle.bucket.objects.find(@uuid) if @uuid
            begin
              @icicle_xml = Nokogiri::XML icicle.first.body
            rescue
              @icicle_xml = Nokogiri::XML '<icicle></icicle>'
            end
          end
          @icicle_xml
        end


      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aeolus-image-0.7.0 lib/aeolus_image/model/warehouse/icicle.rb
aeolus-image-0.5.1 lib/aeolus_image/model/warehouse/icicle.rb
aeolus-image-0.4.0 lib/aeolus_image/model/warehouse/icicle.rb