summaryrefslogtreecommitdiffstats
path: root/contrib/ruby/lib/cobbler/distro.rb
blob: a8e85b936f99681a0a2b4858d7bf97c3550bc3ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#
# distro.rb 
# 
# Copyright (C) 2008 Red Hat, Inc.
# Written by Darryl L. Pierce <dpierce@redhat.com>
#
# This file is part of rubygem-cobbler.
#
# rubygem-cobbleris free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published 
# by the Free Software Foundation, either version 2.1 of the License, or
# (at your option) any later version.
#
# rubygem-cobbler is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with rubygem-cobbler.  If not, see <http://www.gnu.org/licenses/>.
#
 
module Cobbler
  
  # +Distro+ represents a single distrobution within Cobbler.
  #
  class Distro < Base
    cobbler_lifecycle :find_all => 'get_distros',
      :find_one => 'get_distro',
      :remove => 'remove_distro'
    
    cobbler_field :name
    cobbler_collection :owners, :packing => :array
    cobbler_field :kernel
    cobbler_field :breed
    cobbler_field :depth
    cobbler_field :arch
    cobbler_field :initrd
    cobbler_field :source_repos
    cobbler_field :kernel_options
    cobbler_field :parent
    cobbler_field :ks_meta
    
    def initialize(definitions = nil)
      super(definitions)
    end
    
    private
    
    # Creates a new instance of +Profile+ from a result received from Cobbler.
    #
    def self.create(attrs)
      Distro.new(attrs)
    end
  end
end