Best unofficial Apache Server developers community |
| |||||
| Aug 2, 2010 | |||||
|
James Turnbull |
|
||||
| Tags: | |||||
Similar Threads
PATCH/puppet 1/3] vim: added elsif
Signed-off-by: Marc Fournier <marc.fo### @camptocamp.com>
---
ext/vim/syntax/puppet.vim | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ext/vim/syntax/puppet.vim b/ext/vim/syntax/puppet.vim
index 80cd91c..81efa92 100644
--- a/ext/vim/syntax/puppet.vim
+++ b/ext/vim/syntax/puppet.vim
@@ -68,7 +68,7 @@ syn match puppetNotVariable "\\$\w\+" contained
syn match puppetNotVariable "\\${\w\+}" contained
syn keyword puppetKeyword import inherits include
-syn keyword puppetControl case default if else
+syn keyword puppetControl case default if else elsif
syn keyword puppetSpecial true false undef
" comments last overriding everything else
PATCH/puppet 1/1] [#4108] Added queueing to the log
The log will now queue any log messages created when there is no
destination, and will flush the queue when a destination is added.
Signed-off-by: Nick Lewis <nic### @puppetlabs.com>
---
lib/puppet/util/log.rb | 17 +++++++++++++++++
spec/unit/util/log_spec.rb | 6 ++++++
spec/unit/util/logging_spec.rb | 6 ++++++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index ba23e12..64a8d14 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -31,6 +31,8 @@ class Puppet::Util::Log
@destinations = {}
+ @queued = []
+
class << self
include Puppet::Util
include Puppet::Util::ClassGen
@@ -145,6 +147,7 @@ class Puppet::Util::Log
else
@destinations[dest] = type.new()
end
+ flushqueue
rescue => detail
if Puppet[:debug]
puts detail.backtrace
@@ -167,6 +170,8 @@ class Puppet::Util::Log
return
end
+ queuemessage(msg) if @destinations.count == 0
+
@destinations.each do |name, dest|
threadlock(dest) do
dest.handle(msg)
@@ -174,6 +179,18 @@ class Puppet::Util::Log
end
end
+ def Log.queuemessage(msg)
+ @queued.push(msg)
+ end
+
+ def Log.flushqueue
+ return unless @destinations.size >= 1
+ @queued.each do |msg|
+ Log.newmessage(msg)
+ end
+ @queued.clear
+ end
+
def Log.sendlevel?(level)
@levels.index(level) >= @loglevel
end
diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb
index 7aaa580..c72078f 100755
--- a/spec/unit/util/log_spec.rb
+++ b/spec/unit/util/log_spec.rb
@@ -84,6 +84,12 @@ describe Puppet::Util::Log do
Puppet::Util::Log.new(:level => :notice, :message =>
:foo).message.should == "foo"
end
+ it "should write queued logs when the first destination is
specified" do
+ Hash.any_instance.stubs(:[]=)
+ Puppet::Util::Log.expects(:flushqueue)
+ Puppet::Util::Log.newdestination(:console)
+ end
+
it "should convert the level to a symbol if it's passed in as a
string" do
Puppet::Util::Log.new(:level => "notice", :message =>
:foo).level.should == :notice
end
diff --git a/spec/unit/util/logging_spec.rb
b/spec/unit/util/logging_spec.rb
index aee308e..41b07d4 100755
--- a/spec/unit/util/logging_spec.rb
+++ b/spec/unit/util/logging_spec.rb
@@ -40,6 +40,12 @@ describe Puppet::Util::Logging do
@logger.notice "foo"
end
+ it "should queue logs sent without a specified destination" do
+ Puppet::Util::Log.expects(:queuemessage)
+
+ @logger.notice "foo"
+ end
+
it "should use the path of any provided resource type" do
resource = Puppet::Type.type(:mount).new :name => "foo"
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 #4275 - Added parser call to extlookup for 2.6.x
Signed-off-by: James Turnbull <jam### @lovedthanlost.net>
---
ext/extlookup.rb | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ext/extlookup.rb b/ext/extlookup.rb
index d87583b..81e6a4b 100644
--- a/ext/extlookup.rb
+++ b/ext/extlookup.rb
@@ -125,6 +125,8 @@ module Puppet::Parser::Functions
desired = "_ExtUNSET_"
+ parser = Puppet::Parser::Parser.new(environment)
+
datafiles.each do |file|
parser.watch_file(file) if File.exists?(file)
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] [#4269] Undef variables interpolate to empty string
This fixes double-quoted strings to interpolate undef variables
as an empty string. This is the behavior present in 0.25.x.
Signed-off-by: Nick Lewis <ni### @puppetlabs.com>
---
lib/puppet/parser/ast/leaf.rb | 5 ++++-
spec/unit/parser/ast/leaf_spec.rb | 31 +++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb
index 49f4302..781fc4b 100644
--- a/lib/puppet/parser/ast/leaf.rb
+++ b/lib/puppet/parser/ast/leaf.rb
@@ -77,7 +77,10 @@ class Puppet::Parser::AST
class Concat < AST::Leaf
def evaluate(scope)
- @value.collect { |x| x.evaluate(scope) }.join
+ @value.collect do |x|
+ val = x.evaluate(scope)
+ val == :undef ? '' : val
+ end.join
end
def to_s
diff --git a/spec/unit/parser/ast/leaf_spec.rb
b/spec/unit/parser/ast/leaf_spec.rb
index d21cbf5..2843567 100755
--- a/spec/unit/parser/ast/leaf_spec.rb
+++ b/spec/unit/parser/ast/leaf_spec.rb
@@ -107,6 +107,37 @@ describe Puppet::Parser::AST::String do
end
end
+describe Puppet::Parser::AST::Concat do
+ describe "when evaluating" do
+ before :each do
+ @scope = stub_everything 'scope'
+ end
+ it "should interpolate variables and concatenate their values" do
+ one = Puppet::Parser::AST::String.new(:value => "one")
+ one.stubs(:evaluate).returns("one ")
+ two = Puppet::Parser::AST::String.new(:value => "two")
+ two.stubs(:evaluate).returns(" two ")
+ three = Puppet::Parser::AST::String.new(:value => "three")
+ three.stubs(:evaluate).returns(" three")
+ var = Puppet::Parser::AST::Variable.new(:value => "myvar")
+ var.stubs(:evaluate).returns("foo")
+ array = Puppet::Parser::AST::Variable.new(:value => "array")
+ array.stubs(:evaluate).returns(["bar","baz"])
+ concat = Puppet::Parser::AST::Concat.new(:value =>
[one,var,two,array,three])
+
+ concat.evaluate(@scope).should == 'one foo two barbaz three'
+ end
+
+ it "should transform undef variables to empty string" do
+ var = Puppet::Parser::AST::Variable.new(:value => "myvar")
+ var.stubs(:evaluate).returns(:undef)
+ concat = Puppet::Parser::AST::Concat.new(:value => [var])
+
+ concat.evaluate(@scope).should == ''
+ end
+ end
+end
+
describe Puppet::Parser::AST::Undef do
before :each do
@scope = stub 'scope'
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 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] [#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)
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] [#4333] old optparse doesn't support default_argv=
optparse hasn't always had the concept of default_argv. Fortunately, we don't really need it. Signed-off-by: Jesse Wolfe <jes5### @gmail.com> --- lib/puppet/application.rb | 3 +-- spec/unit/application_spec.rb | 14 ++
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)
PATCH/puppet 1/1] Fixed #4137 - Change schema to support Oracle DB stored configs
Signed-off-by: James Turnbull <ja### @lovedthanlost.net>
---
lib/puppet/rails/database/schema.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/puppet/rails/database/schema.rb
b/lib/puppet/rails/database/schema.rb
index 434197b..20d2e96 100644
--- a/lib/puppet/rails/database/schema.rb
+++ b/lib/puppet/rails/database/schema.rb
@@ -59,7 +59,7 @@ class Puppet::Rails::Schema
create_table :hosts do |t|
t.column :name, :string, :null => false
t.column :ip, :string
- t.column :environment, :string
+ t.column :environment, :text
t.column :last_compile, :datetime
t.column :last_freshcheck, :datetime
t.column :last_report, :datetime
New To Puppet - Two Questions
New to Puppet, heard about it for the first time at OSCON. Two quick questions: 1. Is there a web interface? This is really key to our company since we have some dev/ops people but also some customer service people (not command-line savvy) who need to do things. 2. Does it just manage server configuration or could I write custom extensions or modules to do things like list all of our customers who have accounts on a server, add/remove customers from our database, enable/disable logins to our web app, etc? These would be more like "business operations" not "it/server management operations". -K.R.
Puppet deployment design questions
A little history, I work with a small startup and we are looking at rolling out a automated cloud based provisioning platform. We have a dilemma and i wanted to ask your communities thoughts. As far as I am aware there are 3 ways to run puppet, standalone with puppet, Client/Server and a hybrid of client/server and rsync. The last of these wouldn't work very well in our case so I am not looking at it as a potential solution. We have tried the standalone, its slick. To me the standalone method is intended to address a need thats something entirely different to what we require. I moved on. I then went on to the client/server method. Essentially there are 2 ways this can work, the first is we(startup) control the master and deploy clients. The second is we deploy master+client on every server, the configuration would point to our external node web service. Each has its own advantage and we will be using external nodes to load the configurations in both cases. The differences are that the first would quickly become an issue when the version of the puppet client changes. So we have been exploring the second of these and still have other encounters that break with our goal of full automation. So my question, is there a better way? Am I missing something.
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!
unique behavior on puppet agent running on puppet master node
(reposted from irc) Having just upgraded to 2.6, I am seeing different behavior between the agent running on the master node and the rest of the agents. Most importantly, it complains about "warning: You cannot collect without storeconfigs being set" even though storeconfigs=true in the [master] section of puppet.conf Less important, but still curious: the logging is quite different, including lots of "info: Automatically imported <blah>" lines). my puppet.conf: http://pastebin.com/nLZu9zrf ~jon
Redirection when no query string
Jul 3, 2010 double to string + concatenate Jun 24, 2010 Some questions May 25, 2010 Tic Tac Toe questions and help Jun 8, 2010 www works http:// doesn't Jul 31, 2010 A http-Web-server in C May 30, 2010 .htaccess http 404 error Jun 25, 2010 RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://flashmavi.com/.*$ [NC] Re Jul 26, 2010 Redirecting specific pages from http to https and reverse Jul 19, 2010 rewrite http to https not only in url and html, but also jpg gif image files Jun 15, 2010 | |||||