diff options
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/defaults.rb | 7 | ||||
-rw-r--r-- | lib/puppet/dsl.rb | 105 | ||||
-rwxr-xr-x | lib/puppet/provider/parsedfile.rb | 2 | ||||
-rw-r--r-- | lib/puppet/util/autoload.rb | 9 |
4 files changed, 5 insertions, 118 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 073cdb1dc..1b0b402ec 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -132,6 +132,8 @@ module Puppet :show_diff => [false, "Whether to print a contextual diff when files are being replaced. The diff is printed on stdout, so this option is meaningless unless you are running Puppet interactively. This feature currently requires the ``diff/lcs`` Ruby library."], + :yamldir => {:default => "$vardir/yaml", :owner => "$user", :group => "$user", :mode => "750", + :desc => "The directory in which YAML data is stored, usually in a subdirectory."}, :daemonize => { :default => true, :desc => "Send the process into the background. This is the default.", :short => "D" @@ -507,11 +509,6 @@ module Puppet "The backend store to use for storing files by checksum (i.e., filebuckets)."] ) - self.setdefaults(:yaml, - :yamldir => ["$vardir/yaml", - "The directory in which YAML data is stored, usually in a subdirectory."] - ) - self.setdefaults(:rails, :dblocation => { :default => "$statedir/clientconfigs.sqlite3", :mode => 0660, diff --git a/lib/puppet/dsl.rb b/lib/puppet/dsl.rb index 614e180f2..75bc81b2b 100644 --- a/lib/puppet/dsl.rb +++ b/lib/puppet/dsl.rb @@ -269,108 +269,3 @@ module Puppet end @aspects = {} - -class Puppet::DisabledDSL - @@subs = {} - @name = :DSLClass - class << self - include Enumerable - attr_accessor :included, :name, :objects - - def each - @@subs.each do |name, sub| - yield name, sub - end - end - - def export - bucket = nil - if superclass() != Puppet::DSL - bucket = superclass.export - else - bucket = Puppet::TransBucket.new - bucket.keyword = "class" - bucket.type = self.name - end - - @objects.each do |type, ary| - ary.each do |name, obj| - if pobj = bucket.find { |sobj| obj.name == sobj.name && obj.type == sobj.type } - obj.each do |param, value| - pobj[param] = value - end - else - bucket.push obj - end - end - end - - return bucket - end - - def include(name) - if ary = @@subs.find { |n, s| n == name } - ary[1].included = true - else - raise "Could not find class %s" % name - end - end - - def inherited(sub) - name = sub.to_s.downcase.gsub(/.+::/, '').intern - @@subs[name] = sub - sub.name = name - sub.initvars - - sub - end - - def initvars - #if superclass() == Puppet::DSL - @objects = {} - #else - # @objects = superclass.objects - #end - end - - - def import(file) - text = File.read(file) - # If they don't specify a parent class, then specify one - # for them. - text.gsub!(/^class \S+\s*$/) do |match| - "#{match} < Puppet::DSL" - end - eval(text, binding) - end - - def method_missing(method, *args) - if klass = Puppet::Type.type(method) - method = method.intern if method.is_a? String - @objects[method] ||= {} - - names = args.shift - hash = args.shift - names = [names] unless names.is_a? Array - names.each do |name| - unless obj = @objects[method][name] - obj = Puppet::TransObject.new(name, method) - @objects[method][name] = obj - end - - hash.each do |param, value| - if obj[param] - raise "Cannot override %s in %s[%s]" % - [param, method, name] - else - obj[param] = value - end - end - end - else - raise "No type %s" % method - end - end - end -end - diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb index 376cf04e3..76654c4f4 100755 --- a/lib/puppet/provider/parsedfile.rb +++ b/lib/puppet/provider/parsedfile.rb @@ -245,7 +245,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider # Initialize the object if necessary. def self.target_object(target) - @target_objects[target] ||= @filetype.new(target) + @target_objects[target] ||= filetype.new(target) @target_objects[target] end diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 280961837..a52575522 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -107,16 +107,11 @@ class Puppet::Util::Autoload # Load every instance of everything we can find. eachdir do |dir| Dir.glob("#{dir}/*.rb").each do |file| - # Load here, rather than require, so that facts - # can be reloaded. This has some short-comings, I - # believe, but it works as long as real classes - # aren't used. name = File.basename(file).sub(".rb", '').intern next if loaded?(name) - next if $".include?(File.join(@path, name.to_s + ".rb")) - filepath = File.join(@path, name.to_s + ".rb") + rubypath = File.join(@path, name.to_s) begin - Kernel.require file + Kernel.require rubypath loaded(name, file) rescue => detail if Puppet[:trace] |