diff options
author | Luke Kanies <luke@madstop.com> | 2009-01-15 15:42:09 -0600 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-02-13 14:16:36 +1100 |
commit | 53f15b9208a3271e944c687b8d0e670d422fb832 (patch) | |
tree | 5c5c48b94d4d6b7ce65c153845c1d19ff6395d36 /lib/puppet/util | |
parent | 4e89156b21b287b683c27a4cd691856c4e378a62 (diff) | |
download | puppet-53f15b9208a3271e944c687b8d0e670d422fb832.tar.gz puppet-53f15b9208a3271e944c687b8d0e670d422fb832.tar.xz puppet-53f15b9208a3271e944c687b8d0e670d422fb832.zip |
Removing the apparently obsolete netinfo filetype.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/util')
-rwxr-xr-x | lib/puppet/util/filetype.rb | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 60380d5f1..137ef0c67 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 - |