[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5

James Turnbull james at lovedthanlost.net
Wed Apr 8 21:48:09 UTC 2009


The following commit has been merged in the master branch:
commit 53f15b9208a3271e944c687b8d0e670d422fb832
Author: Luke Kanies <luke at madstop.com>
Date:   Thu Jan 15 15:42:09 2009 -0600

    Removing the apparently obsolete netinfo filetype.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb
index 60380d5..137ef0c 100755
--- a/lib/puppet/util/filetype.rb
+++ b/lib/puppet/util/filetype.rb
@@ -250,92 +250,4 @@ class Puppet::Util::FileType
             output_file.delete
         end
     end
-
-    # Treat netinfo tables as a single file, just for simplicity of certain
-    # types
-    newfiletype(:netinfo) do
-        class << self
-            attr_accessor :format
-        end
-        def read
-            %x{nidump -r /#{@path} /}
-        end
-
-        # This really only makes sense for cron tabs.
-        def remove
-            %x{nireport / /#{@path} name}.split("\n").each do |name|
-                newname = name.gsub(/\//, '\/').sub(/\s+$/, '')
-                output = %x{niutil -destroy / '/#{@path}/#{newname}'}
-
-                unless $? == 0
-                    raise Puppet::Error, "Could not remove %s from %s" %
-                        [name, @path]
-                end
-            end
-        end
-
-        # Convert our table to an array of hashes.  This only works for
-        # handling one table at a time.
-        def to_array(text = nil)
-            unless text
-                text = read
-            end
-
-            hash = nil
-
-            # Initialize it with the first record
-            records = []
-            text.split("\n").each do |line|
-                next if line =~ /^[{}]$/ # Skip the wrapping lines
-                next if line =~ /"name" = \( "#{@path}" \)/ # Skip the table name
-                next if line =~ /CHILDREN = \(/ # Skip this header
-                next if line =~ /^  \)/ # and its closer
-
-                # Now we should have nothing but records, wrapped in braces
-
-                case line
-                when /^\s+\{/: hash = {}
-                when /^\s+\}/: records << hash
-                when /\s+"(\w+)" = \( (.+) \)/
-                    field = $1
-                    values = $2
-
-                    # Always use an array
-                    hash[field] = []
-
-                    values.split(/, /).each do |value|
-                        if value =~ /^"(.*)"$/
-                            hash[field] << $1
-                        else
-                            raise ArgumentError, "Could not match value %s" % value
-                        end
-                    end
-                else    
-                    raise ArgumentError, "Could not match line %s" % line
-                end
-            end
-
-            records
-        end
-
-        def write(text)
-            text.gsub!(/^#.*\n/,'')
-            text.gsub!(/^$/,'')
-            if text == "" or text == "\n"
-                self.remove
-                return
-            end
-            unless format = self.class.format
-                raise Puppe::DevError, "You must define the NetInfo format to inport"
-            end
-            IO.popen("niload -d #{format} . 1>/dev/null 2>/dev/null", "w") { |p|
-                p.print text
-            }
-
-            unless $? == 0
-                raise ArgumentError, "Failed to write %s" % @path
-            end
-        end
-    end
 end
-
diff --git a/test/util/filetype.rb b/test/util/filetype.rb
deleted file mode 100755
index 5b01a8b..0000000
--- a/test/util/filetype.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.dirname(__FILE__) + '/../lib/puppettest'
-
-require 'puppettest'
-require 'puppet/util/filetype'
-require 'mocha'
-
-class TestFileType < Test::Unit::TestCase
-	include PuppetTest
-    if Facter["operatingsystem"].value == "Darwin"
-    def test_ninfotoarray
-        obj = nil
-        type = nil
-
-        assert_nothing_raised {
-            type = Puppet::Util::FileType.filetype(:netinfo)
-        }
-
-        assert(type, "Could not retrieve netinfo filetype")
-        %w{users groups aliases}.each do |map|
-            assert_nothing_raised {
-                obj = type.new(map)
-            }
-
-            assert_nothing_raised("could not read map %s" % map) {
-                obj.read
-            }
-
-            array = nil
-
-            assert_nothing_raised("Failed to parse %s map" % map) {
-                array = obj.to_array
-            }
-
-            assert_instance_of(Array, array)
-
-            array.each do |record|
-                assert_instance_of(Hash, record)
-                assert(record.length != 0)
-            end
-        end
-    end
-    end
-end
-

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list