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] Fix for #4465 -- earlier "feature" patch broke ldap

PATCH/puppet 1/1] [#4467] Make Puppet Master respect facts_terminus settings
(97 lines)
What is happening during caching the catalog to disk?
(100 lines)
Aug 4, 2010
Markus Roberts
Markus Roberts
The patch for #3904 should not have been accepted; it's buggy and the use
case
(supporting having nodes in ldap more than once with the same name but
distinct
records) is ill-conceived.

This commit reverts the patch (a7884b47) and the previous attempt to fix
it
(e6709da4), restoring the old (0.25.x) behaviour.

Signed-off-by: Markus Roberts <Mark### @reality.com>
---
 lib/puppet/indirector/node/ldap.rb     |   60 ++++
Reply
Tags: patcha7884b47revertscommit
Similar Threads
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: [PATCH/puppet 1/1] [#4111] Remove special case for "ensure"
On Jul 10, 2010, at 10:08 AM, Markus Roberts wrote:

 After mulling this a while, I think the real issue is that we're
 treating ensure as an attribute-set rather than as an attribute. 
It's
 a magic feature that semantically sets a whole slew of features. 
When
 we say "ensure => present" we really mean "present => true" and
so on:

 "ensure => absent" means "present => false"
 "ensure => 3.2" means "present => true; version => 3.2"
 "ensure => running" means "present => true; running => true"
 "ensure => eatable" means "present => true; toxic => false; 

 palatable => true"

 and so on.  Then all the special casing is on the two-valued
"present"
 attribute instead of trying to figure out what "ensure =>
scrumulous"
 means, we just say that any of the above which set "present =>
false"
 also set all other state attributes to undef, while leaving identity
 attributes (e.g. name, target, provider) unchanged.

This seems like a reasonable conclusion, but how do you plan on  
implementing it?  Actually creating multiple parameters?

How does this change if we treat 'ensure' as a state machine, as we've  
been "planning" on doing for a while?

Isn't it more like certain states or state transitions swamp all other  
out-of-sync parameters and others don't?

I'm not saying you can't figure out how to treat 'ensure' as multiple  
parameters, but I never had much luck in my paltry attempts at it.  In  
fact, the only case where I tried splitting it up -- services, with  
'enable => true' and 'ensure => running' -- is essentially a
usability  
disaster.







PATCH/puppet 1/1] [#4111] Remove special case for "ensure"
If "ensure" changes, then no other changes are logged for that resource.
I'm not sure why this special case is here. If I remove it, like so,
then what happens?

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

diff --git a/lib/puppet/transaction/resource_harness.rb
b/lib/puppet/transaction/resource_harness.rb
index ae38bcb..7c1d019 100644
--- a/lib/puppet/transaction/resource_harness.rb
+++ b/lib/puppet/transaction/resource_harness.rb
@@ -48,11 +48,10 @@ class Puppet::Transaction::ResourceHarness
 
         if param = resource.parameter(:ensure)
             return [] if absent_and_not_being_created?(current, param)
-            return [Puppet::Transaction::Change.new(param,
current[:ensure])] unless ensure_is_insync?(current, param)
             return [] if ensure_should_be_absent?(current, param)
         end
 
-        resource.properties.reject { |p| p.name == :ensure }.reject do
|param|
+        resource.properties.reject do |param|
             param.should.nil? 
         end.reject do |param|
             param_is_insync?(current, param)






Re: [PATCH/puppet 1/1] [#4111] Remove special case for "ensure"
Not a bug for 2.6, I believe. Perhaps needs-design-decision for later.

On Jul 7, 2010 11:11 AM, "Markus Roberts" <mark### @puppetlabs.com>
wrote:

So does that make #4111 not-a-bug or....?

-- Markus







PATCH/puppet 1/1] [#4336] "reportdir" was in the wrong section
Correctly revert damage done by c00285c, which incorrectly reverted in
a7e4fe8.
The result was that "puppet agent" and others were trying to create a
reportdir that they don't actually use.

Signed-off-by: Jesse Wolfe <jes5### @gmail.com>
---
 lib/puppet/defaults.rb |   20 ++++++++++
PATCH/puppet 1/3] conf/redhat: Rebase rundir-perms patch
---
 conf/redhat/rundir-perms.patch |   26 +++++++++++++
Remove "User", "Group" and "ScoreBoardFile" from mpmt_os2
I want to remove "User", "Group" and "ScoreBoardFile" from the OS2 MPM.

The directives have an empty implementation ignore_cmd() and have only 
been introduced for consistency with those MPMS which did support it.

In trunk "User" and "Group" are no longer MPM directives, they moved to 
mod_unixd, and "ScoreBoardFile" is implemented in the core though only 
functional if APR_HAS_SHARED_MEMORY.

The removal from the OS2 MPM will break existing configurations (syntax 
error) which use "User" or "Group" including the old 2.2 default 
configuration (but not the most recent trunk default configuration). 
Though this is annoying, tolerating non-functional directives which are 
supposed to be security relevant isn't nice as well.

Opinions?

Regards,

Rainer



Re: Re: standalone puppet file source error "Could not evaluate: getaddrinfo: ..."
If downgrading to 0.25 fixed this, then the problem probably isn't
with facter, and as you say, older versions of facter wouldn't have
the bug I mentioned.  The patch I suggested would only have fixed
things if you were running facter from source.

So yes, please file a bug report with the info necessary to reproduce
this, which it looks like might all be already in your email.
Matt

On Tue, Aug 3, 2010 at 3:11 AM, bobics <bobi### @gmail.com> wrote:
 Matt, thanks for the tip.

 I'm using the lastest facter 1.5.7 gem, I glanced at the code and it
 doesn't look like that patch applies.  Should I not be using the
 stable version of facter?  Looks like 1.5.7 was last updated in
 9/2009? :/

 On Aug 2, 6:04 pm, Matt Robinson <m..### @puppetlabs.com> wrote:
> I was seeing similar problems and it had to do with a bug in
facter
> since it wasn't confining a windows fact to windows.  Try this
patch
> on your facter:
>
>
http://github.com/nicklewis/facter/co...5abc43b3641fcf...

 --
 
standalone puppet file source error "Could not evaluate: getaddrinfo: ..."
When using file { "/tmp/bobics_fileserver": source => "puppet:///
modules/bobics/bobics_fileserver"} I get the error:
err: /Stage[main]/Bobics/File[/tmp/bobics_fileserver]: Could not
evaluate: getaddrinfo: Name or service not known Could not retrieve
file metadata for puppet:///modules/bobics/bobics_fileserver:
getaddrinfo: Name or service not known at /home/debian/puppet_sample/
modules/bobics/manifests/init.pp:8

Any idea why I might be getting this error?  I can provide my sample
project if needed (you should be able to reconstruct it with the info
below).

I'm using Puppet 2.6 on a Debian virtual machine.  Standalone puppet
is launched with the following command:
sudo puppet -v manifests/site.pp --confdir=.

### site.pp ###
node default {
	include bobics
}
###

### init.pp ###
class bobics {
    file { "/tmp/bobics_installed":
       ensure => present
    }

    file { "/tmp/bobics_fileserver":
       source => "puppet:///modules/bobics/bobics_fileserver"
    }
}
###

### puppet.conf ###
[puppet]
###

I have a very simple puppet structure:
manifests/
	site.pp
modules/
	bobics/
		files/
			bobics_fileserver (just a text file)
			bobics_installed (just a text file)
		manifests/
			init.pp
puppet.conf

Thanks,
-Andy





Exception raised: {"error":"error","reason":"eacces"} on Win
I installed from
http://wiki.apache.org/couchdb/Windows_binary_installer file
setup-couchdb-0.11.0.exe dated May 11, 2010

When I run (from Chrome since it hangs in IE)
http://127.0.0.1:5984/_utils/couch_te...pt/couch_tests.js
status is "Success" until from "batch_save" and all subsequent items
result in error with
message Exception raised: {"error":"error","reason":"eacces"}

Has anyone run into this situation, and found the cause and a solution?


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 1/1] [#4467] Make Puppet Master respect facts_terminus settings
* Remove hard-coded facts terminus in master
* Change facts_terminus default to 'yaml' for master and 'facter' for
  everything else.

Paired-with: Matt Robinson <ma### @puppetlabs.com>
Signed-off-by: Rein Henrichs <re### @puppetlabs.com>
---
 lib/puppet/application/master.rb       |    3 ---
 lib/puppet/defaults.rb                 |    2 +-
 spec/unit/indirector/node/ldap_spec.rb |    4 ----
 spec/unit/node/facts_spec.rb           |   15 +++++++++++++--
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/lib/puppet/application/master.rb
b/lib/puppet/application/master.rb
index 777a50e..fde4749 100644
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@ -138,9 +138,6 @@ class Puppet::Application::Master <
Puppet::Application
 
     Puppet.settings.use :main, :master, :ssl
 
-    # A temporary solution, to at least make the master work for now.
-    Puppet::Node::Facts.terminus_class = :yaml
-
     # Cache our nodes in yaml.  Currently not configurable.
     Puppet::Node.cache_class = :yaml
 
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 84e2d93..3c79439 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -115,7 +115,7 @@ module Puppet
     :node_terminus => ["plain", "Where to find information about
nodes."],
     :catalog_terminus => ["compiler", "Where to get node catalogs. 
This is useful to change if, for instance,
       you'd like to pre-compile catalogs and store them in memcached or
some other easily-accessed store."],
-    :facts_terminus => ["facter", "Where to get node facts."],
+    :facts_terminus => [Puppet.application_name.to_s == "master" ?
'yaml' : 'facter', "The node facts terminus."],
     :httplog => { :default => "$logdir/http.log",
       :owner => "root",
       :mode => 0640,
diff --git a/spec/unit/indirector/node/ldap_spec.rb
b/spec/unit/indirector/node/ldap_spec.rb
index f9c5efa..a5f14fc 100755
--- a/spec/unit/indirector/node/ldap_spec.rb
+++ b/spec/unit/indirector/node/ldap_spec.rb
@@ -5,10 +5,6 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
 require 'puppet/indirector/node/ldap'
 
 describe Puppet::Node::Ldap do
-  before do
-    Puppet::Node::Facts.stubs(:terminus_class).returns :yaml
-  end
-
   describe "when searching for a single node" do
     before :each do
       @searcher = Puppet::Node::Ldap.new
diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb
index a2f4ab9..394db79 100755
--- a/spec/unit/node/facts_spec.rb
+++ b/spec/unit/node/facts_spec.rb
@@ -88,9 +88,20 @@ describe Puppet::Node::Facts, "when indirecting" do
       @facts.save
     end
 
-    it "should default to the 'facter' terminus" do
-      Puppet::Node::Facts.indirection.terminus_class.should == :facter
+    describe "when the Puppet application is 'master'" do
+      it "should default to the 'yaml' terminus" do
+        pending "Cannot test the behavior of defaults in defaults.rb"
+        # Puppet::Node::Facts.indirection.terminus_class.should == :yaml
+      end
     end
+
+    describe "when the Puppet application is not 'master'" do
+      it "should default to the 'facter' terminus" do
+        pending "Cannot test the behavior of defaults in defaults.rb"
+        # Puppet::Node::Facts.indirection.terminus_class.should ==
:facter
+      end
+    end
+
   end
 
   describe "when storing and retrieving" do






PATCH/puppet 1/1] [#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the AST re
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 +++
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] added md5 support as requested in http://serverfault.com/questions/166199/puppet-
From: Alice Kærast <kaer### @newscloud.com>


Signed-off-by: James Turnbull <ja### @lovedthanlost.net>
---
 lib/puppet/parser/functions/md5.rb |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
 create mode 100644 lib/puppet/parser/functions/md5.rb

diff --git a/lib/puppet/parser/functions/md5.rb
b/lib/puppet/parser/functions/md5.rb
new file mode 100644
index 0000000..f7a4f72
--- /dev/null
+++ b/lib/puppet/parser/functions/md5.rb
@@ -0,0 +1,5 @@
+Puppet::Parser::Functions::newfunction(:md5, :type => :rvalue, :doc
=> "Returns a MD5 hash value from a provided string.") do |args|
+      require 'md5'
+
+      Digest::MD5.hexdigest(args[0])
+end






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] 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)






What is the "best practices" way to install puppet
Damn it, is there no acronym for "best practices" yet? ;)

Ok, I am installing puppet, and wondering which version and from where
should I install.  Gems?  OS packages? Version?

Thanks.

Kevin





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 +++++++++++++++++++++