Darryl L. Pierce wrote:
> Also fixed some of the decoding for interfaces returned for systems. But I'm 
> not happy with that binding still.
>
> Signed-off-by: Darryl L. Pierce <[EMAIL PROTECTED]>
> ---
>  contrib/ruby/examples/create_system.rb        |    6 ++-
>  contrib/ruby/examples/has_image.rb            |   65 ++++++++++++++++++++
>  contrib/ruby/examples/has_system.rb           |   18 +++---
>  contrib/ruby/examples/list_images.rb          |   52 ++++++++++++++++
>  contrib/ruby/examples/list_systems.rb         |   19 +++++-
>  contrib/ruby/lib/cobbler.rb                   |    1 +
>  contrib/ruby/lib/cobbler/base.rb              |   30 ++++++---
>  contrib/ruby/lib/cobbler/image.rb             |   55 +++++++++++++++++
>  contrib/ruby/lib/cobbler/network_interface.rb |    4 +-
>  contrib/ruby/lib/cobbler/system.rb            |   43 +++++++-------
>  contrib/ruby/test/test_image.rb               |   80 
> +++++++++++++++++++++++++
>  contrib/ruby/test/test_system.rb              |   28 ++++++---
>  12 files changed, 344 insertions(+), 57 deletions(-)
>  mode change 100644 => 100755 contrib/ruby/examples/create_system.rb
>  mode change 100644 => 100755 contrib/ruby/examples/has_distro.rb
>  create mode 100755 contrib/ruby/examples/has_image.rb
>  mode change 100644 => 100755 contrib/ruby/examples/has_profile.rb
>  mode change 100644 => 100755 contrib/ruby/examples/has_system.rb
>  mode change 100644 => 100755 contrib/ruby/examples/list_distros.rb
>  create mode 100755 contrib/ruby/examples/list_images.rb
>  mode change 100644 => 100755 contrib/ruby/examples/list_profiles.rb
>  mode change 100644 => 100755 contrib/ruby/examples/list_systems.rb
>  mode change 100644 => 100755 contrib/ruby/examples/remove_distro.rb
>  mode change 100644 => 100755 contrib/ruby/examples/remove_system.rb
>  create mode 100644 contrib/ruby/lib/cobbler/image.rb
>  create mode 100644 contrib/ruby/test/test_image.rb
>
> diff --git a/contrib/ruby/examples/create_system.rb 
> b/contrib/ruby/examples/create_system.rb
> old mode 100644
> new mode 100755
> index 0196573..43a8fc4
> --- a/contrib/ruby/examples/create_system.rb
> +++ b/contrib/ruby/examples/create_system.rb
> @@ -60,9 +60,13 @@ end
>    
>  if name && profile 
>    
> +  System.hostname = hostname if hostname
> +  System.username = username if username
> +  System.password = password if password
> +  
>    system = System.new('name' => name,'profile' => profile)
>    
> -  system.interfaces=[ NetworkInterface.new('mac_address' => 
> '00:11:22:33:44:55:66:77') ]
> +  system.interfaces=[NetworkInterface.new(["intf",{'mac_address' => 
> '00:11:22:33:44:55:66:77'}])]
>  
>    puts "Saving a new system with name #{system.name} based on the profile 
> #{system.profile}."
>  
> diff --git a/contrib/ruby/examples/has_distro.rb 
> b/contrib/ruby/examples/has_distro.rb
> old mode 100644
> new mode 100755
> diff --git a/contrib/ruby/examples/has_image.rb 
> b/contrib/ruby/examples/has_image.rb
> new file mode 100755
> index 0000000..8442f6e
> --- /dev/null
> +++ b/contrib/ruby/examples/has_image.rb
> @@ -0,0 +1,65 @@
> +#!/usr/bin/ruby
> +#
> +# has_image.rb - example of using rubygem-cobbler to check if an image 
> exists.
> +# 
> +# Copyright (C) 2008 Red Hat, Inc.
> +# Written by Darryl L. Pierce <dpierceredhat.com>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 2 of the License.
> +#
> +# This program 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 this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA  02110-1301, USA.  A copy of the GNU General Public License is
> +# also available at http://www.gnu.org/copyleft/gpl.html.
> + 
> +base = File.expand_path(File.join(File.dirname(__FILE__), ".."))
> +$LOAD_PATH << File.join(base, "lib")
> +$LOAD_PATH << File.join(base, "examples")
> +
> +require 'getoptlong'
> +
> +require 'cobbler'
> +
> +include Cobbler
> +
> +opts = GetoptLong.new(
> +  ["--server",  "-s", GetoptLong::REQUIRED_ARGUMENT ],
> +  ["--image",   "-i", GetoptLong::REQUIRED_ARGUMENT ],
> +  ["--help",    "-h", GetoptLong::NO_ARGUMENT]
> +)
> +
> +hostname = nil
> +image    = nil
> +
> +opts.each do |opt, arg|
> +  case opt
> +  when '--server'  then hostname = arg
> +  when '--image'   then image    = arg
> +  when '--help'    then 
> +    puts "Usage: #{$0} --server hostname --image image-name\n"
> +  end
> +end
> +
> +SystemExit.new('No hostname specified.') unless hostname
> +
> +if hostname
> +  Base.hostname = hostname
> +  
> +  puts "Finding any system that matches \"#{image}\""
> +    
> +  result = Image.find_one(image)
> +  
> +  if result
> +    puts "#{result.name} exists, and uses #{result.file}."
> +  else
> +    puts "No such system: #{image}"
> +  end
> +end
> \ No newline at end of file
> diff --git a/contrib/ruby/examples/has_profile.rb 
> b/contrib/ruby/examples/has_profile.rb
> old mode 100644
> new mode 100755
> diff --git a/contrib/ruby/examples/has_system.rb 
> b/contrib/ruby/examples/has_system.rb
> old mode 100644
> new mode 100755
> index 9088666..69c52a9
> --- a/contrib/ruby/examples/has_system.rb
> +++ b/contrib/ruby/examples/has_system.rb
> @@ -50,16 +50,14 @@ end
>  
>  SystemExit.new('No hostname specified.') unless hostname
>  
> -if hostname
> -  Base.hostname = hostname
> +Base.hostname = hostname if hostname
>    
> -  puts "Finding any system that matches \"#{system}\""
> +puts "Finding any system that matches \"#{system}\""
>      
> -  result = System.find_one(system)
> +result = System.find_one(system)
>    
> -  if result
> -    puts "#{result.name} exists, and is owned by #{result.owners}."
> -  else
> -    puts "No such system: #{system}"
> -  end
> -end
> \ No newline at end of file
> +if result
> +  puts "#{result.name} exists, and is owned by #{result.owners}."
> +else
> +  puts "No such system: #{system}"
> +end
> diff --git a/contrib/ruby/examples/list_distros.rb 
> b/contrib/ruby/examples/list_distros.rb
> old mode 100644
> new mode 100755
> diff --git a/contrib/ruby/examples/list_images.rb 
> b/contrib/ruby/examples/list_images.rb
> new file mode 100755
> index 0000000..0df5611
> --- /dev/null
> +++ b/contrib/ruby/examples/list_images.rb
> @@ -0,0 +1,52 @@
> +#!/usr/bin/ruby 
> +#
> +# list_images.rb - example of using rubygem-cobbler to list images.
> +# 
> +# Copyright (C) 2008 Red Hat, Inc.
> +# Written by Darryl L. Pierce <[EMAIL PROTECTED]>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 2 of the License.
> +#
> +# This program 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 this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA  02110-1301, USA.  A copy of the GNU General Public License is
> +# also available at http://www.gnu.org/copyleft/gpl.html.
> + 
> +base = File.expand_path(File.join(File.dirname(__FILE__), ".."))
> +$LOAD_PATH << File.join(base, "lib")
> +$LOAD_PATH << File.join(base, "examples")
> +
> +require 'getoptlong'
> +
> +require 'cobbler'
> +
> +include Cobbler
> +
> +opts = GetoptLong.new(
> +  ["--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
> +  ["--help",   "-h", GetoptLong::NO_ARGUMENT]
> +)
> +
> +hostname = nil
> +
> +opts.each do |opt, arg|
> +  case opt
> +  when '--server' then hostname = arg
> +  when '--help'   then 
> +    puts "Usage: #{$0} --server hostname\n"
> +  end
> +end
> +
> +
> +Base.hostname = hostname if hostname
> +  
> +puts "Results:"
> +Image.find { |image| puts "\"#{image.name}\" uses \"#{image.file}\"."}
> diff --git a/contrib/ruby/examples/list_profiles.rb 
> b/contrib/ruby/examples/list_profiles.rb
> old mode 100644
> new mode 100755
> diff --git a/contrib/ruby/examples/list_systems.rb 
> b/contrib/ruby/examples/list_systems.rb
> old mode 100644
> new mode 100755
> index d614460..fbee42c
> --- a/contrib/ruby/examples/list_systems.rb
> +++ b/contrib/ruby/examples/list_systems.rb
> @@ -31,15 +31,18 @@ require 'cobbler'
>  include Cobbler
>  
>  opts = GetoptLong.new(
> -  ["--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
> -  ["--help",   "-h", GetoptLong::NO_ARGUMENT]
> +  ["--server",  "-s", GetoptLong::REQUIRED_ARGUMENT ],
> +  ["--details", "-d", GetoptLong::NO_ARGUMENT ],
> +  ["--help",    "-h", GetoptLong::NO_ARGUMENT ]
>  )
>  
>  hostname = nil
> +details  = false
>  
>  opts.each do |opt, arg|
>    case opt
> -  when '--server' then hostname = arg
> +  when '--server'  then hostname = arg
> +  when '--details' then details  = true
>    when '--help'   then 
>      puts "Usage: #{$0} --server hostname\n"
>    end
> @@ -49,4 +52,12 @@ end
>  Base.hostname = hostname if hostname
>    
>  puts "Results:"
> -System.find { |system| puts "\"#{system.name}\" is based on 
> \"#{system.profile}\"."}
> +System.find do |system| 
> +  puts "\"#{system.name}\" is based on \"#{system.profile}\"."
> +  
> +  if details
> +    puts "\tOwner: #{system.owners}"
> +    system.interfaces.each { |nic| puts "\tNIC: #{nic.mac_address}"} 
> +  end
> +  
> +end
> \ No newline at end of file
> diff --git a/contrib/ruby/examples/remove_distro.rb 
> b/contrib/ruby/examples/remove_distro.rb
> old mode 100644
> new mode 100755
> diff --git a/contrib/ruby/examples/remove_system.rb 
> b/contrib/ruby/examples/remove_system.rb
> old mode 100644
> new mode 100755
> diff --git a/contrib/ruby/lib/cobbler.rb b/contrib/ruby/lib/cobbler.rb
> index 379d746..1247a63 100644
> --- a/contrib/ruby/lib/cobbler.rb
> +++ b/contrib/ruby/lib/cobbler.rb
> @@ -20,6 +20,7 @@
>  
>  require 'cobbler/base'
>  require 'cobbler/distro'
> +require 'cobbler/image'
>  require 'cobbler/network_interface'
>  require 'cobbler/profile'
>  require 'cobbler/system'
> diff --git a/contrib/ruby/lib/cobbler/base.rb 
> b/contrib/ruby/lib/cobbler/base.rb
> index a2b3e83..ea75ef3 100644
> --- a/contrib/ruby/lib/cobbler/base.rb
> +++ b/contrib/ruby/lib/cobbler/base.rb
> @@ -30,9 +30,10 @@ module Cobbler
>    # Child classes can define fields that will be retrieved from Cobbler by 
>    # using the +cobbler_field+ method. For example:
>    # 
> -  #   class Farkle < Base
> -  #       cobbler_field :name, findable => 'get_farkle'
> -  #       cobbler_field :owner
> +  #   class System < Base
> +  #       cobbler_lifecycle :find_all => 'get_systems'
> +  #       cobbler_field :name
> +  #       cobbler_field :owner, :array => 'String'
>    #   end
>    #   
>    # declares a class named Farkle that contains two fields. The first, 
> "name",
> @@ -106,7 +107,7 @@ module Cobbler
>        @@connection = nil
>      end
>      
> -    def definition(key)
> +    def definition(key)      
>        @definitions ? @definitions[key] : nil
>      end
>      
> @@ -203,8 +204,8 @@ module Cobbler
>                when :findable then      
>                
>                  module_eval <<-"end;"
> -                  def self.find_by_#{field.to_s}(name,&block)
> -                    properties = make_call('#{arg[key]}',name)
> +                  def self.find_by_#{field.to_s}(value,&block)
> +                    properties = make_call('#{arg[key]}',value)
>  
>                      return create(properties) if properties && 
> !properties.empty?
>  
> @@ -232,17 +233,26 @@ module Cobbler
>        # other class must be provided.
>        #
>        def cobbler_collection(field, *args) # :nodoc:
> -        classname = args[0][:type]
> +        classname = 'String' 
> +        packing   = :array
> +        
> +        # process collection definition
> +        args.each do |arg|
> +          classname = arg[:type]    if arg[:type]
> +          packing   = arg[:packing] if arg[:packing]
> +        end
>          
>          module_eval <<-"end;"
>            def #{field.to_s}(&block)
> +
>              unless @#{field.to_s}
>                @#{field.to_s} = Array.new
>  
> -              definition('#{field.to_s}').values.each do |value|
> -                @#{field.to_s} << #{classname}.new(value)
> +              definition('#{field.to_s}').each do |value|
> +                if value
> +                  @#{field.to_s} << #{classname}.new(value)
> +                end
>                end
> -
>              end
>  
>              @#{field.to_s}
> diff --git a/contrib/ruby/lib/cobbler/image.rb 
> b/contrib/ruby/lib/cobbler/image.rb
> new file mode 100644
> index 0000000..ce12dac
> --- /dev/null
> +++ b/contrib/ruby/lib/cobbler/image.rb
> @@ -0,0 +1,55 @@
> +# image.rb 
> +# 
> +# Copyright (C) 2008 Red Hat, Inc.
> +# Written by Darryl L. Pierce <[EMAIL PROTECTED]>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 2 of the License.
> +#
> +# This program 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 this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA  02110-1301, USA.  A copy of the GNU General Public License is
> +# also available at http://www.gnu.org/copyleft/gpl.html.
> +
> +module Cobbler
> +  
> +  # +Image+ represents an image within Cobbler.
> +  #
> +  class Image < Base
> +    
> +    cobbler_lifecycle :find_all => 'get_images', 
> +      :find_one => 'get_image', 
> +      :remove => 'remove_image'
> +    
> +    cobbler_field :name
> +    cobbler_field :owners
> +    cobbler_field :depth
> +    cobbler_field :virt_file_size
> +    cobbler_field :virt_path
> +    cobbler_field :xml_file
> +    cobbler_field :virt_bridge
> +    cobbler_field :virt_ram
> +    cobbler_field :file
> +    cobbler_field :virt_cpus
> +    cobbler_field :parent
> +
> +    def initialize(definitions)
> +      super(definitions)
> +    end
> +    
> +    private
> +    
> +    # Creates a new instance of +System+ from a result received from Cobbler.
> +    #
> +    def self.create(attrs)
> +      Image.new(attrs)
> +    end
> +  end
> +end
> \ No newline at end of file
> diff --git a/contrib/ruby/lib/cobbler/network_interface.rb 
> b/contrib/ruby/lib/cobbler/network_interface.rb
> index 5ef4a3b..3437714 100644
> --- a/contrib/ruby/lib/cobbler/network_interface.rb
> +++ b/contrib/ruby/lib/cobbler/network_interface.rb
> @@ -30,8 +30,8 @@ module Cobbler
>      cobbler_field :virt_bridge
>      cobbler_field :ip_address
>      
> -    def initialize(definitions)
> -      @definitions = definitions
> +    def initialize(args)
> +      @definitions = args[1]
>      end
>     
>      # A hack for getting the NIC's details over the wire.
> diff --git a/contrib/ruby/lib/cobbler/system.rb 
> b/contrib/ruby/lib/cobbler/system.rb
> index acfa3f5..c15d225 100644
> --- a/contrib/ruby/lib/cobbler/system.rb
> +++ b/contrib/ruby/lib/cobbler/system.rb
> @@ -28,24 +28,23 @@ module Cobbler
>        :find_one => 'get_system', 
>        :remove => 'remove_system'
>      
> -    cobbler_field :name
> -    cobbler_field :parent
> -    cobbler_field :profile
> -    cobbler_field :depth
> -    cobbler_field :kernel_options
> -    cobbler_field :kickstart
> -    cobbler_field :ks_meta
> -    cobbler_field :netboot_enabled
> -    cobbler_field :owners
> -    cobbler_field :server
> -    cobbler_field :virt_cpus
> -    cobbler_field :virt_file_size
> -    cobbler_field :virt_path
> -    cobbler_field :virt_ram
> -    cobbler_field :virt_type
> -    cobbler_field :virt_bridge
> -    
> -    cobbler_collection :interfaces, :type => 'NetworkInterface'
> +    cobbler_field      :name
> +    cobbler_field      :parent
> +    cobbler_field      :profile
> +    cobbler_field      :depth
> +    cobbler_field      :kernel_options
> +    cobbler_field      :kickstart
> +    cobbler_field      :ks_meta
> +    cobbler_field      :netboot_enabled
> +    cobbler_collection :owners
> +    cobbler_field      :server
> +    cobbler_field      :virt_cpus
> +    cobbler_field      :virt_file_size
> +    cobbler_field      :virt_path
> +    cobbler_field      :virt_ram
> +    cobbler_field      :virt_type
> +    cobbler_field      :virt_bridge     
> +    cobbler_collection :interfaces, :type => 'NetworkInterface', :packing => 
> :hash
>  
>      def initialize(definitions)
>        super(definitions)
> @@ -62,13 +61,13 @@ module Cobbler
>        Base.make_call('modify_system',sysid,'name',self.name,token)
>        Base.make_call('modify_system',sysid,'profile',profile,token)
>        
> -      unless interfaces.empty?
> +      if @interfaces
>          count = 0
> -        interfaces.each do |interface|
> +        @interfaces.each do |interface|
>          
> -          values = interface.bundle_for_saving(count)
> +          values = interface.bundle_for_saving(count)     
>            
> -          unless values.empty?
> +          unless values.empty?            
>              
> Base.make_call('modify_system',sysid,'modify-interface',values,token)        
>              count = count + 1
>            end
> diff --git a/contrib/ruby/test/test_image.rb b/contrib/ruby/test/test_image.rb
> new file mode 100644
> index 0000000..02b2776
> --- /dev/null
> +++ b/contrib/ruby/test/test_image.rb
> @@ -0,0 +1,80 @@
> +# test_image.rb - Tests the Image class.
> +# 
> +# Copyright (C) 2008 Red Hat, Inc.
> +# Written by Darryl L. Pierce <[EMAIL PROTECTED]>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 2 of the License.
> +#
> +# This program 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 this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA  02110-1301, USA.  A copy of the GNU General Public License is
> +# also available at http://www.gnu.org/copyleft/gpl.html.
> + 
> +
> +$:.unshift File.join(File.dirname(__FILE__),'..','lib')
> +
> +require 'test/unit'
> +require 'flexmock/test_unit'
> +require 'cobbler'
> +
> +module Cobbler
> +  class TestImage < Test::Unit::TestCase
> +    def setup
> +      @connection = flexmock('connection')
> +      Image.connection = @connection
> +      Image.hostname   = "localhost"
> +      
> +      @username        = 'dpierce'
> +      @password        = 'farkle'
> +      Image.username = @username
> +      Image.password = @password
> +
> +      @images = Array.new
> +      @images << {
> +        'name'            => 'Fedora-9-LiveCD-KDE',
> +        'owners'          => 'admin',
> +        'depth'           => '2',
> +        'virt_file_size'  => '<<inherit>>',
> +        'virt_path'       => '<<inherit>>',
> +        'virt_bridge'     => '<<inherit>>',
> +        'virt_ram'        => '<<inherit>>',
> +        'virt_cpus'       => '<<inherit>>',
> +        'file'            => '/var/ftp/pub/Fedora-9-i686-Live-KDE.iso',
> +        'parent'          => nil,
> +      }
> +
> +      @images << {
> +        'name'            => 'Fedora-9-LiveCD-GNOME',
> +        'owners'          => 'admin',
> +        'depth'           => '2',
> +        'virt_file_size'  => '<<inherit>>',
> +        'virt_path'       => '<<inherit>>',
> +        'virt_bridge'     => '<<inherit>>',
> +        'virt_ram'        => '<<inherit>>',
> +        'virt_cpus'       => '<<inherit>>',
> +        'file'            => '/var/ftp/pub/Fedora-9-i686-Live.iso',
> +        'parent'          => nil,
> +      }
> +
> +    end
> +
> +    # Ensures that an attempt to find all profiles works as expected.
> +    #
> +    def test_find
> +      
> @connection.should_receive(:call).with('get_images').once.returns(@images)
> +
> +      result = Image.find
> +
> +      assert result, 'Expected a result set.'
> +      assert_equal 2, result.size, 'Did not receive the right number of 
> results'
> +    end
> +  end
> +end
> diff --git a/contrib/ruby/test/test_system.rb 
> b/contrib/ruby/test/test_system.rb
> index b56d564..cc64e84 100644
> --- a/contrib/ruby/test/test_system.rb
> +++ b/contrib/ruby/test/test_system.rb
> @@ -23,6 +23,7 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
>  
>  require 'test/unit'
>  require 'flexmock/test_unit'
> +require 'flexmock/argument_matchers'
>  require 'cobbler'
>  
>  module Cobbler
> @@ -43,20 +44,25 @@ module Cobbler
>        @profile        = 'profile1'
>        @nics           = Array.new
>        @nic_details    = {'mac_address' => '00:11:22:33:44:55:66:77'}
> -      @nics << 
> -        NetworkInterface.new(@nic_details)
> +      @nic            = NetworkInterface.new(['intf0',@nic_details])
> +      @nics << @nic
>              
>        @systems = Array.new
>        @systems << {
>          'name'            => 'Web-Server',
> -        'owners'          => 'admin',
> +        'owners'          => ['admin','dpierce','mpdehaan'],
>          'profile'         => 'Fedora-9-i386',
>          'depth'           => '2',
>          'virt_file_size'  => '<<inherit>>',
>          'virt_path'       => '<<inherit>>',
>          'virt_type'       => '<<inherit>>',
>          'server'          => '<<inherit>>',
> -        'interfaces'      => 
> 'intf0dhcp_tagmac_address00:11:22:33:44:55subnetgatewayhostnamevirt_bridgeip_address',
> +        'interfaces'      => {
> +          'intf0' => {
> +            'mac_address' => '00:11:22:33:44:55'},
> +          'intf1' => {
> +            'mac_address' => '00:11:22:33:44:55'}
> +        },
>          'virt_bridge'     => '<<inherit>>',
>          'virt_ram'        => '<<inherit>>',
>          'ks_meta'         => nil,
> @@ -76,7 +82,9 @@ module Cobbler
>          'virt_path'       => '<<inherit>>',
>          'virt_type'       => '<<inherit>>',
>          'server'          => '<<inherit>>',
> -        'interfaces'      => 
> 'intf0dhcp_tagmac_address00:11:22:33:44:55subnetgatewayhostnamevirt_bridgeip_address',
> +        'interfaces'      => {
> +          'intf0' => {
> +            'mac_address' => 'AA:BB:CC:DD:EE:FF'}},
>          'virt_bridge'     => '<<inherit>>',
>          'virt_ram'        => '<<inherit>>',
>          'ks_meta'         => nil,
> @@ -97,7 +105,10 @@ module Cobbler
>        result = System.find
>  
>        assert result, 'Expected a result set.'
> -      assert_equal 2, result.size, 'Did not receive the right number of 
> results'
> +      assert_equal 2, result.size, 'Did not receive the right number of 
> results.'
> +      assert_equal 2, result[0].interfaces.size, 'Did not parse the NICs 
> correctly.'
> +      result[0].interfaces.collect do |nic| assert_equal 
> "00:11:22:33:44:55", nic.mac_address end
> +      assert_equal 3, result[0].owners.size, 'Did not parse the owners 
> correctly.'
>      end
>      
>      # Ensures that saving a system works as expected.
> @@ -117,12 +128,13 @@ module Cobbler
>      # Ensures that saving a system works as expected even when network 
> interfaces
>      # are involved.
>      #
> -    def test_save
> +    def test_save_with_new_nics
>        
> @connection.should_receive(:call).with('login',@username,@password).once.returns(@auth_token)
>        
> @connection.should_receive(:call).with('new_system',@auth_token).once.returns(@system_id)
>        
> @connection.should_receive(:call).with('modify_system',@system_id,'name',@system_name,@auth_token).once.returns(true)
>        
> @connection.should_receive(:call).with('modify_system',@system_id,'profile',@profile_name,@auth_token).once.returns(true)
> -      
> @connection.should_receive(:call).with('modify_system',@system_id,'modify-interface',any,@auth_token).once.returns(true)
> +      
> @connection.should_receive(:call).with("modify_system",@system_id,'modify-interface',
> +        @nic.bundle_for_saving(0),@auth_token).once.returns(true)
>        
> @connection.should_receive(:call).with('save_system',@system_id,@auth_token).once.returns(true)
>        
>        system = System.new(:name => @system_name, :profile => @profile_name)
>   

Looks fine, please go ahead and apply this. Note that there is a new 
"image_type" field now as we're still refining how all the image aspects 
will work.

--Michael



_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to