diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-01-19 04:17:33 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-01-19 04:17:33 +1100 |
commit | c751058722e10c6900f99f095d3be6e30c186a3e (patch) | |
tree | 36d58ec6a8ec6851b826c8ca511739e2a39cf5ef /lib/puppet | |
parent | 31e08507cbe8444528aaaac2778374eea040709c (diff) | |
download | puppet-c751058722e10c6900f99f095d3be6e30c186a3e.tar.gz puppet-c751058722e10c6900f99f095d3be6e30c186a3e.tar.xz puppet-c751058722e10c6900f99f095d3be6e30c186a3e.zip |
Removed remaining elements of old_parse - closing Ticket #990
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/util/settings.rb | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index b672d9564..f87f96980 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -329,94 +329,6 @@ class Puppet::Util::Settings end end - # Parse the configuration file. As of May 2007, this is a backward-compatibility method and - # will be deprecated soon. - def old_parse(file) - text = nil - - if file.is_a? Puppet::Util::LoadedFile - @file = file - else - @file = Puppet::Util::LoadedFile.new(file) - end - - # Don't create a timer for the old style parsing. - # settimer() - - begin - text = File.read(@file.file) - rescue Errno::ENOENT - raise Puppet::Error, "No such file %s" % file - rescue Errno::EACCES - raise Puppet::Error, "Permission denied to file %s" % file - end - - @values = Hash.new { |names, name| - names[name] = {} - } - - # Get rid of the values set by the file, keeping cli values. - self.clear(true) - - section = "puppet" - metas = %w{owner group mode} - values = Hash.new { |hash, key| hash[key] = {} } - text.split(/\n/).each { |line| - case line - when /^\[(\w+)\]$/: section = $1 # Section names - when /^\s*#/: next # Skip comments - when /^\s*$/: next # Skip blanks - when /^\s*(\w+)\s*=\s*(.+)$/: # settings - var = $1.intern - if var == :mode - value = $2 - else - value = munge_value($2) - end - - # Only warn if we don't know what this config var is. This - # prevents exceptions later on. - unless @config.include?(var) or metas.include?(var.to_s) - Puppet.warning "Discarded unknown configuration parameter %s" % var.inspect - next # Skip this line. - end - - # Mmm, "special" attributes - if metas.include?(var.to_s) - unless values.include?(section) - values[section] = {} - end - values[section][var.to_s] = value - - # If the parameter is valid, then set it. - if section == Puppet[:name] and @config.include?(var) - #@config[var].value = value - @values[:main][var] = value - end - next - end - - # Don't override set parameters, since the file is parsed - # after cli arguments are handled. - unless @config.include?(var) and @config[var].setbycli - Puppet.debug "%s: Setting %s to '%s'" % [section, var, value] - @values[:main][var] = value - end - @config[var].section = symbolize(section) - - metas.each { |meta| - if values[section][meta] - if @config[var].respond_to?(meta + "=") - @config[var].send(meta + "=", values[section][meta]) - end - end - } - else - raise Puppet::Error, "Could not match line %s" % line - end - } - end - # Create a new element. The value is passed in because it's used to determine # what kind of element we're creating, but the value itself might be either # a default or a value, so we can't actually assign it. |