diff --git a/README.md b/README.md index d9243b35674..d78a970d9a0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Generally, you need the following things installed: available separately. You could probably just compile and install that one library, though. -* Facter => 1.5.1 (available via your package manager or from the [Facter site](http://puppetlabs.com/projects/facter)). +* Facter => 2.0.0 (available via your package manager or from the [Facter site](http://puppetlabs.com/projects/facter)). License ------- diff --git a/conf/redhat/puppet.spec b/conf/redhat/puppet.spec index 78b55ad2c9c..109832c288e 100644 --- a/conf/redhat/puppet.spec +++ b/conf/redhat/puppet.spec @@ -12,9 +12,9 @@ Summary: A network tool for managing many disparate systems License: ASL 2.0 URL: http://puppetlabs.com #Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz -Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc4.tar.gz +Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz #Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.asc -Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc4.tar.gz.asc +Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz.asc Group: System Environment/Base @@ -69,7 +69,7 @@ The server can also function as a certificate authority and file server. %prep #%setup -q -n %{name}-%{version} -%setup -q -n %{name}-%{version}rc4 +%setup -q -n %{name}-%{version}rc1 patch -s -p1 < conf/redhat/rundir-perms.patch @@ -162,6 +162,7 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \ %{_mandir}/man8/puppet-apply.8.gz %{_mandir}/man8/puppet-catalog.8.gz %{_mandir}/man8/puppet-describe.8.gz +%{_mandir}/man8/puppet-ca.8.gz %{_mandir}/man8/puppet-cert.8.gz %{_mandir}/man8/puppet-certificate.8.gz %{_mandir}/man8/puppet-certificate_request.8.gz @@ -266,6 +267,9 @@ fi rm -rf %{buildroot} %changelog +* Wed Jun 06 2012 Matthaus Litteken - 2.7.16-0.1rc1 +- Update for 2.7.16rc1, added generated manpages + * Fri Jun 01 2012 Matthaus Litteken - 3.0.0-0.1rc3 - Puppet 3.0.0rc3 Release diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 233cc8ce2c1..48651982d50 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -164,21 +164,27 @@ def open_augeas glob_avail = !aug.match("/augeas/version/pathx/functions/glob").empty? opt_ctx = resource[:context].match("^/files/[^'\"\\[\\]]+$") if resource[:context] + restricted = false if resource[:incl] aug.set("/augeas/load/Xfm/lens", resource[:lens]) aug.set("/augeas/load/Xfm/incl", resource[:incl]) elsif glob_avail and opt_ctx + restricted = true + # Optimize loading if the context is given, requires the glob function + # from Augeas 0.8.2 or up ctx_path = resource[:context].sub(/^\/files(.*?)\/?$/, '\1/') load_path = "/augeas/load/*['%s' !~ glob(incl) + regexp('/.*')]" % ctx_path if aug.match(load_path).size < aug.match("/augeas/load/*").size aug.rm(load_path) + restricted = true else # This will occur if the context is less specific than any glob debug("Unable to optimize files loaded by context path, no glob matches") end end aug.load + print_load_errors(:warning => restricted) end @aug end @@ -282,14 +288,29 @@ def set_augeas_save_mode(mode) @aug.set("/augeas/save", mode) end + def print_load_errors(args={}) + errors = @aug.match("/augeas//error") + unless errors.empty? + if args[:warning] + warning("Loading failed for one or more files, see debug for /augeas//error output") + else + debug("Loading failed for one or more files, output from /augeas//error:") + end + end + print_errors(errors) + end + def print_put_errors errors = @aug.match("/augeas//error[. = 'put_failed']") debug("Put failed on one or more files, output from /augeas//error:") unless errors.empty? + print_errors(errors) + end + + def print_errors(errors) errors.each do |errnode| @aug.match("#{errnode}/*").each do |subnode| - sublabel = subnode.split("/")[-1] subvalue = @aug.get(subnode) - debug("#{sublabel} = #{subvalue}") + debug("#{subnode} = #{subvalue}") end end end diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 83651cc6caa..d5a37d9e87d 100755 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -608,14 +608,34 @@ end end - describe "save failure reporting" do + describe "load/save failure reporting" do before do @augeas = stub("augeas") @augeas.stubs("close") @provider.aug = @augeas end - it "should find errors and output to debug" do + describe "should find load errors" do + before do + @augeas.expects(:match).with("/augeas//error").returns(["/augeas/files/foo/error"]) + @augeas.expects(:match).with("/augeas/files/foo/error/*").returns(["/augeas/files/foo/error/path", "/augeas/files/foo/error/message"]) + @augeas.expects(:get).with("/augeas/files/foo/error/path").returns("/foo") + @augeas.expects(:get).with("/augeas/files/foo/error/message").returns("Failed to...") + end + + it "and output to debug" do + @provider.expects(:debug).times(4) + @provider.print_load_errors + end + + it "and output a warning and to debug" do + @provider.expects(:warning).once() + @provider.expects(:debug).times(3) + @provider.print_load_errors(:warning => true) + end + end + + it "should find save errors and output to debug" do @augeas.expects(:match).with("/augeas//error[. = 'put_failed']").returns(["/augeas/files/foo/error"]) @augeas.expects(:match).with("/augeas/files/foo/error/*").returns(["/augeas/files/foo/error/path", "/augeas/files/foo/error/message"]) @augeas.expects(:get).with("/augeas/files/foo/error/path").returns("/foo") @@ -638,11 +658,18 @@ aug.match("/files/etc/test").should == [] end + it "should report load errors to debug only" do + @provider.expects(:print_load_errors).with(:warning => false) + aug = @provider.open_augeas + aug.should_not == nil + end + # Only the file specified should be loaded it "should load one file if incl/lens used" do @resource[:incl] = "/etc/hosts" @resource[:lens] = "Hosts.lns" + @provider.expects(:print_load_errors).with(:warning => true) aug = @provider.open_augeas aug.should_not == nil aug.match("/files/etc/fstab").should == [] @@ -665,6 +692,7 @@ it "should only load one file if relevant context given" do @resource[:context] = "/files/etc/fstab" + @provider.expects(:print_load_errors).with(:warning => true) aug = @provider.open_augeas aug.should_not == nil aug.match("/files/etc/fstab").should == ["/files/etc/fstab"]