Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

PATCH/puppet 1/1] [#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the AST resources.

PATCH/puppet 1/1] Fix #4302 - attempt to fix another performance issue
(125 lines)
ANNOUNCE: Puppet Dashboard 1.0.3 released
(79 lines)
Jul 30, 2010
Jesse Wolfe
Jesse Wolfe
Move type-name resolution out of Puppet::Resource into the AST resources.
Move find_resource_type out of Puppet::Resource into Scope
Thus, never pass unqualified type names to Puppet::Resource objects.
Thus, Puppet::Resource objects don't need the namespace property,
and Puppet::Resource objects never consult the harddrive to look for
.pp files that might contain their type definitions,
Thus, performance is improved.

Also removes the temporary fix for #4257 that caused #4397
(The code was too eager to look for a class in the topscope)

Paired-With: Paul Berry <pa### @puppetlabs.com>
Signed-off-by: Jesse Wolfe <jes### @gmail.com>
---
 lib/puppet/parser/ast/resource.rb               |    6 +-
 lib/puppet/parser/ast/resource_reference.rb     |   25 ++++-
 lib/puppet/parser/resource.rb                   |    6 +-
 lib/puppet/parser/scope.rb                      |   14 +++
 lib/puppet/resource.rb                          |  128 +++
Reply
Tags: objectsmovenames
Similar Threads
PATCH/puppet 1/1] [#4247] storeconfigs was calling Puppet::Parser::Resource.new with the wrong argu
When the interface to Puppet::Resource changed, its subclass
Puppet::Parser::Resource was also affected. One case of initializing
those objects did not get updated when the code changed, causing
storeconfigs to break.

Also, this patch adds a error message that would have made it easier to
catch this problem (as puppet could consume all memory and die trying to
print the old error message)

Signed-off-by: Jesse Wolfe <jes5### @gmail.com>
---
 lib/puppet/rails/resource.rb     |    6 +++---
 lib/puppet/resource.rb           |    3 +++
 spec/unit/rails/resource_spec.rb |   16 ++++++++++++++++
 spec/unit/resource_spec.rb       |    6 ++++++
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb
index a5cdd0c..cac9de2 100644
--- a/lib/puppet/rails/resource.rb
+++ b/lib/puppet/rails/resource.rb
@@ -212,16 +212,16 @@ class Puppet::Rails::Resource <
ActiveRecord::Base
     end
     hash[:scope] = scope
     hash[:source] = scope.source
-    hash[:params] = []
+    hash[:parameters] = []
     names = []
     self.param_names.each do |pname|
       # We can get the same name multiple times because of how the
       # db layout works.
       next if names.include?(pname.name)
       names << pname.name
-      hash[:params] << pname.to_resourceparam(self, scope.source)
+      hash[:parameters] << pname.to_resourceparam(self,
scope.source)
     end
-    obj = Puppet::Parser::Resource.new(hash)
+    obj = Puppet::Parser::Resource.new(hash["type"], hash["title"], hash)
 
     # Store the ID, so we can check if we're re-collecting the same
resource.
     obj.rails_id = self.id
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index 31237e3..d68e0ee 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -409,6 +409,9 @@ class Puppet::Resource
     if    (argtitle || argtype) =~ /^([^\[\]]+)\[(.+)\]$/m then [ $1,    
            $2            ]
     elsif argtitle                                         then [
argtype,            argtitle      ]
     elsif argtype.is_a?(Puppet::Type)                      then [
argtype.class.name, argtype.title ]
+    elsif argtype.is_a?(Hash)                              then
+      raise ArgumentError, "Puppet::Resource.new does not take a hash as
the first argument. "+
+        "Did you mean (#{(argtype[:type] || argtype["type"]).inspect},
#{(argtype[:title] || argtype["title"]).inspect }) ?"
     else raise ArgumentError, "No title provided and #{argtype.inspect}
is not a valid resource reference"
     end
   end
diff --git a/spec/unit/rails/resource_spec.rb
b/spec/unit/rails/resource_spec.rb
index ac74693..08deda6 100755
--- a/spec/unit/rails/resource_spec.rb
+++ b/spec/unit/rails/resource_spec.rb
@@ -104,4 +104,20 @@ describe "Puppet::Rails::Resource" do
       @resource.merge_parameters(merge_resource)
     end
   end
+
+  describe "#to_resource" do
+    it "should instantiate a Puppet::Parser::Resource" do
+      scope = stub "scope", :source => nil
+
+      @resource = Puppet::Rails::Resource.new
+      @resource.stubs(:attributes).returns({
+        "restype" => 'notify',
+        "title"   => 'hello'
+      })
+      @resource.stubs(:param_names).returns([])
+
+      @resource.to_resource(scope).should be_a(Puppet::Parser::Resource)
+
+    end
+  end
 end
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 95f0dd0..204a2b0 100755
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -98,6 +98,12 @@ describe Puppet::Resource do
     lambda { Puppet::Resource.new("foo") }.should
raise_error(ArgumentError)
   end
 
+  it "should fail if the title is a hash and the type is not a valid
resource reference string" do
+    lambda { Puppet::Resource.new({:type => "foo", :title =>
"bar"}) }.should raise_error(ArgumentError,
+      'Puppet::Resource.new does not take a hash as the first argument.
Did you mean ("foo", "bar") ?'
+    )
+  end
+
   it "should be able to produce a backward-compatible reference array" do
     Puppet::Resource.new("foobar", "/f").to_trans_ref.should == %w{Foobar
/f}
   end






PATCH/puppet 1/1] [#4344] Temporary fix to stop agent from importing modules
Due to type collection madness, agent tries to import modules
to resolve resource types. That is wrong, decreases performance,
and causes problems. This patch forces agent to not import any
files by setting ignoreimport to true.

Signed-off-by: Nick Lewis <nic### @puppetlabs.com>
---
 lib/puppet/application/agent.rb |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/application/agent.rb
b/lib/puppet/application/agent.rb
index f0e7f4d..2b75505 100644
--- a/lib/puppet/application/agent.rb
+++ b/lib/puppet/application/agent.rb
@@ -219,6 +219,10 @@ class Puppet::Application::Agent <
Puppet::Application
 
     Puppet.settings.use :main, :agent, :ssl
 
+    # Always ignoreimport for agent. It really shouldn't even try to
import,
+    # but this is just a temporary band-aid.
+    Puppet[:ignoreimport] = true
+
     # We need to specify a ca location for all of the SSL-related i
     # indirected classes to work; in fingerprint mode we just need
     # access to the local files and we don't need a ca.






PATCH/puppet 1/1] [#4344] Fix for failing templates when module name matches file in local dir.
When the name of a module matches the name of a file in the local
directory, puppet agent would sometimes try to read that file and
interpret it as puppet code.  This happened because files.rb was
unintentionally permitting puppet files without an extension.  Fixed
by changing the glob pattern to only permit ".pp" and ".rb"
extensions.

Signed-off-by: Paul Berry <pa### @puppetlabs.com>
---
 lib/puppet/parser/files.rb           |    2 +-
 spec/unit/parser/files_spec.rb       |    6 +++---
 spec/unit/parser/type_loader_spec.rb |    2 +-
 test/language/parser.rb              |   12 ++++++------
 test/lib/puppettest.rb               |    4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/puppet/parser/files.rb b/lib/puppet/parser/files.rb
index 9ef05e1..f346831 100644
--- a/lib/puppet/parser/files.rb
+++ b/lib/puppet/parser/files.rb
@@ -24,7 +24,7 @@ module Puppet::Parser::Files
       # Than that would be a "no."
     end
     abspat = File::expand_path(start, cwd)
-    [nil, Dir.glob(abspat + (File.extname(abspat).empty? ? '{,.pp,.rb}' :
'' )).uniq.reject { |f| FileTest.directory?(f) }]
+    [nil, Dir.glob(abspat + (File.extname(abspat).empty? ? '{.pp,.rb}' :
'' )).uniq.reject { |f| FileTest.directory?(f) }]
   end
 
   # Find the concrete file denoted by +file+. If +file+ is absolute,
diff --git a/spec/unit/parser/files_spec.rb
b/spec/unit/parser/files_spec.rb
index fcfbfa6..3eb0db0 100644
--- a/spec/unit/parser/files_spec.rb
+++ b/spec/unit/parser/files_spec.rb
@@ -154,7 +154,7 @@ describe Puppet::Parser::Files do
 
     it "should match against provided fully qualified patterns" do
       pattern = @basepath + "/fully/qualified/pattern/*"
-      Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{my file
list})
+      Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns(%w{my file
list})
       Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{my
file list}
     end
 
@@ -168,7 +168,7 @@ describe Puppet::Parser::Files do
       pattern = @basepath + "/fully/qualified/pattern/*"
       file = @basepath + "/my/file"
       dir = @basepath + "/my/directory"
-      Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns([file, dir])
+      Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns([file, dir])
       FileTest.expects(:directory?).with(file).returns(false)
       FileTest.expects(:directory?).with(dir).returns(true)
       Puppet::Parser::Files.find_manifests(pattern)[1].should == [file]
@@ -176,7 +176,7 @@ describe Puppet::Parser::Files do
 
     it "should return files once only" do
       pattern = @basepath + "/fully/qualified/pattern/*"
-      Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{one two
one})
+      Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns(%w{one two
one})
       Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{one
two}
     end
   end
diff --git a/spec/unit/parser/type_loader_spec.rb
b/spec/unit/parser/type_loader_spec.rb
index 8f005d5..83006b3 100644
--- a/spec/unit/parser/type_loader_spec.rb
+++ b/spec/unit/parser/type_loader_spec.rb
@@ -192,7 +192,7 @@ describe Puppet::Parser::TypeLoader do
   end
 
   it "should be able to add classes to the current resource type
collection" do
-    file = tmpfile("simple_file")
+    file = tmpfile("simple_file.pp")
     File.open(file, "w") { |f| f.puts "class foo {}" }
     @loader.import(file)
 
diff --git a/test/language/parser.rb b/test/language/parser.rb
index 5a433c7..8cda8ee 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -97,7 +97,7 @@ class TestParser < Test::Unit::TestCase
     }
 
     4.times { |i|
-      path = File.join(basedir, subdir, "subfile#{i}")
+      path = File.join(basedir, subdir, "subfile#{i}.pp")
       mkmanifest(path)
     }
 
@@ -137,8 +137,8 @@ class TestParser < Test::Unit::TestCase
   end
 
   def test_importedclasses
-    imported = tempfile
-    importer = tempfile
+    imported = tempfile '.pp'
+    importer = tempfile '.pp'
 
     made = tempfile
 
@@ -655,9 +655,9 @@ file { "/tmp/yayness":
   end
 
   def test_multiple_imports_on_one_line
-    one = tempfile
-    two = tempfile
-    base = tempfile
+    one = tempfile '.pp'
+    two = tempfile '.pp'
+    base = tempfile '.pp'
     File.open(one, "w") { |f| f.puts "$var = value" }
     File.open(two, "w") { |f| f.puts "$var = value" }
     File.open(base, "w") { |f| f.puts "import '#{one}', '#{two}'" }
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index e31a319..294d0ef 100755
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -227,14 +227,14 @@ module PuppetTest
     #Facter.stubs(:to_hash).returns({})
   end
 
-  def tempfile
+  def tempfile(suffix = '')
     if defined?(@@tmpfilenum)
       @@tmpfilenum += 1
     else
       @@tmpfilenum = 1
     end
 
-    f = File.join(self.tmpdir, "tempfile_" + @@tmpfilenum.to_s)
+    f = File.join(self.tmpdir, "tempfile_" + @@tmpfilenum.to_s + suffix)
     @@tmpfiles ||= []
     @@tmpfiles << f
     f






PATCH/puppet 1/1] [#4209] catalog.resources should return resources
type/user.rb was assuming that catalog.resources would return resources.
In 0.25.x, it (confusingly) returns strings. type/user ignored this, and
the codepath was a no-op.
In 2.6, the method was renamed to something less confusing, causing the
codepath in type/user to fail outright.
This patch added a catalog.resources method that returns resource
objects.
As a side effect, user resources will now autorequire group resources
again.

Signed-off-by: Jesse Wolfe <jes5### @gmail.com>
---
 lib/puppet/resource/catalog.rb |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/resource/catalog.rb
b/lib/puppet/resource/catalog.rb
index e8c1429..d163fc1 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -383,6 +383,10 @@ class Puppet::Resource::Catalog <
Puppet::SimpleGraph
     @resource_table.keys
   end
 
+  def resources
+    @resource_table.values.uniq
+  end
+
   def self.from_pson(data)
     result = new(data['name'])
 






PATCH/puppet 2/3] vim: match collected resources.
Signed-off-by: Marc Fournier <marc.fo### @camptocamp.com>
---
 ext/vim/syntax/puppet.vim |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ext/vim/syntax/puppet.vim b/ext/vim/syntax/puppet.vim
index 81efa92..b24cbf6 100644
--- a/ext/vim/syntax/puppet.vim
+++ b/ext/vim/syntax/puppet.vim
@@ -33,6 +33,7 @@ syn match   puppetNodeRe        "/.*/" contained
 "FIXME: "Foo-bar" doesn't get highlighted as expected, although "foo-bar"
does.
 syn match   puppetInstance     
"[A-Za-z0-9_-]\+\(::[A-Za-z0-9_-]\+\)*\s*{"
contains=puppetTypeName,puppetTypeDefault
 syn match   puppetInstance     
"[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*[[{]"
contains=puppetTypeName,puppetTypeDefault
+syn match   puppetInstance     
"[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*<\?<|"
contains=puppetTypeName,puppetTypeDefault
 syn match   puppetTypeName      "[a-z]\w*" contained
 syn match   puppetTypeDefault   "[A-Z]\w*" contained
 






PATCH/puppet 1/1] [#4149] Don't create two Resource::TypeCollections
By asking the environment for known resources instead of creating a type
collection ourselves, we avoid accidentally creating two
Resource::TypeCollection objects.

Signed-off-by: Jesse Wolfe <jes5### @gmail.com>
---
 lib/puppet/application/apply.rb  |    2 +-
 lib/puppet/application/master.rb |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/puppet/application/apply.rb
b/lib/puppet/application/apply.rb
index 8909939..1814858 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -67,7 +67,7 @@ class Puppet::Application::Apply <
Puppet::Application
             Puppet[:manifest] = command_line.args.shift
         end
         begin
-           
Puppet::Resource::TypeCollection.new(Puppet[:environment]).perform_initial_import
+           
Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types
         rescue => detail
             Puppet.err detail
             exit 1
diff --git a/lib/puppet/application/master.rb
b/lib/puppet/application/master.rb
index fdcd7d3..484ec08 100644
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@ -67,7 +67,7 @@ class Puppet::Application::Master <
Puppet::Application
 
     def parseonly
         begin
-           
Puppet::Resource::TypeCollection.new(Puppet[:environment]).perform_initial_import
+           
Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types
         rescue => detail
             Puppet.err detail
             exit 1






PATCH/puppet 1/1] [#4233] Ruby regexps are not multiline by default, but Resource titles can be mul
Puppet allows resource titles to contain newlines. We recently
introduced several regexps that were failing on resources with multiline
titles.

Signed-off-by: Jesse Wolfe <jes### @gmail.com>
---
 lib/puppet/resource/catalog.rb     |    2 +-
 lib/puppet/type.rb                 |    2 +-
 lib/puppet/type/file.rb            |    2 +-
 spec/unit/resource/catalog_spec.rb |    9 +++++++++
 spec/unit/type/file_spec.rb        |   14 ++++++++++++++
 spec/unit/type_spec.rb             |   21 +++++++++++++++++++++
 6 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/lib/puppet/resource/catalog.rb
b/lib/puppet/resource/catalog.rb
index d163fc1..4ac99ee 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -57,7 +57,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
   end
 
   def title_key_for_ref( ref )
-    ref =~ /^(.+)\[(.*)\]/
+    ref =~ /^(.+)\[(.*)\]/m
     [$1, $2]
   end
 
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index d0fea97..627271f 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -193,7 +193,7 @@ class Type
     when 0; []
     when 1;
       identity = lambda {|x| x}
-      [ [ /(.*)/, [ [key_attributes.first, identity ] ] ] ]
+      [ [ /(.*)/m, [ [key_attributes.first, identity ] ] ] ]
     else
       raise Puppet::DevError,"you must specify title patterns when there
are two or more key attributes"
     end
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 195e8c8..71f2756 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -25,7 +25,7 @@ Puppet::Type.newtype(:file) do
     native resource to support what you are doing."
 
   def self.title_patterns
-    [ [ /^(.*?)\/?$/, [ [ :path, lambda{|x| x} ] ] ] ]
+    [ [ /^(.*?)\/*\Z/m, [ [ :path, lambda{|x| x} ] ] ] ]
   end
 
   newparam(:path) do
diff --git a/spec/unit/resource/catalog_spec.rb
b/spec/unit/resource/catalog_spec.rb
index b6f96f0..10cff91 100755
--- a/spec/unit/resource/catalog_spec.rb
+++ b/spec/unit/resource/catalog_spec.rb
@@ -1066,4 +1066,13 @@ describe Puppet::Resource::Catalog, "when
converting from pson" do
 
     lambda { PSON.parse @pson.to_pson }.should raise_error(ArgumentError)
   end
+
+  describe "#title_key_for_ref" do
+    it "should parse a resource ref string into a pair" do
+      @catalog.title_key_for_ref("Title[name]").should == ["Title",
"name"]
+    end
+    it "should parse a resource ref string into a pair, even if there's a
newline inside the name" do
+      @catalog.title_key_for_ref("Title[na\nme]").should == ["Title",
"na\nme"]
+    end
+  end
 end
diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb
index 845bf3d..7d93dfd 100755
--- a/spec/unit/type/file_spec.rb
+++ b/spec/unit/type/file_spec.rb
@@ -1053,4 +1053,18 @@ describe Puppet::Type.type(:file) do
       file.retrieve
     end
   end
+
+  describe ".title_patterns" do
+    before do
+      @type_class = Puppet::Type.type(:file)
+    end
+    
+    it "should have a regexp that captures the entire string, except for
a terminating slash" do
+      patterns = @type_class.title_patterns
+      string = "abc/\n\tdef/"
+      patterns[0][0] =~ string
+      $1.should == "abc/\n\tdef"
+    end
+  end
+
 end
diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb
index 683529d..71d415d 100755
--- a/spec/unit/type_spec.rb
+++ b/spec/unit/type_spec.rb
@@ -406,6 +406,27 @@ describe Puppet::Type do
     end
   end
 
+  describe ".title_patterns" do
+    describe "when there's one namevar" do
+      before do
+        @type_class = Puppet::Type.type(:notify)
+        @type_class.stubs(:key_attributes).returns([:one])
+      end
+
+      it "should have a default pattern for when there's one namevar" do
+        patterns = @type_class.title_patterns
+        patterns.length.should == 1
+        patterns[0].length.should == 2
+      end
+      
+      it "should have a regexp that captures the entire string" do
+        patterns = @type_class.title_patterns
+        string = "abc\n\tdef"
+        patterns[0][0] =~ string
+        $1.should == "abc\n\tdef"
+      end
+    end
+  end
 
   describe "when in a catalog" do
     before do






PATCH/puppet 1/1] Add new type and provider for sysctl, ticket #4068 The sysctl type manages the /e
---
 lib/puppet/provider/sysctl/linux.rb |   69
+++++++++++++++++++++++++++++++++++
 lib/puppet/type/sysctl.rb           |   36 ++++++++++++++++++
 spec/unit/provider/sysctl/linux.rb  |   25 +++++++++++++
 spec/unit/type/sysctl.rb            |   23 ++++++++++++
 4 files changed, 153 insertions(+), 0 deletions(-)
 create mode 100644 lib/puppet/provider/sysctl/linux.rb
 create mode 100644 lib/puppet/type/sysctl.rb
 create mode 100644 spec/unit/provider/sysctl/linux.rb
 create mode 100644 spec/unit/type/sysctl.rb

diff --git a/lib/puppet/provider/sysctl/linux.rb
b/lib/puppet/provider/sysctl/linux.rb
new file mode 100644
index 0000000..ca9de35
--- /dev/null
+++ b/lib/puppet/provider/sysctl/linux.rb
@@ -0,0 +1,69 @@
+# Manage the linux kernel stack, should work for most sysctl unixes
+require 'pathname'
+
+Puppet::Type.type(:sysctl).provide(:linux) do
+
+    desc "Support for managing the linux kernel stack
+    Manages the /etc/sysctl.conf file and uses the sysctl command to
apply changes
+    "
+
+    defaultfor :operatingsystem => [:redhat, :fedora, :suse, :centos,
:sles, :debian, :ubuntu, :gentoo]
+
+    commands :sysctl_cmd => "sysctl"
+
+    #Verify that the setting is available and add the setting to the file
+    def create
+        # First, apply the setting, if the setting is invalid the
commands
+        # interface will throw and prevent the value from being applied.
+        sysctl_cmd "-w", "#{@resource[:name]}=#{@resource[:value]}"
+        lines = File.new('/etc/sysctl.conf', 'r').readlines
+        done = false
+        lines.each_index do |i|
+            if lines[i].split('=')[0].strip == @resource[:name]
+                lines[i] = "#{@resource[:name]} = #{@resource[:value]}\n"
+                done = true
+            end
+        end
+        unless done
+            lines << "#{@resource[:name]} = #{@resource[:value]}\n"
+        end
+            sysfile = File.new('/etc/sysctl.conf', 'w')
+        for line in lines
+            sysfile.write(line)
+        end
+        sysfile.close
+        sysctl_cmd "-p"
+    end
+
+    # Remove the setting from the file - Will not return the setting to
the kernel default!!
+    def destroy
+        lines = File.new('/etc/sysctl.conf', 'r').readlines
+        lines.each_index do |i|
+            if lines[i].split('=')[0].strip == @resource[:name]
+                lines[i] = ""
+            end
+            sysfile = File.new('/etc/sysctl.conf', 'w')
+            for line in lines
+                sysfile.write(line)
+            end
+            sysfile.close
+        end
+    end
+    
+    # Checks for the setting in the sysctl.conf file, if the rule is set
to be absent
+    # then it can exist with any value.
+    def exists?
+        lines = File.new('/etc/sysctl.conf', 'r').readlines
+        lines.each do |line|
+            if line.split('=')[0].strip == @resource[:name]
+                if line.split('=')[1].strip == @resource[:value]
+                return true
+                elsif @resource[:ensure] == :absent
+                    return true
+                end
+            end
+        end
+        return false
+    end
+end
+
diff --git a/lib/puppet/type/sysctl.rb b/lib/puppet/type/sysctl.rb
new file mode 100644
index 0000000..2633e2e
--- /dev/null
+++ b/lib/puppet/type/sysctl.rb
@@ -0,0 +1,36 @@
+module Puppet
+    newtype(:sysctl) do
+        @doc = "Manages the sysctl interface for unix-like systems.
+        The sysctl module works primarily by managing the
/etc/sysctl.conf
+        file, and then by calling the 'sysctl -p' command to apply the
state
+        of the /etc/sysctl.conf file.
+    
+        This is a very simple type and only makes use of a few
paramaters.
+        The type only supports three paramaters, the namevar paramater,
name,
+        is the dot notation reference to the desired sysctl setting, aka
+        'vm.swappiness'.  The value paramater is always a string and is
the
+        value to pass to the gives sysctl setting.  The sysctl trype is
also
+        ensurable, so all rules need to have the regular ensure =>
present
+        option set.
+    
+        A typical rule will look like this:
+    
+            sysctl {'vm.swappiness':
+                ensure => present,
+                value => '20',
+            }
+        
+        This rule would ensure that the kernel swappiness setting be set
to '20'"
+
+        ensurable
+
+        newparam(:name, :namevar => true) do
+            desc "The name of the variable in the sysctl tree, given in
dot notation, eg vm.swappiness"
+        end
+
+        newparam(:value) do
+            desc "The value to enforce for the sysctl variable."
+        end
+    end
+end
+
diff --git a/spec/unit/provider/sysctl/linux.rb
b/spec/unit/provider/sysctl/linux.rb
new file mode 100644
index 0000000..95b5203
--- /dev/null
+++ b/spec/unit/provider/sysctl/linux.rb
@@ -0,0 +1,25 @@
+#/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+provider_class = Puppet::Type.type(:sysctl).provider(:linux)
+
+describe provider_class do
+    before do
+        @resource = stub("resource", :name => "vm.swappiness")
+        @resource.stubs(:[]).with(:name).returns "vm.swappiness"
+        @provider = provider_class.new(@resource)
+    end
+    it "should have a create method" do
+        @provider.should respond_to(:create)
+    end
+
+    it "should have a destroy method" do
+        @provider.should respond_to(:destroy)
+    end
+
+    it "should have an exists? method" do
+        @provider.should respond_to(:exists?)
+    end
+
+end
diff --git a/spec/unit/type/sysctl.rb b/spec/unit/type/sysctl.rb
new file mode 100644
index 0000000..185d7ab
--- /dev/null
+++ b/spec/unit/type/sysctl.rb
@@ -0,0 +1,23 @@
+#/usr/bin/env ruby
+
+Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ?
require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
+
+sysctl = Puppet::Type.type(:sysctl)
+
+describe sysctl do
+    properties = [:ensure]
+
+    properties.each do |property|
+        it "should have a %s property" % property do
+            sysctl.attrclass(property).ancestors.should
be_include(Puppet::Property)
+        end
+    end 
+    parameters = [:name, :value]
+
+    parameters.each do |parameter|
+        it "should have a %s parameter" % parameter do
+            sysctl.attrclass(parameter).ancestors.should
be_include(Puppet::Parameter)
+        end
+    end
+end
+






PATCH/puppet 1/1] Fixed yumrepo type deprecation wanring `
Signed-off-by: James Turnbull <ja### @lovedthanlost.net>
---
 lib/puppet/type/yumrepo.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb
index e0ed3ad..5d86b1c 100644
--- a/lib/puppet/type/yumrepo.rb
+++ b/lib/puppet/type/yumrepo.rb
@@ -85,7 +85,7 @@ module Puppet
       clear
       inifile.each_section do |s|
         next if s.name == "main"
-        obj = create(:name => s.name, :audit => check)
+        obj = new(:name => s.name, :audit => check)
         current_values = obj.retrieve
         obj.eachproperty do |property|
           if current_values[property].nil?






PATCH/puppet 1/1] Added cost parameter to the yumrepo type
Signed-off-by: James Turnbull <ja### @lovedthanlost.net>
---
 lib/puppet/type/yumrepo.rb |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb
index e0ed3ad..d2b9b7e 100644
--- a/lib/puppet/type/yumrepo.rb
+++ b/lib/puppet/type/yumrepo.rb
@@ -324,6 +324,12 @@ module Puppet
       newvalue(%r{[1-9][0-9]?}) { }
     end
 
+    newproperty(:cost, :parent => Puppet::IniProperty) do
+      desc "Cost of this repository.\n#{ABSENT_DOC}"
+      newvalue(:absent) { self.should = :absent }
+      newvalue(%r{\d+}) { }
+    end
+
     newproperty(:proxy, :parent => Puppet::IniProperty) do
       desc "URL to the proxy server for this repository.\n#{ABSENT_DOC}"
       newvalue(:absent) { self.should = :absent }






PATCH/puppet 1/1] Fixed #4100 - Added http_caching to yumrepo type
Signed-off-by: James Turnbull <ja### @lovedthanlost.net>
---
 lib/puppet/type/yumrepo.rb |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb
index e0ed3ad..cc2cc41 100644
--- a/lib/puppet/type/yumrepo.rb
+++ b/lib/puppet/type/yumrepo.rb
@@ -294,6 +294,12 @@ module Puppet
       newvalue(%r{(0|1)}) { }
     end
 
+     newproperty(:http_caching, :parent => Puppet::IniProperty) do
+       desc "Either 'packages' or 'all' or 'none'.\n#{ABSENT_DOC}" 
+       newvalue(:absent) { self.should = :absent }
+       newvalue(%r(packages|all|none)) { }
+     end
+
     newproperty(:timeout, :parent => Puppet::IniProperty) do
       desc "Number of seconds to wait for a connection before timing
         out.\n#{ABSENT_DOC}"






PATCH/puppet 1/1] [#4264] Fix failing specs run as root due to missing puppet group
These specs 'use' some settings which create directories belonging
to the 'service' user/group. If the default service group doesn't
exist, these fail. This patch explicitly sets the service group to
the gid of the process, which is known to be accessible by the user.

Signed-off-by: Nick Lewis <ni### @puppetlabs.com>
---
 .../indirector/bucket_file/rest_spec.rb            |    1 +
 .../indirector/certificate/rest_spec.rb            |    1 +
 .../indirector/certificate_request/rest_spec.rb    |    1 +
 .../certificate_revocation_list/rest_spec.rb       |    1 +
 spec/integration/indirector/report/rest_spec.rb    |    1 +
 spec/integration/indirector/rest_spec.rb           |    1 +
 spec/integration/network/server/webrick_spec.rb    |    1 +
 spec/integration/ssl/certificate_authority_spec.rb |    1 +
 spec/integration/ssl/certificate_request_spec.rb   |    1 +
 .../ssl/certificate_revocation_list_spec.rb        |    1 +
 spec/integration/ssl/host_spec.rb                  |    1 +
 11 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/spec/integration/indirector/bucket_file/rest_spec.rb
b/spec/integration/indirector/bucket_file/rest_spec.rb
index 4d90a8c..dc10faa 100644
--- a/spec/integration/indirector/bucket_file/rest_spec.rb
+++ b/spec/integration/indirector/bucket_file/rest_spec.rb
@@ -17,6 +17,7 @@ describe "Filebucket REST Terminus" do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
     Puppet.settings[:server] = "127.0.0.1"
     Puppet.settings[:masterport] = "34343"
 
diff --git a/spec/integration/indirector/certificate/rest_spec.rb
b/spec/integration/indirector/certificate/rest_spec.rb
index 356a7d3..58aa96c 100755
--- a/spec/integration/indirector/certificate/rest_spec.rb
+++ b/spec/integration/indirector/certificate/rest_spec.rb
@@ -17,6 +17,7 @@ describe "Certificate REST Terminus" do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
     Puppet.settings[:server] = "127.0.0.1"
     Puppet.settings[:masterport] = "34343"
 
diff --git a/spec/integration/indirector/certificate_request/rest_spec.rb
b/spec/integration/indirector/certificate_request/rest_spec.rb
index 2c98ef6..c718b78 100755
--- a/spec/integration/indirector/certificate_request/rest_spec.rb
+++ b/spec/integration/indirector/certificate_request/rest_spec.rb
@@ -19,6 +19,7 @@ describe "Certificate Request REST Terminus" do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
     Puppet.settings[:server] = "127.0.0.1"
     Puppet.settings[:masterport] = "34343"
 
diff --git
a/spec/integration/indirector/certificate_revocation_list/rest_spec.rb
b/spec/integration/indirector/certificate_revocation_list/rest_spec.rb
index 62a2f80..86f2b01 100755
--- a/spec/integration/indirector/certificate_revocation_list/rest_spec.rb
+++ b/spec/integration/indirector/certificate_revocation_list/rest_spec.rb
@@ -17,6 +17,7 @@ describe "Certificate REST Terminus" do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
     Puppet.settings[:server] = "127.0.0.1"
     Puppet.settings[:masterport] = "34343"
 
diff --git a/spec/integration/indirector/report/rest_spec.rb
b/spec/integration/indirector/report/rest_spec.rb
index 089f8fd..fdc2189 100644
--- a/spec/integration/indirector/report/rest_spec.rb
+++ b/spec/integration/indirector/report/rest_spec.rb
@@ -17,6 +17,7 @@ describe "Report REST Terminus" do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
     Puppet.settings[:server] = "127.0.0.1"
     Puppet.settings[:masterport] = "34343"
 
diff --git a/spec/integration/indirector/rest_spec.rb
b/spec/integration/indirector/rest_spec.rb
index e904839..14e9e95 100755
--- a/spec/integration/indirector/rest_spec.rb
+++ b/spec/integration/indirector/rest_spec.rb
@@ -39,6 +39,7 @@ describe Puppet::Indirector::REST do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
     Puppet.settings[:server] = "127.0.0.1"
     Puppet.settings[:masterport] = "34343"
 
diff --git a/spec/integration/network/server/webrick_spec.rb
b/spec/integration/network/server/webrick_spec.rb
index 2809df7..2b14dfb 100755
--- a/spec/integration/network/server/webrick_spec.rb
+++ b/spec/integration/network/server/webrick_spec.rb
@@ -18,6 +18,7 @@ describe Puppet::Network::Server do
 
       Puppet.settings[:confdir] = @dir
       Puppet.settings[:vardir] = @dir
+      Puppet.settings[:group] = Process.gid
 
       Puppet::SSL::Host.ca_location = :local
 
diff --git a/spec/integration/ssl/certificate_authority_spec.rb
b/spec/integration/ssl/certificate_authority_spec.rb
index be82b5f..fca17b4 100755
--- a/spec/integration/ssl/certificate_authority_spec.rb
+++ b/spec/integration/ssl/certificate_authority_spec.rb
@@ -17,6 +17,7 @@ describe Puppet::SSL::CertificateAuthority do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
 
     Puppet::SSL::Host.ca_location = :local
     @ca = Puppet::SSL::CertificateAuthority.new
diff --git a/spec/integration/ssl/certificate_request_spec.rb
b/spec/integration/ssl/certificate_request_spec.rb
index 365ecce..8426b9d 100755
--- a/spec/integration/ssl/certificate_request_spec.rb
+++ b/spec/integration/ssl/certificate_request_spec.rb
@@ -21,6 +21,7 @@ describe Puppet::SSL::CertificateRequest do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
 
     Puppet::SSL::Host.ca_location = :none
 
diff --git a/spec/integration/ssl/certificate_revocation_list_spec.rb
b/spec/integration/ssl/certificate_revocation_list_spec.rb
index 127654c..44eee36 100755
--- a/spec/integration/ssl/certificate_revocation_list_spec.rb
+++ b/spec/integration/ssl/certificate_revocation_list_spec.rb
@@ -17,6 +17,7 @@ describe Puppet::SSL::CertificateRevocationList do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
 
     Puppet::SSL::Host.ca_location = :local
   end
diff --git a/spec/integration/ssl/host_spec.rb
b/spec/integration/ssl/host_spec.rb
index 9b4152e..05862df 100755
--- a/spec/integration/ssl/host_spec.rb
+++ b/spec/integration/ssl/host_spec.rb
@@ -17,6 +17,7 @@ describe Puppet::SSL::Host do
 
     Puppet.settings[:confdir] = @dir
     Puppet.settings[:vardir] = @dir
+    Puppet.settings[:group] = Process.gid
 
     Puppet::SSL::Host.ca_location = :local
 






PATCH/puppet] [#4219] Install misses command_line dir, puppet $app --help fails
---
 install.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/install.rb b/install.rb
index d35aaa0..b06ec09 100755
--- a/install.rb
+++ b/install.rb
@@ -84,7 +84,7 @@ bins  = glob(%w{bin/*})
 rdoc  = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG
TODO Install}).reject { |e| e=~ /\.(bat|cmd)$/ }
 ri    = glob(%w{bin/*.rb sbin/* lib/**/*.rb}).reject { |e| e=~
/\.(bat|cmd)$/ }
 man   = glob(%w{man/man[0-9]/*})
-libs  = glob(%w{lib/**/*.rb lib/**/*.py})
+libs  = glob(%w{lib/**/*.rb lib/**/*.py lib/puppet/util/command_line/*})
 tests = glob(%w{test/**/*.rb})
 
 def do_bins(bins, target, strip = 's?bin/')








PATCH/puppet 1/1] [#4110] Wrap Type#retrieve calls for backwards compatibility
This patch introduces Type#retrieve_resource as a wrapper for
Type#resource, to coerce the return value from legacy types from Hash to
Resource.

Signed-off-by: Jesse Wolfe <jes### @gmail.com>
---
 lib/puppet/transaction/resource_harness.rb |    2 +-
 lib/puppet/type.rb                         |   12 +++++++++---
 lib/puppet/type/mount.rb                   |    2 +-
 lib/puppet/type/resources.rb               |    2 +-
 spec/unit/type_spec.rb                     |   12 ++++++------
 test/ral/type/mailalias.rb                 |    2 +-
 6 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/lib/puppet/transaction/resource_harness.rb
b/lib/puppet/transaction/resource_harness.rb
index ae38bcb..848ba7b 100644
--- a/lib/puppet/transaction/resource_harness.rb
+++ b/lib/puppet/transaction/resource_harness.rb
@@ -38,7 +38,7 @@ class Puppet::Transaction::ResourceHarness
     end
 
     def changes_to_perform(status, resource)
-        current = resource.retrieve
+        current = resource.retrieve_resource
 
         cache resource, :checked, Time.now
 
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 6e553d4..57caf1d 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -743,6 +743,14 @@ class Type
         result
     end
 
+    def retrieve_resource
+        resource = retrieve
+        if resource.is_a? Hash
+            resource = Resource.new(type, title, :parameters =>
resource)
+        end
+        resource
+    end
+
     # Get a hash of the current properties.  Returns a hash with
     # the actual property instance as the key and the current value
     # as the, um, value.
@@ -1924,10 +1932,8 @@ class Type
     def to_trans(ret = true)
         trans = TransObject.new(self.title, self.class.name)
 
-        values = retrieve()
+        values = retrieve_resource
         values.each do |name, value|
-            # sometimes we get symbols and sometimes we get Properties
-            # I think it's a bug, but I can't find it. ~JW
             name = name.name if name.respond_to? :name
             trans[name] = value
         end
diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb
index e79bc0a..b2185b6 100755
--- a/lib/puppet/type/mount.rb
+++ b/lib/puppet/type/mount.rb
@@ -67,7 +67,7 @@ module Puppet
 
             def syncothers
                 # We have to flush any changes to disk.
-                currentvalues = @resource.retrieve
+                currentvalues = @resource.retrieve_resource
 
                 # Determine if there are any out-of-sync properties.
                 oos = @resource.send(:properties).find_all do |prop|
diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb
index 136b691..0080846 100644
--- a/lib/puppet/type/resources.rb
+++ b/lib/puppet/type/resources.rb
@@ -131,7 +131,7 @@ Puppet::Type.newtype(:resources) do
         return true unless self[:unless_system_user]
 
         resource[:audit] = :uid
-        current_values = resource.retrieve
+        current_values = resource.retrieve_resource
 
         if system_users().include?(resource[:name])
             return false
diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb
index 54fb297..70597f7 100755
--- a/spec/unit/type_spec.rb
+++ b/spec/unit/type_spec.rb
@@ -368,11 +368,11 @@ describe Puppet::Type do
         it "should fail if its provider is unsuitable" do
             @resource = Puppet::Type.type(:mount).new(:name => "foo",
:fstype => "bar", :pass => 1, :ensure => :present)
             @resource.provider.class.expects(:suitable?).returns false
-            lambda { @resource.retrieve }.should
raise_error(Puppet::Error)
+            lambda { @resource.retrieve_resource }.should
raise_error(Puppet::Error)
         end
 
         it "should return a Puppet::Resource instance with its type and
title set appropriately" do
-            result = @resource.retrieve
+            result = @resource.retrieve_resource
             result.should be_instance_of(Puppet::Resource)
             result.type.should == "Mount"
             result.title.should == "foo"
@@ -381,11 +381,11 @@ describe Puppet::Type do
         it "should set the name of the returned resource if its own name
and title differ" do
             @resource[:name] = "my name"
             @resource.title = "other name"
-            @resource.retrieve[:name].should == "my name"
+            @resource.retrieve_resource[:name].should == "my name"
         end
 
         it "should provide a value for all set properties" do
-            values = @resource.retrieve
+            values = @resource.retrieve_resource
             [:ensure, :fstype, :pass].each { |property|
values[property].should_not be_nil }
         end
 
@@ -396,13 +396,13 @@ describe Puppet::Type do
         it "should not call retrieve on non-ensure properties if the
resource is absent and should consider the property absent" do
             @resource.property(:ensure).expects(:retrieve).returns
:absent
             @resource.property(:fstype).expects(:retrieve).never
-            @resource.retrieve[:fstype].should == :absent
+            @resource.retrieve_resource[:fstype].should == :absent
         end
 
         it "should include the result of retrieving each property's
current value if the resource is present" do
             @resource.property(:ensure).expects(:retrieve).returns
:present
             @resource.property(:fstype).expects(:retrieve).returns 15
-            @resource.retrieve[:fstype] == 15
+            @resource.retrieve_resource[:fstype] == 15
         end
     end
 
diff --git a/test/ral/type/mailalias.rb b/test/ral/type/mailalias.rb
index 5d5023a..ff0e62e 100755
--- a/test/ral/type/mailalias.rb
+++ b/test/ral/type/mailalias.rb
@@ -34,7 +34,7 @@ class TestMailAlias < Test::Unit::TestCase
     # This isn't much of a test, but then, it's not much of a type.
     def test_recipient_arrays
         resource = @type.new(:name => "luke", :recipient => "yay",
:target => tempfile)
-        values = resource.retrieve
+        values = resource.retrieve_resource
         assert_equal(:absent, values[:recipient])
         resource.property(:recipient).expects(:set).with(%w{yay})
         assert_nothing_raised("Could not sync mailalias") do






PATCH/puppet 1/1] Fix #4348 - Puppet doc single manifest broken
The refactoring of using environment instances instead of strings
for initializing the parser, rdoc wasn't updated, thus was unable
to initialize the parser.

Signed-off-by: Brice Figureau <brice-pupp### @daysofwonder.com>
---
 lib/puppet/util/rdoc.rb     |    2 +-
 spec/unit/util/rdoc_spec.rb |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb
index 4a80b06..085d8ec 100644
--- a/lib/puppet/util/rdoc.rb
+++ b/lib/puppet/util/rdoc.rb
@@ -41,7 +41,7 @@ module Puppet::Util::RDoc
   def manifestdoc(files)
     Puppet[:ignoreimport] = true
     files.select { |f| FileTest.file?(f) }.each do |f|
-      parser = Puppet::Parser::Parser.new(:environment =>
Puppet[:environment])
+      parser =
Puppet::Parser::Parser.new(Puppet::Node::Environment.new(Puppet[:environment]))
       parser.file = f
       ast = parser.parse
       output(f, ast)
diff --git a/spec/unit/util/rdoc_spec.rb b/spec/unit/util/rdoc_spec.rb
index 65df261..58c2034 100755
--- a/spec/unit/util/rdoc_spec.rb
+++ b/spec/unit/util/rdoc_spec.rb
@@ -75,6 +75,19 @@ describe Puppet::Util::RDoc do
       Puppet::Util::RDoc.manifestdoc([])
     end
 
+    it "should use a parser with the correct environment" do
+      FileTest.stubs(:file?).returns(true)
+      Puppet::Util::RDoc.stubs(:output)
+
+      parser = stub_everything
+      Puppet::Parser::Parser.stubs(:new).with{ |env|
env.is_a?(Puppet::Node::Environment) }.returns(parser)
+
+      parser.expects(:file=).with("file")
+      parser.expects(:parse)
+
+      Puppet::Util::RDoc.manifestdoc(["file"])
+    end
+
     it "should puppet parse all given files" do
       FileTest.stubs(:file?).returns(true)
       Puppet::Util::RDoc.stubs(:output)






PATCH/puppet 0/4] Some random puppet fix for JRuby
Hi,

Here is the first stab of JRuby Puppet compatibility.
There looks to be more thread issue (the last ones I found are
parser functions initializations), which will be addressed in
subsequent patches.

No patch in this serie have tests, because they most deal with
threading issues that can be reproduced only under JRuby.

Please review,
Brice

Brice Figureau (4):
  JRuby doesn't implement Process.maxgroups
  Fix #4244 - Cached Attributes is not thread safe
  Fix race condition in rack autoloading of request/response
  Fix #4245 - default insertion of ACL is not thread safe

 lib/puppet/network/http/rack.rb       |    3 +++
 lib/puppet/network/rest_authconfig.rb |    9 ++++++---
 lib/puppet/util/cacher.rb             |   31 +++++++++++++++++++++
PATCH/puppet 1/1] [#4347] run_mode was colliding with --mode for "puppet doc"
The run_mode value was incorrectly getting stored to Puppet[:mode], which
was confusing the optparser for applications that declare a --mode
parameter.

Signed-off-by: Jesse Wolfe <jes### @gmail.com>
---
 lib/puppet/application.rb |    2 +-
 lib/puppet/defaults.rb    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb
index 0a8fbc1..2fec38b 100644
--- a/lib/puppet/application.rb
+++ b/lib/puppet/application.rb
@@ -285,7 +285,7 @@ class Application
       Puppet.settings.set_value(:name, Puppet.application_name.to_s,
:mutable_defaults)
       Puppet.settings.set_value(:logdir, Puppet.run_mode.logopts,
:mutable_defaults)
       Puppet.settings.set_value(:rundir, Puppet.run_mode.run_dir,
:mutable_defaults)
-      Puppet.settings.set_value(:mode, Puppet.run_mode.name.to_s,
:mutable_defaults)
+      Puppet.settings.set_value(:run_mode, Puppet.run_mode.name.to_s,
:mutable_defaults)
     end
 
     require 'puppet'
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 84e2d93..0de5f20 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -7,7 +7,7 @@ module Puppet
     :vardir => [Puppet.run_mode.var_dir, "Where Puppet stores dynamic
and growing data.  The default for this parameter is calculated specially,
like `confdir`_."],
     :name => [Puppet.application_name.to_s, "The name of the
application, if we are running as one.  The
       default is essentially $0 without the path or ``.rb``."],
-    :mode => [Puppet.run_mode.name.to_s, "The effective 'run mode' of
the application: master, agent, or user."]
+    :run_mode => [Puppet.run_mode.name.to_s, "The effective 'run mode'
of the application: master, agent, or user."]
   )
 
   setdefaults(:main, :logdir => Puppet.run_mode.logopts)






Re: Uncaught Exception in Puppet::Resource::Catalog under 2.6
On 10/07/10 22:18, Gary Larizza wrote:
 Sorry for the delay, here it is.  http://pastie.org/1039070

It looks like Puppet::Resource::Catalog#resources doesn't exist anymore.
I suggest you file a redmine ticket with the full stacktrace so that it
can be fixed. It apparently comes from the commit 7c6b88.







PATCH/puppet 1/3] conf/redhat: Rebase rundir-perms patch
---
 conf/redhat/rundir-perms.patch |   26 +++++++++++++
Puppet Standalone Client + Fileserving, not working.... (+ nice tutorial for puppet stand-alone) :)
Puppet local fileserving not working, as  described here:

http://docs.reductivelabs.com/guides/modules.html

I've made a project to demonstrate this:
https://mindre### @github.com/mindr...alone_testing.git

There is more in the README...(http://github.com/mindreframer/
puppet_stand_alone_testing/blob/master/Readme.md)

Would be nice to get this working, it seems wasteful the rewrite the
modules only for stand-alone usage...

Thx!