diff -Nru puppet-2.7.6/CHANGELOG puppet-2.7.9/CHANGELOG --- puppet-2.7.6/CHANGELOG 2011-10-22 07:28:06.000000000 +0000 +++ puppet-2.7.9/CHANGELOG 2011-12-10 02:49:11.000000000 +0000 @@ -1,3 +1,177 @@ +2.7.9 +=== +da11dc7 Fix Ruby 1.8.5-incompatible code in FileBucket::Dipper spec +737c2f6 Fix Ruby 1.8.5-incompatible code in Transaction#eval_generate +042925d Fix Ruby 1.8.5-incompatible code in spec setup + +2.7.8 +=== +3eff60a Readying for 2.7.8rc release +e4ee794 (#10739) Provide default subjectAltNames while bootstrapping master +2dedee6 (#2744) Don't automatically enable show_diff in noop mode +ef78358 Give variables more descriptive names +cd3d4ea maint: Rename xgenerate to add_dynamically_generated_resources +000a2d8 (#6907) Prefetch unsuitable providers +70114e9 (#6907) Allow providers to be selected in the run they become suitable +a0ee5c7 maint: Fix incorrect whitespace +4e8a73c Fix description in service provider test for FreeBSD +a2eab4f (#6697) Set service provider default path to /etc/rc.d on Archlinux +da75795 (#6335) Allow optional trailing comma in argument lists. +47c786e Update CHANGELOG and packaging for 2.7.7 final +8030428 (#8255) Always use string modes when creating resources from FileSetting settings +c804346 (#7274) Output 4-digit file modes in File type +220f2ba (#10799) Regexp escaping too much +4462eb5 Merged 2.6.x into 2.7x +67e048b Updated CHANGELOG for 2.7.7rc2 +93aca5a maint: Fix failing specs for Windows exec provider +7f3a1bb (#9617) Use an RbTreeMap to store ready resources +9eff0f4 (#9671) Implement RbTreeMap#each recursively, and #first/#last explicitly +5f7f467 (#9671) Return nodes from internal RbTreeMap recursion +1dc9c72 (#9671) Stop tracking size and height of nodes in RbTreeMap +f180f9b (#9617) Add a red-black tree map +c62e949 (#9617) Keep track of blockers for resources when traversing +2cb6d72 (#9671) Generated resources should not depend on the completed_ whit +a5845b7 (#9671) Exit early from #eval_generate if nothing is created +7002eff (#9617) Be smarter about finding parents when eval_generating +11fda78 maint: Don't File#expand_path when unmunging file paths +ad4316a (#9671) Use Array#concat rather than += +20260f3 maint: Correct the spelling of sentinel +4f03384 (#10614) Detect when trying to managing ACLs on a non-ACL volume +37b9f0f (#10614) Provide default metadata values for Windows ACLs +1cb37c9 (#10614) Add method for detecting Windows volumes that support ACLs +c9ee5a0 (#10614) Fix setting and clearing read-only attribute on Windows +ed27a90 (#10614) Fix error checking for Windows BOOL return values +7f0756d (#10727) Don't rely on Kernel#Pathname +23379d0 (#10614) Detect when trying to managing ACLs on a non-ACL volume +374fee5 (#10614) Provide default metadata values for Windows ACLs +f60e889 (#10614) Add method for detecting Windows volumes that support ACLs +1371dbd (#10614) Fix setting and clearing read-only attribute on Windows +7eb0197 (#10614) Fix error checking for Windows BOOL return values +9dfd011 (#5617) Puppet queue logging +0a34697 (#2744) Display file diffs through the Puppet log system. +0c28238 (#9508) Be explicit is setting `auth any` for default ACLs. +f140eca Updated CHANGELOG for 2.7.7rc1 +057cda6 (#9508) Default ACL of `auth any` makes sense where we had `auth no` +78670ed (#9983) Checksum file in binary mode when storing to filebucket +da11a78 (#9983) Serve file content in binary mode +13f1054 (#9983) Read file content from disk using binary mode +4b4bb8b (#9983) Use binary mode when reading and writing FileBucketFiles +899833b (#9983) Read file content in binary mode when backing up +dc8bcf8 (#9983) Restore files in binary mode +489a679 (#9983) Checksum files in binary mode +f7bfa05 (#9983) Add method for reading binary files +674068a (#10269) Make directories executable so they can be cleaned up +fd747cc (#10365) Add pending test when file overwrites an executable directory +fe30d8f (#10315) Add pending tests when following symlinks +a22c7aa Maint: Fix test breakage +8576e86 (#10269) Search bit not set on newly created directories +a91cfa1 maint: Fix failing spec on old version of rspec +428e08c Stub File.open to not touch the disk +aa2a762 (#10289) Add an ext script to upload facts to inventory server +a97337f (#10346) Fix storeconfigs spec failures when run alone +5129d38 (#10289) Add a safe alternative to REST for inventory service +5c4daa4 (#7601) Use definition lists in indirection references +7df46a2 (#7601) Use definition lists in type references +ad97dc9 (#7601) Add markdown_definitionlist method to reference.rb +455c9aa Maint: Revise reference text for most types and providers +ced8e19 (#7601) Remove unnecessarily abstracted paramwrap method +a6957ac (#7601) Rename "h" method to "markdown_header" +7a0ade6 (#7601) Use << instead of += in references +7d65796 (#9109) Retrieve request parameters from the request body for POSTs +5a2952c (maint) Fix CA-related specs failing on Windows +42fb76e Fix typo in report debug message +eab5965 missing includes in network XML-RPC handlers +7514d32 missing includes in network XML-RPC handlers +614526a (#10244) Restore Mongrel XMLRPC functionality +397a506 (#10244) Restore Mongrel XMLRPC functionality +fcaf7c5 Updated CHANGELOG for 2.6.12 +f51d221 Improve the error message when a CSR is rejected +d551747 Allow a master to bootstrap itself with dns_alt_names and autosign +0405196 (maint) Remove ssl dir before starting a master with DNS alt names +3ed6499 Backport Enumerable#count to Rubies < 1.8.7 +5f44c23 More 1.8.5 compatibility fixes. +ef1b960 Better 1.8.5 compatible implementation of `lines`. +246e875 (#2848) Config options require '_', not '-'. +3bdeb3a Ruby 1.8.5 compatibility changes in tests and code. +6866d4b Add `lines` alias for `each_line` in Ruby 1.8.5. +2f9ec3c s/not_to/should_not/ for older versions of RSpec 2. +56320ea (#2848) Eliminate redundant `master_dns_alt_names`. +de19861 (#2848) Remove the legacy SSLCertificates code +cf008a6 (#2848) Rework the xmlrpc CA handler to use the modern SSL code +32be180 (#2848) Remove unused xmlrpc code +5f2a44d (#2848) Consistent return values from `subject_alt_names` accessors. +5e507f2 (#2848) Consistently use `subject_alt_names` as accessor name. +5ac2417 (#2848) Don't strip the subjectAltName label when listing. +44cf3a2 (#2848) Don't enable `emailProtection` for server keys. +d66def9 (#2848) Only mark `subjectAltName` critical if `subject` is empty. +8174047 (#2848) Migrate `dns-alt-names` back to settings. +f18df2b Wire up the `setbycli` slot in Puppet settings. +efa61f2 (#2848) rename subject-alt-name option to dns-alt-names +f103b20 (#2848) Rename `certdnsnames` to match new behaviour. +363b47b (#2848) Use `certdnsnames` when bootstrapping a local master. +49334ff (#2848) CSR subjectAltNames handling while signing. +5f2af93 (#2848) List subject alt names in output of puppet cert --list +bb475ec (#7224) Add a helper to Puppet::SSL::Certificate to retrieve alternate names +bab9310 (#2848) Rewrite SSL Certificate Factory, fixing `subjectAltName` leak. +fca1ff0 (#2848) Reject unknown (== all) extensions on the CSR. +443a756 (#2848) extract the subjectAltName value from the CSR. +66101f1 (#2848) Set `certdnsnames` values into the CSR. +77b814f (#6928) Don't blow up when the method is undefined... +5427f1e (#6928) backport Symbol#to_proc for Ruby < 1.8.7 +6ef1d3a (#6371) Update lastchg field in shadow file on Solaris. +c343615 (#10161) Parenthesize method arguments +5721ab9 Maint: Remove duplicate path extension code +edc721e (#9636) Always set $CHILD_STATUS when executing on Windows +448d5db (#9636) Fix PATHEXT resolution for paths other than system32 +424379d (#9996) Restore functionality for multi-line commands in exec resources +ad98d47 (#9831) Standardize Windows provider confining +cf8fae2 (#9832) General StoreConfigs regression. +1e8a2cd (#9607) Only validate package source when it is set or needed +0258096 (#9461) Resolve executables using PATHEXT on Windows +d78afda (#9938) Allow directory sticky-ness to be set +23b4864 Maint: Document tag metaparameter's ability to take an array +b3c0f1d Stub method for getting roles from the user provider +006a128 Set vardir so that msi package provider runs on Windows +4185b4e Add Windows-specific tests when user parameter specified in exec +aab6b40 Disable mount provider tests on Windows +58f97e3 Update test due to lack of 'true' on Windows +1fd90c3 Change tests to not use 'mount' provider +220f5e0 Added 'touch' method enabling tests to run on Windows +ca0bc4f Change test to not call 'rm -rf' +1883455 Remove 'fails_on_windows' tag for passing tests +0d7c797 (#8414) Create scheduled_task type for use with Windows scheduled tasks +4ddef89 (#8414) Require win32-taskscheduler gem on Windows +0ecf3ab Add ability to look up fully qualified local accounts using Puppet::Util::Adsi.sid_for_account +23d5aeb Add support for displaying hashes to Puppet::Parameter.format_value_for_display +f0c3414 Move parameter formatting rules into helper method +845e05b Wrap long lines in Type::Package +18d65ec Whitespace cleanup in Type::SshAuthorizedKey +b2e2175 Include necessary Facter stubs +f5bc897 Remove test dependencies on QUANTITY of calls +51adf31 Reset the @macosx_version_major variable +4b9dfdd Reset the @job_list variable between tests +446a5bf Remove use of defined?() +0e4079d Use memoization instead of 'unless' +9d504ff (#9796) ssh_authorized_key supports whitespace again +122b8c2 (#9459) Fix problems with Windows 'user' and 'group' providers. +ee107cf Use instance variable for job_list +d1e0fa1 Refactor launchd provider spec tests +3440c10 Refactor status method +62b8d6b Deprecation Warning if using Facter <= 1.5.5 +8a50c3a Test prefetching +f09d264 Stub call to Facter +a6bc5a5 Optimize @product_version variable +af42ff8 Documentation Commit +55610bf Whitespace Commit +cf3d378 Change method used to get Fact Value +ce776b0 Revert launchd_spec +f65b111 Rearrange launchd provider +ed90957 First attempt at launchd spec +637b57b Implement Caching +60482f4 Whitespace and Alignment Commit +5b52bd6 Bring up to date with topic branch +27057a6 Maint: Fix the "provider" parameter documentation + 2.7.6 (includes CVE-2011-3872 see http://puppetlabs.com/security/hotfixes/cve-2011-3872/ === c09517a Improve the error message when a CSR is rejected diff -Nru puppet-2.7.6/conf/auth.conf puppet-2.7.9/conf/auth.conf --- puppet-2.7.6/conf/auth.conf 2011-10-22 07:15:53.000000000 +0000 +++ puppet-2.7.9/conf/auth.conf 2011-12-08 22:58:08.000000000 +0000 @@ -75,21 +75,22 @@ allow * ### Unauthenticated ACL, for clients for which the current master doesn't -### have a valid certificate +### have a valid certificate; we allow authenticated users, too, because +### there isn't a great harm in letting that request through. # allow access to the master CA path /certificate/ca -auth no +auth any method find allow * path /certificate/ -auth no +auth any method find allow * path /certificate_request -auth no +auth any method find, save allow * diff -Nru puppet-2.7.6/conf/redhat/puppet.spec puppet-2.7.9/conf/redhat/puppet.spec --- puppet-2.7.6/conf/redhat/puppet.spec 2011-10-22 07:24:54.000000000 +0000 +++ puppet-2.7.9/conf/redhat/puppet.spec 2011-12-10 02:49:11.000000000 +0000 @@ -5,13 +5,16 @@ %global confdir conf/redhat Name: puppet -Version: 2.7.6 +Version: 2.7.9 +#Release: 0.1rc1%{?dist} Release: 1%{?dist} 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}rc1.tar.gz Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.asc +#Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz.asc Group: System Environment/Base @@ -282,6 +285,21 @@ rm -rf %{buildroot} %changelog +* Fri Dec 9 2011 Matthaus Litteken - 2.7.9-1 +- Update for 2.7.9 + +* Thu Dec 8 2011 Matthaus Litteken - 2.7.8-1 +- Update for 2.7.8 + +* Wed Nov 30 2011 Michael Stahnke - 2.7.8-0.1rc1 +- Update for 2.7.8rc1 + +* Mon Nov 21 2011 Michael Stahnke - 2.7.7-1 +- Relaese 2.7.7 + +* Tue Nov 01 2011 Michael Stahnke - 2.7.7-0.1rc1 +- Update for 2.7.7rc1 + * Fri Oct 21 2011 Michael Stahnke - 2.7.6-1 - 2.7.6 final diff -Nru puppet-2.7.6/conf/solaris/pkginfo puppet-2.7.9/conf/solaris/pkginfo --- puppet-2.7.6/conf/solaris/pkginfo 2011-10-22 07:15:53.000000000 +0000 +++ puppet-2.7.9/conf/solaris/pkginfo 2011-12-08 22:58:08.000000000 +0000 @@ -1,6 +1,6 @@ PKG=CSWpuppet NAME=puppet - System Automation Framework -VERSION=2.7.2 +VERSION=2.7.8 CATEGORY=application VENDOR=http://projects.puppetlabs.com/projects/puppet -EMAIL=luke@puppetlabs.com +EMAIL=info@puppetlabs.com diff -Nru puppet-2.7.6/conf/suse/puppet.spec puppet-2.7.9/conf/suse/puppet.spec --- puppet-2.7.6/conf/suse/puppet.spec 2011-10-22 07:15:53.000000000 +0000 +++ puppet-2.7.9/conf/suse/puppet.spec 2011-12-08 22:58:08.000000000 +0000 @@ -4,13 +4,13 @@ Summary: A network tool for managing many disparate systems Name: puppet -Version: 2.7.2 +Version: 2.7.8 Release: 0.1rc1%{?dist} License: Apache 2.0 Group: Productivity/Networking/System URL: http://puppetlabs.com/projects/puppet/ -Source0: http://puppetlabs.com/downloads/puppet/%{name}-%{version}.tar.gz +Source0: http://puppetlabs.com/downloads/puppet/%{name}-%{version}rc1.tar.gz PreReq: %{insserv_prereq} %{fillup_prereq} Requires: ruby >= 1.8.2 @@ -35,7 +35,7 @@ The server can also function as a certificate authority and file server. %prep -%setup -q +%setup -q -n %{name}-%{version}rc1 %build for f in bin/* sbin/*; do @@ -136,6 +136,12 @@ %{__rm} -rf %{buildroot} %changelog +* Wed Nov 30 2011 Michael Stahnke - 2.7.8-0.1rc1 +- Update for 2.7.8rc1 + +* Mon Nov 21 2011 Michael Stahnke - 2.7.7-1 +- Release 2.7.7 + * Wed Jul 06 2011 Michael Stahnke - 2.7.2-0.1rc1 - Updating to 2.7.2rc1 diff -Nru puppet-2.7.6/debian/changelog puppet-2.7.9/debian/changelog --- puppet-2.7.6/debian/changelog 2011-12-20 00:22:23.000000000 +0000 +++ puppet-2.7.9/debian/changelog 2012-01-02 13:47:34.000000000 +0000 @@ -1,3 +1,27 @@ +puppet (2.7.9-1ubuntu1) precise; urgency=low + + * Merge from Debian testing. Remaining changes: + + Add 2 patches to fix incompatibility with Augeas 0.10.0: + - augeas_saved_files + - augeas_versioncmp + + Change Maintainer according to policy + + -- Chuck Short Wed, 21 Dec 2011 07:00:18 +0000 + +puppet (2.7.9-1) unstable; urgency=low + + * New upstream release + + -- Stig Sandbeck Mathisen Sat, 10 Dec 2011 12:16:32 +0100 + +puppet (2.7.8-1) unstable; urgency=low + + * New upstream release + * Update dependencies for renamed ruby packages + * puppet-testsuite: Depend on ruby-sqlite3 + + -- Stig Sandbeck Mathisen Fri, 09 Dec 2011 08:50:08 +0100 + puppet (2.7.6-1ubuntu1) precise; urgency=low * Add 2 patches to fix incompatibility with Augeas 0.10.0: @@ -550,7 +574,7 @@ * Remove old config files and stray directories (Closes: #454681) -- Micah Anderson > Sat, 03 May 2008 16:18:32 -0400 - + puppet (0.24.4-6) unstable; urgency=low * Remove bashisms in puppetmaster.init @@ -890,3 +914,4 @@ * Initial release. (Closes: #348625) -- Matthew Palmer Wed, 24 May 2006 13:10:01 +1000 + diff -Nru puppet-2.7.6/debian/control puppet-2.7.9/debian/control --- puppet-2.7.6/debian/control 2011-12-20 00:22:10.000000000 +0000 +++ puppet-2.7.9/debian/control 2011-12-21 07:00:17.000000000 +0000 @@ -15,7 +15,7 @@ Architecture: all Depends: ${misc:Depends}, ruby1.8, libxmlrpc-ruby, libopenssl-ruby, libshadow-ruby1.8, libaugeas-ruby1.8, adduser, facter, lsb-base, sysv-rc (>= 2.87) | file-rc Recommends: lsb-release, debconf-utils -Suggests: libselinux-ruby1.8, librrd-ruby1.8 +Suggests: ruby-selinux | libselinux-ruby1.8, librrd-ruby1.8 Breaks: puppet (<< 2.7.5-3), puppetmaster (<< 0.25.4-1) Description: Centralized configuration management Puppet lets you centrally manage every important aspect of your system @@ -60,7 +60,7 @@ Replaces: puppetmaster (<< 2.6.1~rc2-1) Suggests: apache2 | nginx, mongrel, puppet-el, vim-puppet, stompserver, ruby-stomp | libstomp-ruby1.8 (>= 1.1.5), rails (>= 1.2.3-2), rdoc, - libldap-ruby1.8 + ruby-ldap | libldap-ruby1.8 Description: Puppet master common scripts This package contains common scripts for the puppet master, which is the server hosting manifests and files for the puppet nodes. @@ -134,7 +134,7 @@ Package: puppet-testsuite Architecture: all -Depends: ${misc:Depends}, ruby1.8, puppet-common (= ${source:Version}), facter, lsb-base, rails (>= 1.2.3-2), rdoc, libldap-ruby1.8, mongrel, librspec-ruby, git-core, libmocha-ruby1.8 +Depends: ${misc:Depends}, ruby1.8, puppet-common (= ${source:Version}), facter, lsb-base, rails (>= 1.2.3-2), rdoc, ruby-ldap | libldap-ruby1.8, mongrel, ruby-rspec | librspec-ruby, git-core, ruby-mocha | libmocha-ruby1.8, ruby-sqlite3 Recommends: cron Suggests: ruby Description: Centralized configuration management - test suite diff -Nru puppet-2.7.6/debian/patches/debian-changes puppet-2.7.9/debian/patches/debian-changes --- puppet-2.7.6/debian/patches/debian-changes 2011-12-20 00:22:31.000000000 +0000 +++ puppet-2.7.9/debian/patches/debian-changes 2012-01-02 13:47:37.000000000 +0000 @@ -1,10 +1,34 @@ -Description: Undocumented upstream changes - This patch has been created by dpkg-source during the package build - but it might have accumulated changes from several uploads. Please - check the changelog to (hopefully) learn more on those changes. +Description: + TODO: Put a short summary on the line above and replace this paragraph + with a longer explanation of this change. Complete the meta-information + with other relevant fields (see below for details). To make it easier, the + information below has been extracted from the changelog. Adjust it or drop + it. + . + puppet (2.7.9-1ubuntu1) precise; urgency=low + . + * Merge from Debian testing. Remaining changes: + + Add 2 patches to fix incompatibility with Augeas 0.10.0: + - augeas_saved_files + - augeas_versioncmp + + Change Maintainer according to policy +Author: Chuck Short ---- puppet-2.7.6.orig/Rakefile -+++ puppet-2.7.6/Rakefile +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- puppet-2.7.9.orig/Rakefile ++++ puppet-2.7.9/Rakefile @@ -9,7 +9,7 @@ require 'rspec' require "rspec/core/rake_task" @@ -14,35 +38,16 @@ end Dir['tasks/**/*.rake'].each { |t| load t } ---- puppet-2.7.6.orig/test/lib/puppettest/fakes.rb -+++ puppet-2.7.6/test/lib/puppettest/fakes.rb +--- puppet-2.7.9.orig/test/lib/puppettest/fakes.rb ++++ puppet-2.7.9/test/lib/puppettest/fakes.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/puppet/util')) +require '/usr/lib/ruby/1.8/puppet/util' module PuppetTest # A baseclass for the faketypes. ---- puppet-2.7.6.orig/lib/puppet/provider/service/init.rb -+++ puppet-2.7.6/lib/puppet/provider/service/init.rb -@@ -134,7 +134,15 @@ Puppet::Type.type(:service).provide :ini - # we just return that; otherwise, we return false, which causes it to - # fallback to other mechanisms. - def statuscmd -- (@resource[:hasstatus] == :true) && [initscript, :status] -+ if @resource[:hasstatus] == :true then -+ # Workaround the fact that initctl status command doesn't return -+ # proper exit codes. Can be removed once LP: #552786 is fixed. -+ if File.symlink?(initscript) && File.readlink(initscript) == "/lib/init/upstart-job" then -+ ['sh', '-c', "LANG=C invoke-rc.d #{File::basename(initscript)} status | grep -q '^#{File::basename(initscript)}.*running'" ] -+ else -+ [initscript, :status ] -+ end -+ end - end - - end ---- puppet-2.7.6.orig/ext/rack/files/apache2.conf -+++ puppet-2.7.6/ext/rack/files/apache2.conf +--- puppet-2.7.9.orig/ext/rack/files/apache2.conf ++++ puppet-2.7.9/ext/rack/files/apache2.conf @@ -1,12 +1,4 @@ - -# you probably want to tune these settings @@ -97,3 +102,22 @@ Options None AllowOverride None Order allow,deny +--- puppet-2.7.9.orig/lib/puppet/provider/service/init.rb ++++ puppet-2.7.9/lib/puppet/provider/service/init.rb +@@ -129,7 +129,15 @@ Puppet::Type.type(:service).provide :ini + # we just return that; otherwise, we return false, which causes it to + # fallback to other mechanisms. + def statuscmd +- (@resource[:hasstatus] == :true) && [initscript, :status] ++ if @resource[:hasstatus] == :true then ++ # Workaround the fact that initctl status command doesn't return ++ # proper exit codes. Can be removed once LP: #552786 is fixed. ++ if File.symlink?(initscript) && File.readlink(initscript) == "/lib/init/upstart-job" then ++ ['sh', '-c', "LANG=C invoke-rc.d #{File::basename(initscript)} status | grep -q '^#{File::basename(initscript)}.*running'" ] ++ else ++ [initscript, :status ] ++ end ++ end + end + + end diff -Nru puppet-2.7.6/debian/watch puppet-2.7.9/debian/watch --- puppet-2.7.6/debian/watch 2011-10-22 14:08:29.000000000 +0000 +++ puppet-2.7.9/debian/watch 2011-12-21 07:00:17.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -http://pkg-ruby-extras.alioth.debian.org/cgi-bin/gemwatch/puppet .*/puppet-(.*).tar.gz +http://downloads.puppetlabs.com/puppet/ puppet-([0-9\.]+).tar.gz diff -Nru puppet-2.7.6/ext/upload_facts.rb puppet-2.7.9/ext/upload_facts.rb --- puppet-2.7.6/ext/upload_facts.rb 1970-01-01 00:00:00.000000000 +0000 +++ puppet-2.7.9/ext/upload_facts.rb 2011-12-08 22:58:08.000000000 +0000 @@ -0,0 +1,120 @@ +#!/usr/bin/env ruby + +require 'net/https' +require 'openssl' +require 'openssl/x509' +require 'optparse' +require 'pathname' +require 'yaml' + +require 'puppet' +require 'puppet/network/http_pool' + +class Puppet::Application::UploadFacts < Puppet::Application + should_parse_config + run_mode :master + + option('--debug', '-d') + option('--verbose', '-v') + + option('--logdest DEST', '-l DEST') do |arg| + Puppet::Util::Log.newdestination(arg) + options[:setdest] = true + end + + option('--minutes MINUTES', '-m MINUTES') do |minutes| + options[:time_limit] = 60 * minutes.to_i + end + + def help + print <] + [-l|--logdest syslog||console] + += Description + +This command will read YAML facts from the puppet master's YAML directory, and +save them to the configured facts_terminus. It is intended to be used with the +facts_terminus set to inventory_service, in order to ensure facts which have +been cached locally due to a temporary failure are still uploaded to the +inventory service. + += Usage Notes + +upload_facts is intended to be run from cron, with the facts_terminus set to +inventory_service. The +--minutes+ argument should be set to the length of time +between upload_facts runs. This will ensure that only new YAML files are +uploaded. + += Options + +Note that any configuration parameter that's valid in the configuration file +is also a valid long argument. For example, 'server' is a valid configuration +parameter, so you can specify '--server ' as an argument. + +See the configuration file documentation at +http://docs.puppetlabs.com/references/stable/configuration.html for +the full list of acceptable parameters. A commented list of all +configuration options can also be generated by running puppet agent with +'--genconfig'. + +minutes:: + Limit the upload only to YAML files which have been added within the last n + minutes. +HELP + + exit + end + + def setup + # Handle the logging settings. + if options[:debug] or options[:verbose] + if options[:debug] + Puppet::Util::Log.level = :debug + else + Puppet::Util::Log.level = :info + end + + Puppet::Util::Log.newdestination(:console) unless options[:setdest] + end + + exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? + end + + def main + dir = Pathname.new(Puppet[:yamldir]) + 'facts' + + cutoff = options[:time_limit] ? Time.now - options[:time_limit] : Time.at(0) + + files = dir.children.select do |file| + file.extname == '.yaml' && file.mtime > cutoff + end + + failed = false + + terminus = Puppet::Node::Facts.indirection.terminus + + files.each do |file| + facts = YAML.load_file(file) + + request = Puppet::Indirector::Request.new(:facts, :save, facts) + + # The terminus warns for us if we fail. + if terminus.save(request) + Puppet.info "Uploaded facts for #{facts.name} to inventory service" + else + failed = true + end + end + + exit !failed + end +end + +Puppet::Application::UploadFacts.new.run diff -Nru puppet-2.7.6/install.rb puppet-2.7.9/install.rb --- puppet-2.7.6/install.rb 2011-10-22 07:15:53.000000000 +0000 +++ puppet-2.7.9/install.rb 2011-12-08 22:58:08.000000000 +0000 @@ -423,11 +423,17 @@ if not installed_wrapper tmp_file2 = File.join(tmp_dir, '_tmp_wrapper') cwn = File.join(Config::CONFIG['bindir'], op_file) - regex_safe_ruby = Regexp.escape(ruby.gsub(%r{/}) { "\\" }) - regex_safe_cwn = Regexp.escape(cwn.gsub(%r{/}) { "\\" }) - - cwv = CMD_WRAPPER.gsub('', regex_safe_ruby).gsub('', regex_safe_cwn) - File.open(tmp_file2, "wb") { |cw| cw.puts cwv } + cwv = <<-EOS +@echo off +if "%OS%"=="Windows_NT" goto WinNT +#{ruby} -x "#{cwn}" %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto done +:WinNT +#{ruby} -x "#{cwn}" %* +goto done +:done +EOS + File.open(tmp_file2, "w") { |cw| cw.puts cwv } FileUtils.install(tmp_file2, File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true) File.unlink(tmp_file2) @@ -438,17 +444,6 @@ File.unlink(tmp_file) end -CMD_WRAPPER = <<-EOS -@echo off -if "%OS%"=="Windows_NT" goto WinNT - -x "" %1 %2 %3 %4 %5 %6 %7 %8 %9 -goto done -:WinNT - -x "" %* -goto done -:done -EOS - check_prereqs prepare_installation diff -Nru puppet-2.7.6/lib/puppet/application/agent.rb puppet-2.7.9/lib/puppet/application/agent.rb --- puppet-2.7.6/lib/puppet/application/agent.rb 2011-10-22 07:15:53.000000000 +0000 +++ puppet-2.7.9/lib/puppet/application/agent.rb 2011-12-10 03:07:18.000000000 +0000 @@ -423,9 +423,6 @@ exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? - # If noop is set, then also enable diffs - Puppet[:show_diff] = true if Puppet[:noop] - args[:Server] = Puppet[:server] if options[:fqdn] args[:FQDN] = options[:fqdn] diff -Nru puppet-2.7.6/lib/puppet/application/apply.rb puppet-2.7.9/lib/puppet/application/apply.rb --- puppet-2.7.6/lib/puppet/application/apply.rb 2011-10-22 07:15:53.000000000 +0000 +++ puppet-2.7.9/lib/puppet/application/apply.rb 2011-12-10 03:07:18.000000000 +0000 @@ -231,9 +231,6 @@ def setup exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? - # If noop is set, then also enable diffs - Puppet[:show_diff] = true if Puppet[:noop] - Puppet::Util::Log.newdestination(:console) unless options[:logset] client = nil server = nil diff -Nru puppet-2.7.6/lib/puppet/application/queue.rb puppet-2.7.9/lib/puppet/application/queue.rb --- puppet-2.7.6/lib/puppet/application/queue.rb 2011-10-22 07:15:53.000000000 +0000 +++ puppet-2.7.9/lib/puppet/application/queue.rb 2011-12-08 22:58:08.000000000 +0000 @@ -10,7 +10,6 @@ require 'puppet/daemon' @daemon = Puppet::Daemon.new @daemon.argv = ARGV.dup - Puppet::Util::Log.newdestination(:console) # Do an initial trap, so that cancels don't get a stack trace. @@ -109,6 +108,26 @@ HELP end + option("--logdest DEST", "-l DEST") do |arg| + begin + Puppet::Util::Log.newdestination(arg) + options[:setdest] = true + rescue => detail + puts detail.backtrace if Puppet[:debug] + $stderr.puts detail.to_s + end + end + + option("--logdest DEST", "-l DEST") do |arg| + begin + Puppet::Util::Log.newdestination(arg) + options[:setdest] = true + rescue => detail + puts detail.backtrace if Puppet[:debug] + $stderr.puts detail.to_s + end + end + def main require 'puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe Puppet.notice "Starting puppetqd #{Puppet.version}" @@ -139,6 +158,7 @@ Puppet::Util::Log.level = :info end end + Puppet::Util::Log.newdestination(:syslog) unless options[:setdest] end def setup diff -Nru puppet-2.7.6/lib/puppet/defaults.rb puppet-2.7.9/lib/puppet/defaults.rb --- puppet-2.7.6/lib/puppet/defaults.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/defaults.rb 2011-12-10 03:07:18.000000000 +0000 @@ -109,8 +109,9 @@ }, :diff_args => ["-u", "Which arguments to pass to the diff command when printing differences between files."], :diff => ["diff", "Which diff command to use when printing differences between files."], - :show_diff => [false, "Whether to print a contextual diff when files are being replaced. The diff - is printed on stdout, so this option is meaningless unless you are running Puppet interactively. + :show_diff => [false, "Whether to log and report a contextual diff when files are being replaced. This causes + partial file contents to pass through Puppet's normal logging and reporting system, so this setting should be + used with caution if you are sending Puppet's reports to an insecure destination. This feature currently requires the `diff/lcs` Ruby library."], :daemonize => { :default => (Puppet.features.microsoft_windows? ? false : true), @@ -135,7 +136,8 @@ :desc => "The node facts terminus.", :hook => proc do |value| require 'puppet/node/facts' - if value.to_s == "rest" + # Cache to YAML if we're uploading facts away + if %w[rest inventory_service].include? value.to_s Puppet::Node::Facts.indirection.cache_class = :yaml end end @@ -617,7 +619,7 @@ it with the `--no-client` option."], :listen => [false, "Whether puppet agent should listen for connections. If this is true, then puppet agent will accept incoming - REST API requests, subject to the default ACLs and the ACLs set in + REST API requests, subject to the default ACLs and the ACLs set in the `rest_authconfig` file. Puppet agent can respond usefully to requests on the `run`, `facts`, `certificate`, and `resource` endpoints."], :ca_server => ["$server", "The server to use for certificate diff -Nru puppet-2.7.6/lib/puppet/face/file/store.rb puppet-2.7.9/lib/puppet/face/file/store.rb --- puppet-2.7.6/lib/puppet/face/file/store.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/face/file/store.rb 2011-12-08 22:58:09.000000000 +0000 @@ -11,7 +11,7 @@ EOT when_invoked do |path, options| - file = Puppet::FileBucket::File.new(File.read(path)) + file = Puppet::FileBucket::File.new(Puppet::Util.binread(path)) Puppet::FileBucket::File.indirection.terminus_class = :file Puppet::FileBucket::File.indirection.save file diff -Nru puppet-2.7.6/lib/puppet/feature/base.rb puppet-2.7.9/lib/puppet/feature/base.rb --- puppet-2.7.6/lib/puppet/feature/base.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/feature/base.rb 2011-12-08 22:58:09.000000000 +0000 @@ -22,9 +22,10 @@ require 'win32/service' require 'win32ole' require 'win32/api' + require 'win32/taskscheduler' true rescue LoadError => err - warn "Cannot run on Microsoft Windows without the sys-admin, win32-process, win32-dir & win32-service gems: #{err}" unless Puppet.features.posix? + warn "Cannot run on Microsoft Windows without the sys-admin, win32-process, win32-dir, win32-service and win32-taskscheduler gems: #{err}" unless Puppet.features.posix? end end diff -Nru puppet-2.7.6/lib/puppet/file_bucket/dipper.rb puppet-2.7.9/lib/puppet/file_bucket/dipper.rb --- puppet-2.7.6/lib/puppet/file_bucket/dipper.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/file_bucket/dipper.rb 2011-12-08 22:58:09.000000000 +0000 @@ -31,7 +31,7 @@ # Back up a file to our bucket def backup(file) raise(ArgumentError, "File #{file} does not exist") unless ::File.exist?(file) - contents = ::File.read(file) + contents = Puppet::Util.binread(file) begin file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path) files_original_path = absolutize_path(file) @@ -64,7 +64,7 @@ def restore(file,sum) restore = true if FileTest.exists?(file) - cursum = Digest::MD5.hexdigest(::File.read(file)) + cursum = Digest::MD5.hexdigest(Puppet::Util.binread(file)) # if the checksum has changed... # this might be extra effort @@ -83,6 +83,7 @@ ::File.chmod(changed | 0200, file) end ::File.open(file, ::File::WRONLY|::File::TRUNC|::File::CREAT) { |of| + of.binmode of.print(newcontents) } ::File.chmod(changed, file) if changed diff -Nru puppet-2.7.6/lib/puppet/file_serving/content.rb puppet-2.7.9/lib/puppet/file_serving/content.rb --- puppet-2.7.6/lib/puppet/file_serving/content.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/file_serving/content.rb 2011-12-08 22:58:09.000000000 +0000 @@ -41,6 +41,6 @@ end def to_raw - File.new(full_path, "r") + File.new(full_path, "rb") end end diff -Nru puppet-2.7.6/lib/puppet/file_serving/metadata.rb puppet-2.7.9/lib/puppet/file_serving/metadata.rb --- puppet-2.7.6/lib/puppet/file_serving/metadata.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/file_serving/metadata.rb 2011-12-08 22:58:09.000000000 +0000 @@ -59,9 +59,12 @@ @path = path end - [:owner, :group, :mode].each do |method| + { :owner => 'S-1-5-32-544', + :group => 'S-1-0-0', + :mode => 0644 + }.each do |method, default_value| define_method method do - Puppet::Util::Windows::Security.send("get_#{method}", @path) + Puppet::Util::Windows::Security.send("get_#{method}", @path) || default_value end end end diff -Nru puppet-2.7.6/lib/puppet/indirector/facts/inventory_service.rb puppet-2.7.9/lib/puppet/indirector/facts/inventory_service.rb --- puppet-2.7.6/lib/puppet/indirector/facts/inventory_service.rb 1970-01-01 00:00:00.000000000 +0000 +++ puppet-2.7.9/lib/puppet/indirector/facts/inventory_service.rb 2011-12-08 22:58:09.000000000 +0000 @@ -0,0 +1,20 @@ +require 'puppet/node/facts' +require 'puppet/indirector/rest' + +class Puppet::Node::Facts::InventoryService < Puppet::Indirector::REST + desc "Find and save facts about nodes using a remote inventory service." + use_server_setting(:inventory_server) + use_port_setting(:inventory_port) + + # We don't want failing to upload to the inventory service to cause any + # failures, so we just suppress them and warn. + def save(request) + begin + super + true + rescue => e + Puppet.warning "Could not upload facts for #{request.key} to inventory service: #{e.to_s}" + false + end + end +end diff -Nru puppet-2.7.6/lib/puppet/indirector/file_bucket_file/file.rb puppet-2.7.9/lib/puppet/indirector/file_bucket_file/file.rb --- puppet-2.7.6/lib/puppet/indirector/file_bucket_file/file.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/indirector/file_bucket_file/file.rb 2011-12-08 22:58:09.000000000 +0000 @@ -27,7 +27,7 @@ raise "could not find diff_with #{request.options[:diff_with]}" unless ::File.exists?(file2_path) return `diff #{file_path.inspect} #{file2_path.inspect}` else - contents = ::File.read file_path + contents = Puppet::Util.binread(file_path) Puppet.info "FileBucket read #{checksum}" model.new(contents) end @@ -83,6 +83,7 @@ # Write the file to disk. Puppet::Util.withumask(0007) do ::File.open(filename, ::File::WRONLY|::File::CREAT, 0440) do |of| + of.binmode of.print bucket_file.contents end ::File.open(paths_path, ::File::WRONLY|::File::CREAT, 0640) do |of| @@ -121,7 +122,7 @@ # If conflict_check is enabled, verify that the passed text is # the same as the text in our file. def verify_identical_file!(bucket_file) - disk_contents = ::File.read(path_for(bucket_file.bucket_path, bucket_file.checksum_data, 'contents')) + disk_contents = Puppet::Util.binread(path_for(bucket_file.bucket_path, bucket_file.checksum_data, 'contents')) # If the contents don't match, then we've found a conflict. # Unlikely, but quite bad. diff -Nru puppet-2.7.6/lib/puppet/indirector/report/processor.rb puppet-2.7.9/lib/puppet/indirector/report/processor.rb --- puppet-2.7.6/lib/puppet/indirector/report/processor.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/indirector/report/processor.rb 2011-12-08 22:58:09.000000000 +0000 @@ -26,7 +26,7 @@ # LAK:NOTE This isn't necessarily the best design, but it's backward # compatible and that's good enough for now. def process(report) - Puppet.debug "Recieved report to process from #{report.host}" + Puppet.debug "Received report to process from #{report.host}" processors do |mod| Puppet.debug "Processing report from #{report.host} with processor #{mod}" # We have to use a dup because we're including a module in the diff -Nru puppet-2.7.6/lib/puppet/network/handler/filebucket.rb puppet-2.7.9/lib/puppet/network/handler/filebucket.rb --- puppet-2.7.6/lib/puppet/network/handler/filebucket.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/handler/filebucket.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,6 +1,8 @@ require 'fileutils' require 'digest/md5' require 'puppet/external/base64' +require 'puppet/network/handler' +require 'xmlrpc/server' class Puppet::Network::Handler # :nodoc: # Accept files and store them by md5 sum, returning the md5 sum back diff -Nru puppet-2.7.6/lib/puppet/network/handler/fileserver.rb puppet-2.7.9/lib/puppet/network/handler/fileserver.rb --- puppet-2.7.6/lib/puppet/network/handler/fileserver.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/handler/fileserver.rb 2011-12-08 22:58:09.000000000 +0000 @@ -4,7 +4,7 @@ require 'cgi' require 'delegate' require 'sync' -require 'xmlrpc/server' +require 'puppet/network/handler' require 'puppet/network/handler' require 'puppet/network/xmlrpc/server' diff -Nru puppet-2.7.6/lib/puppet/network/handler/master.rb puppet-2.7.9/lib/puppet/network/handler/master.rb --- puppet-2.7.6/lib/puppet/network/handler/master.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/handler/master.rb 2011-12-08 22:58:09.000000000 +0000 @@ -2,6 +2,7 @@ require 'puppet' require 'xmlrpc/server' require 'yaml' +require 'puppet/network/handler' class Puppet::Network::Handler class MasterError < Puppet::Error; end diff -Nru puppet-2.7.6/lib/puppet/network/handler/report.rb puppet-2.7.9/lib/puppet/network/handler/report.rb --- puppet-2.7.6/lib/puppet/network/handler/report.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/handler/report.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,5 +1,7 @@ require 'puppet/util/instance_loader' require 'puppet/reports' +require 'puppet/network/handler' +require 'xmlrpc/server' # A simple server for triggering a new run on a Puppet client. class Puppet::Network::Handler diff -Nru puppet-2.7.6/lib/puppet/network/handler/runner.rb puppet-2.7.9/lib/puppet/network/handler/runner.rb --- puppet-2.7.6/lib/puppet/network/handler/runner.rb 2011-10-22 06:48:51.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/handler/runner.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,5 +1,6 @@ require 'puppet/run' require 'puppet/network/handler' +require 'xmlrpc/server' class Puppet::Network::Handler class MissingMasterError < RuntimeError; end # Cannot find the master client diff -Nru puppet-2.7.6/lib/puppet/network/handler/status.rb puppet-2.7.9/lib/puppet/network/handler/status.rb --- puppet-2.7.6/lib/puppet/network/handler/status.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/handler/status.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,3 +1,5 @@ +require 'puppet/network/handler' +require 'xmlrpc/server' class Puppet::Network::Handler class Status < Handler desc "A simple interface for testing Puppet connectivity." diff -Nru puppet-2.7.6/lib/puppet/network/http/mongrel/rest.rb puppet-2.7.9/lib/puppet/network/http/mongrel/rest.rb --- puppet-2.7.6/lib/puppet/network/http/mongrel/rest.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/http/mongrel/rest.rb 2011-12-08 22:58:09.000000000 +0000 @@ -28,6 +28,8 @@ # testing purposes. def params(request) params = Mongrel::HttpRequest.query_parse(request.params["QUERY_STRING"]) + params.merge!(Mongrel::HttpRequest.query_parse(body(request))) if http_method(request).upcase == 'POST' + params = decode_params(params) params.merge(client_info(request)) end @@ -41,7 +43,12 @@ # return the request body def body(request) - request.body.read + body = request.body.read + # We rewind the body, since read on a StringIO is destructive, and + # subsequent reads will return an empty string. + request.body.rewind + + body end def set_content_type(response, format) diff -Nru puppet-2.7.6/lib/puppet/network/http_server/mongrel.rb puppet-2.7.9/lib/puppet/network/http_server/mongrel.rb --- puppet-2.7.6/lib/puppet/network/http_server/mongrel.rb 1970-01-01 00:00:00.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/http_server/mongrel.rb 2011-12-08 22:58:09.000000000 +0000 @@ -0,0 +1,129 @@ +#!/usr/bin/env ruby +# File: 06-11-14-mongrel_xmlrpc.rb +# Author: Manuel Holtgrewe +# +# Copyright (c) 2006 Manuel Holtgrewe, 2007 Luke Kanies +# +# This file is based heavily on a file retrieved from +# http://ttt.ggnore.net/2006/11/15/xmlrpc-with-mongrel-and-ruby-off-rails/ + +require 'rubygems' +require 'mongrel' +require 'xmlrpc/server' +require 'puppet/network/xmlrpc/server' +require 'puppet/network/http_server' +require 'puppet/network/client_request' +require 'puppet/network/handler' + +require 'resolv' + +# This handler can be hooked into Mongrel to accept HTTP requests. After +# checking whether the request itself is sane, the handler forwards it +# to an internal instance of XMLRPC::BasicServer to process it. +# +# You can access the server by calling the Handler's "xmlrpc_server" +# attribute accessor method and add XMLRPC handlers there. For example: +# +#
+# handler = XmlRpcHandler.new
+# handler.xmlrpc_server.add_handler("my.add") { |a, b| a.to_i + b.to_i }
+# 
+module Puppet::Network + class HTTPServer::Mongrel < ::Mongrel::HttpHandler + attr_reader :xmlrpc_server + + def initialize(handlers) + if Puppet[:debug] + $mongrel_debug_client = true + Puppet.debug 'Mongrel client debugging enabled. [$mongrel_debug_client = true].' + end + # Create a new instance of BasicServer. We are supposed to subclass it + # but that does not make sense since we would not introduce any new + # behaviour and we have to subclass Mongrel::HttpHandler so our handler + # works for Mongrel. + @xmlrpc_server = Puppet::Network::XMLRPCServer.new + handlers.each do |name| + unless handler = Puppet::Network::Handler.handler(name) + raise ArgumentError, "Invalid handler #{name}" + end + @xmlrpc_server.add_handler(handler.interface, handler.new({})) + end + end + + # This method produces the same results as XMLRPC::CGIServer.serve + # from Ruby's stdlib XMLRPC implementation. + def process(request, response) + # Make sure this has been a POST as required for XMLRPC. + request_method = request.params[Mongrel::Const::REQUEST_METHOD] || Mongrel::Const::GET + if request_method != "POST" + response.start(405) { |head, out| out.write("Method Not Allowed") } + return + end + + # Make sure the user has sent text/xml data. + request_mime = request.params["CONTENT_TYPE"] || "text/plain" + if parse_content_type(request_mime).first != "text/xml" + response.start(400) { |head, out| out.write("Bad Request") } + return + end + + # Make sure there is data in the body at all. + length = request.params[Mongrel::Const::CONTENT_LENGTH].to_i + if length <= 0 + response.start(411) { |head, out| out.write("Length Required") } + return + end + + # Check the body to be valid. + if request.body.nil? or request.body.size != length + response.start(400) { |head, out| out.write("Bad Request") } + return + end + + info = client_info(request) + + # All checks above passed through + response.start(200) do |head, out| + head["Content-Type"] = "text/xml; charset=utf-8" + begin + out.write(@xmlrpc_server.process(request.body, info)) + rescue => detail + puts detail.backtrace + raise + end + end + end + + private + + def client_info(request) + params = request.params + ip = params["HTTP_X_FORWARDED_FOR"] ? params["HTTP_X_FORWARDED_FOR"].split(',').last.strip : params["REMOTE_ADDR"] + # JJM #906 The following dn.match regular expression is forgiving + # enough to match the two Distinguished Name string contents + # coming from Apache, Pound or other reverse SSL proxies. + if dn = params[Puppet[:ssl_client_header]] and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/) + client = dn_matchdata[1].to_str + valid = (params[Puppet[:ssl_client_verify_header]] == 'SUCCESS') + else + begin + client = Resolv.getname(ip) + rescue => detail + Puppet.err "Could not resolve #{ip}: #{detail}" + client = "unknown" + end + valid = false + end + + info = Puppet::Network::ClientRequest.new(client, ip, valid) + + info + end + + # Taken from XMLRPC::ParseContentType + def parse_content_type(str) + a, *b = str.split(";") + return a.strip, *b + end + end +end diff -Nru puppet-2.7.6/lib/puppet/network/http_server.rb puppet-2.7.9/lib/puppet/network/http_server.rb --- puppet-2.7.6/lib/puppet/network/http_server.rb 1970-01-01 00:00:00.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/http_server.rb 2011-12-06 21:33:14.000000000 +0000 @@ -0,0 +1,3 @@ +# Just a stub, so we can correctly scope other classes. +module Puppet::Network::HTTPServer # :nodoc: +end diff -Nru puppet-2.7.6/lib/puppet/network/rest_authconfig.rb puppet-2.7.9/lib/puppet/network/rest_authconfig.rb --- puppet-2.7.6/lib/puppet/network/rest_authconfig.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/network/rest_authconfig.rb 2011-12-08 22:58:09.000000000 +0000 @@ -14,9 +14,11 @@ { :acl => "/file" }, { :acl => "/certificate_revocation_list/ca", :method => :find, :authenticated => true }, { :acl => "/report", :method => :save, :authenticated => true }, - { :acl => "/certificate/ca", :method => :find, :authenticated => false }, - { :acl => "/certificate/", :method => :find, :authenticated => false }, - { :acl => "/certificate_request", :method => [:find, :save], :authenticated => false }, + # These allow `auth any`, because if you can do them anonymously you + # should probably also be able to do them when trusted. + { :acl => "/certificate/ca", :method => :find, :authenticated => :any }, + { :acl => "/certificate/", :method => :find, :authenticated => :any }, + { :acl => "/certificate_request", :method => [:find, :save], :authenticated => :any }, { :acl => "/status", :method => [:find], :authenticated => true }, ] @@ -65,9 +67,15 @@ # force regular ACLs to be present def insert_default_acl + if exists? then + reason = "none were found in '#{@file}'" + else + reason = "#{Puppet[:rest_authconfig]} doesn't exist" + end + DEFAULT_ACL.each do |acl| unless rights[acl[:acl]] - Puppet.info "Inserting default '#{acl[:acl]}'(#{acl[:authenticated] ? "auth" : "non-auth"}) ACL because #{( !exists? ? "#{Puppet[:rest_authconfig]} doesn't exist" : "none were found in '#{@file}'")}" + Puppet.info "Inserting default '#{acl[:acl]}' (auth #{acl[:authenticated]}) ACL because #{reason}" mk_acl(acl) end end diff -Nru puppet-2.7.6/lib/puppet/parameter.rb puppet-2.7.9/lib/puppet/parameter.rb --- puppet-2.7.6/lib/puppet/parameter.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/parameter.rb 2011-12-08 22:58:09.000000000 +0000 @@ -293,6 +293,24 @@ def to_s name.to_s end + + def self.format_value_for_display(value) + if value.is_a? Array + formatted_values = value.collect {|value| format_value_for_display(value)}.join(', ') + "[#{formatted_values}]" + elsif value.is_a? Hash + # Sorting the hash keys for display is largely for having stable + # output to test against, but also helps when scanning for hash + # keys, since they will be in ASCIIbetical order. + hash = value.keys.sort {|a,b| a.to_s <=> b.to_s}.collect do |k| + "'#{k}' => #{format_value_for_display(value[k])}" + end.join(', ') + + "{#{hash}}" + else + "'#{value}'" + end + end end require 'puppet/parameter/path' diff -Nru puppet-2.7.6/lib/puppet/parser/compiler.rb puppet-2.7.9/lib/puppet/parser/compiler.rb --- puppet-2.7.6/lib/puppet/parser/compiler.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/parser/compiler.rb 2011-12-08 23:17:37.000000000 +0000 @@ -307,7 +307,7 @@ def fail_on_unevaluated_overrides remaining = [] @resource_overrides.each do |name, overrides| - remaining += overrides + remaining.concat overrides end unless remaining.empty? diff -Nru puppet-2.7.6/lib/puppet/parser/grammar.ra puppet-2.7.9/lib/puppet/parser/grammar.ra --- puppet-2.7.6/lib/puppet/parser/grammar.ra 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/parser/grammar.ra 2011-12-08 22:58:09.000000000 +0000 @@ -648,7 +648,7 @@ | LPAREN nothing RPAREN { result = nil } - | LPAREN arguments RPAREN { + | LPAREN arguments endcomma RPAREN { result = val[1] result = [result] unless result[0].is_a?(Array) } diff -Nru puppet-2.7.6/lib/puppet/parser/parser.rb puppet-2.7.9/lib/puppet/parser/parser.rb --- puppet-2.7.6/lib/puppet/parser/parser.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/parser/parser.rb 2011-12-08 22:58:09.000000000 +0000 @@ -34,88 +34,89 @@ ##### State transition tables begin ### clist = [ -'222,221,209,61,62,249,204,209,127,323,192,317,322,184,179,109,214,251', -'301,330,126,106,180,182,181,183,126,329,184,179,302,206,245,244,335', -'245,244,180,182,181,183,195,126,210,106,186,185,334,85,173,174,176,175', -'177,178,275,171,172,276,105,186,185,107,170,173,174,176,175,177,178', -'308,171,172,61,62,157,81,94,170,95,80,71,105,61,62,107,162,94,77,95', -'73,161,309,61,62,93,157,94,81,95,-106,-157,114,76,71,93,70,162,288,34', -'63,59,161,287,68,93,70,311,60,92,63,59,58,151,68,91,70,75,60,92,63,59', -'58,71,68,91,157,151,60,92,61,62,58,71,94,91,95,162,314,288,61,62,161', -'71,287,-106,-106,-106,-106,248,61,62,93,157,94,81,95,247,81,80,106,208', -'80,70,162,341,34,63,59,161,81,68,93,70,80,60,92,63,225,58,151,68,91', -'70,132,138,77,63,59,58,71,68,-170,61,62,60,92,64,105,58,71,107,91,61', -'62,61,62,94,323,95,71,322,324,61,62,44,152,94,242,95,71,245,244,61,62', -'93,70,94,81,95,63,59,114,320,68,93,70,299,60,34,63,59,58,195,68,93,70', -'73,60,92,63,59,58,71,68,91,70,198,60,92,63,59,58,71,68,91,61,62,60,92', -'214,212,58,71,117,91,61,62,295,85,94,201,95,71,211,201,61,62,83,84,94', -'292,95,291,171,172,61,62,93,70,94,170,95,63,225,171,172,68,93,70,-156', -'138,170,63,59,58,-154,68,93,70,125,60,92,63,59,58,71,68,91,70,-153,60', -'92,63,59,58,71,68,91,214,346,60,92,61,62,58,71,94,91,95,-155,-151,-150', -'61,62,-152,71,94,124,95,283,117,333,61,62,93,274,94,97,95,214,224,336', -'61,62,93,70,94,250,337,63,59,214,251,68,93,70,338,60,92,63,59,58,127', -'68,91,70,277,60,92,63,59,58,71,68,91,70,208,60,92,63,59,58,71,68,91', -'305,236,60,238,61,62,58,71,94,239,95,238,349,-152,61,62,97,71,94,-150', -'95,86,352,-151,61,62,93,223,94,303,95,214,224,214,251,353,93,70,82,355', -'-153,63,59,125,72,68,93,70,43,60,92,63,59,58,361,68,91,70,362,60,92', -'63,59,58,71,68,91,238,-204,60,92,61,62,58,71,94,91,95,38,39,40,41,209', -'117,71,176,175,71,61,62,171,172,94,93,95,71,35,170,38,39,40,41,369,370', -'70,,61,62,63,59,93,122,68,327,,,60,92,,,58,70,,91,,63,59,,,68,,71,,60', -'92,61,62,58,,70,91,228,,63,225,,,68,71,,,138,61,62,,58,94,,95,176,175', -',,,171,172,71,,70,,,170,63,225,93,,68,61,62,,138,94,,95,58,70,,,,63', -'59,,,68,,71,,60,92,93,,58,61,62,91,,94,,95,,70,,71,,63,59,,,68,,,,60', -'92,93,218,58,61,62,91,,94,,95,,70,,71,,63,59,,,68,,,,60,92,93,,58,61', -'62,91,,94,,95,,70,,71,,63,59,,,68,,,,60,92,93,,58,61,62,91,,94,,,,70', -',71,,63,59,,,68,,,,60,92,,,58,61,62,91,,94,,95,,70,,71,,63,59,,,68,61', -'62,,60,,93,,58,,61,62,,,94,,95,70,,71,,63,59,,,68,,,,60,92,,93,58,70', -',91,,63,225,,,68,70,71,,138,63,59,,58,68,,61,62,60,92,94,,58,,71,91', -'61,62,,,94,,95,71,,,61,62,,,94,131,95,,,,61,62,93,70,94,,95,63,225,', -',68,93,70,,138,,63,59,58,,68,93,70,,60,92,63,59,58,71,68,91,70,,60,92', -'63,59,58,71,68,91,61,62,60,92,,,58,71,,91,61,62,,,94,,,71,,,61,62,,', -'94,,95,,,,61,62,,70,94,,95,63,225,,,68,93,70,,138,,63,137,58,,68,93', -'70,,138,,63,59,58,71,68,,70,,60,92,63,59,58,71,68,91,252,,60,92,,,58', -'71,,91,184,179,-24,-24,-24,-24,,71,,180,182,181,183,,,173,174,176,175', -',61,62,171,172,94,131,95,,,170,,,186,185,,,173,174,176,175,177,178,93', -'171,172,61,62,,,94,170,95,,70,,,,63,59,,,68,,,,60,92,93,,58,61,62,91', -',94,,95,,70,,71,,63,59,,,68,,,,60,92,93,,58,61,62,91,,94,,95,,70,,71', -',63,59,,,68,,,,60,92,93,,58,61,62,91,,94,,95,,70,,71,,63,59,,,68,,,', -'60,92,93,,58,61,62,91,,94,,95,,70,,71,,63,59,,,68,,,,60,92,93,,58,61', -'62,91,,94,,95,,70,,71,,63,59,,,68,,,,60,92,93,,58,61,62,91,,94,,95,', -'70,,71,,63,59,,,68,,,,60,92,93,,58,61,62,91,,94,,95,,70,,71,,63,59,', -',68,,,,60,92,93,,58,61,62,91,,94,,95,,70,,71,,63,59,,,68,,,,60,92,93', -',58,61,62,91,,94,,95,,70,,71,,63,59,,,68,,,,60,92,93,,58,,,91,-22,-22', -'-22,-22,,70,,71,,63,59,,,68,,,169,60,92,,,58,,,91,184,179,,,,,197,71', -',180,182,181,183,,,184,179,,,,,,,,180,182,181,183,,,,,186,185,,,173', -'174,176,175,177,178,,171,172,,,186,185,,170,173,174,176,175,177,178', -',171,172,184,179,,,,170,,,,180,182,181,183,,,184,179,,,,,,,,180,182', -'181,183,,,,,186,185,,,173,174,176,175,177,178,,171,172,,,186,185,,170', -'173,174,176,175,177,178,,171,172,184,179,,,,170,,,,180,182,181,183,', -',184,179,,,,,,,,180,182,181,183,,,,,186,185,,,173,174,176,175,177,178', -',171,172,,,186,185,,170,173,174,176,175,177,178,,171,172,184,179,,,', -'170,,,273,180,182,181,183,,,184,179,,,,,,,,180,182,181,183,,,,,186,185', -',,173,174,176,175,177,178,,171,172,,,186,185,,170,173,174,176,175,177', -'178,,171,172,184,179,,,,170,,,,180,182,181,183,,,184,179,,,,,,,,180', -'182,181,183,,,,,186,185,,,173,174,176,175,177,178,,171,172,,,186,185', -',170,173,174,176,175,177,178,,171,172,184,179,,,,170,,,,180,182,181', -'183,,,184,179,,,,,,,,180,182,181,183,,,,,186,185,,,173,174,176,175,177', -'178,,171,172,,,,,,170,173,174,176,175,177,178,,171,172,184,179,,,,170', -',,,180,182,181,183,,,184,179,,,,,,,,180,182,181,183,,,,,,,,,173,174', -'176,175,177,178,,171,172,,,186,185,,170,173,174,176,175,177,178,,171', -'172,184,179,,,,170,,,,180,182,181,183,,,184,179,,,,,,,,180,182,181,183', -',,,,,,,,173,174,176,175,177,178,,171,172,,,,185,,170,173,174,176,175', -'177,178,,171,172,184,179,,,,170,,,,180,182,181,183,,,,179,,,,,,,,180', -',,,,,,,186,185,179,,173,174,176,175,177,178,180,171,172,,,,,179,170', -'173,174,176,175,177,178,180,171,172,,,,,,170,,179,,173,174,176,175,177', -'178,180,171,172,,,,,,170,173,174,176,175,177,178,,171,172,,332,,,,170', -',,,173,174,176,175,177,178,,171,172,,360,,,28,170,30,31,,26,32,,33,', -'21,,29,368,25,,,34,28,,30,31,,26,32,,33,,21,367,29,,25,,28,34,30,31', -',26,32,,33,,21,343,29,,25,,28,34,30,31,,26,32,,33,,21,255,29,,25,,28', -'34,30,31,,26,32,,33,,21,365,29,,25,,28,34,30,31,,26,32,,33,,21,,29,', -'25,,28,34,30,31,,26,32,,33,,21,,29,28,25,30,31,34,26,32,,33,,21,,29', -'28,25,30,31,34,26,32,,33,,21,,29,28,25,30,31,34,26,32,,33,,21,,29,,25', -',,34,173,174,176,175,177,178,,171,172,,,,,,170,173,174,176,175,177,178', -',171,172,173,174,176,175,,170,,171,172,,,,,,170' ] - racc_action_table = arr = Array.new(2065, nil) +'255,256,225,47,228,48,221,222,175,73,78,342,207,189,193,145,338,211', +'49,343,331,227,184,186,190,192,174,221,243,73,78,215,216,73,78,336,201', +'98,334,101,147,244,45,232,-154,185,188,197,302,195,196,179,180,182,183', +'95,187,191,73,78,221,356,98,181,101,120,72,197,73,78,86,88,215,216,93', +'219,118,309,79,96,95,124,89,218,60,103,73,78,60,225,98,72,207,63,35', +'86,88,211,36,93,120,72,174,79,96,86,250,89,35,93,103,118,36,154,187', +'191,124,89,63,72,132,181,64,86,88,66,64,93,63,66,52,79,73,78,120,89', +'98,311,101,50,51,142,73,78,63,118,63,171,63,231,124,120,73,78,95,262', +'98,35,101,35,35,114,118,36,114,72,316,124,11,86,88,11,317,93,95,72,170', +'79,96,86,250,89,132,93,103,72,-170,154,322,86,88,89,63,93,323,324,325', +'79,96,73,78,89,63,98,103,101,174,35,167,73,78,36,63,98,288,101,-153', +'287,11,73,78,95,52,98,330,101,47,187,191,73,78,95,72,98,181,-106,86', +'88,-152,-150,93,95,72,-151,79,96,86,88,89,205,93,103,72,299,79,96,86', +'88,89,63,93,103,72,298,79,96,86,88,89,63,93,103,73,78,79,296,85,-157', +'89,63,214,73,78,215,216,98,-155,101,144,63,-106,-106,-106,-106,76,48', +'60,336,73,78,334,109,98,95,101,72,142,223,295,86,88,221,222,93,72,105', +'333,79,86,88,95,89,93,289,266,212,79,96,221,260,89,72,63,103,64,86,88', +'66,175,93,63,63,132,79,96,73,78,89,261,98,103,101,221,260,128,142,63', +'63,63,179,180,345,73,78,187,191,98,95,101,-156,225,181,348,195,196,179', +'180,109,72,227,187,191,86,88,95,349,93,181,332,231,79,96,221,222,89', +'72,105,103,233,86,88,67,352,93,227,63,237,79,96,73,78,89,239,98,103', +'101,-153,229,195,196,179,180,63,57,360,187,191,189,193,179,180,95,181', +'170,187,191,184,186,190,192,-152,181,72,362,53,240,86,88,44,364,93,-204', +'-150,38,79,96,-151,370,89,185,188,103,371,195,196,179,180,182,183,63', +'187,191,73,78,,,98,181,101,,,,73,78,,,98,,101,,,,73,78,95,,98,,101,-22', +'-22,-22,-22,,95,72,,,,86,88,,,93,95,72,,79,96,86,88,89,,93,103,72,,79', +'96,86,88,89,63,93,103,,,79,96,73,78,89,63,,103,,341,,,73,78,,63,98,', +'101,,,,73,78,,,98,,101,,,,73,78,95,72,98,,101,86,250,,,93,95,72,,154', +',86,88,89,,93,95,72,,79,96,86,88,89,63,93,103,72,,79,96,86,88,89,63', +'93,103,,,79,96,73,78,89,63,,103,252,,,,73,78,,63,98,,101,,,,73,78,,', +'98,,101,,,,73,78,95,72,98,,101,86,250,,,93,95,72,,154,,86,88,89,,93', +'95,72,,79,96,86,88,89,63,93,103,72,,79,96,86,88,89,63,93,103,,,79,96', +'73,78,89,63,98,103,101,,,,73,78,,63,98,,101,,,,73,78,95,,98,173,101', +'41,42,43,39,,95,72,,,,86,88,,,93,95,72,,79,96,86,88,89,,93,103,72,,79', +'96,86,88,89,63,93,103,,,79,96,73,78,89,63,98,103,101,,,,73,78,,63,98', +'-24,-24,-24,-24,,73,78,95,,98,,101,41,42,43,39,,,72,,,,86,88,,,93,95', +'72,,79,96,86,158,89,,93,103,72,,154,,86,88,89,63,93,,,,79,96,73,78,89', +'63,98,103,101,,,,73,78,,63,98,,101,,,,,,95,,,,,,,,,,95,72,,,,86,88,', +',93,,72,,79,96,86,88,89,,93,103,329,,79,96,,,89,63,,103,189,193,,,,', +',63,,184,186,190,192,,,,,,,,73,78,,,98,,101,,,,,,185,188,,,195,196,179', +'180,182,183,95,187,191,73,78,,,98,181,101,,72,,73,78,86,88,,,93,,,,79', +'96,95,165,89,,,103,73,78,,,98,72,101,63,,86,88,,,93,,72,,79,96,86,250', +'89,95,93,103,73,78,154,,98,,89,63,72,,,,86,88,,,93,63,,,79,96,,,89,73', +'78,103,,98,,101,,72,,63,,86,250,,,93,73,78,,154,98,95,101,89,,,,,,,', +',72,,63,,86,88,95,,93,,,,79,96,,,89,72,,103,,86,88,,,93,,63,,79,96,73', +'78,89,,98,103,101,,,,73,78,,63,98,173,101,,,,73,78,95,,98,,101,,,,73', +'78,95,72,,,,86,88,,,93,95,72,,79,96,86,88,89,,93,103,72,,79,96,86,88', +'89,63,93,103,72,,79,96,86,250,89,63,93,103,,,154,,73,78,89,63,98,,101', +',,,73,78,,63,98,,101,,,,73,78,95,,98,,101,,,,,,95,72,,,,86,88,,,93,95', +'72,,79,96,86,88,89,,93,103,72,,79,96,86,88,89,63,93,103,,,79,96,73,78', +'89,63,98,103,101,,,,73,78,,63,98,,101,,,,73,78,95,,98,,101,,,,,,95,72', +',,,86,88,,,93,95,72,,79,96,86,88,89,,93,103,72,,79,96,86,88,89,63,93', +'103,,194,79,96,,,89,63,,103,189,193,,,,,204,63,,184,186,190,192,,,189', +'193,,,,,,,,184,186,190,192,,,,,185,188,,,195,196,179,180,182,183,,187', +'191,,,185,188,,181,195,196,179,180,182,183,,187,191,189,193,,,,181,', +',,184,186,190,192,,,189,193,,,,,,,,184,186,190,192,,,,,185,188,,,195', +'196,179,180,182,183,,187,191,,,185,188,,181,195,196,179,180,182,183', +',187,191,189,193,,,,181,,,,184,186,190,192,,,189,193,,,,,,,,184,186', +'190,192,,,,,185,188,,,195,196,179,180,182,183,,187,191,,,185,188,,181', +'195,196,179,180,182,183,,187,191,189,193,,,,181,,,,184,186,190,192,', +',189,193,,,,,,,265,184,186,190,192,,,,,185,188,,,195,196,179,180,182', +'183,,187,191,,,185,188,,181,195,196,179,180,182,183,,187,191,189,193', +',,,181,,,,184,186,190,192,,,189,193,,,,,,,,184,186,190,192,,,,,185,188', +',,195,196,179,180,182,183,,187,191,,,,188,,181,195,196,179,180,182,183', +',187,191,189,193,,,,181,,,,184,186,190,192,,,189,193,,,,,,,,184,186', +'190,192,,,,,185,188,,,195,196,179,180,182,183,,187,191,,,,,,181,195', +'196,179,180,182,183,,187,191,189,193,,,,181,,,,184,186,190,192,,,189', +'193,,,,,,,,184,186,190,192,,,,,,,,,195,196,179,180,182,183,,187,191', +',,,,,181,195,196,179,180,182,183,,187,191,189,193,,,,181,,,,184,186', +'190,192,,,189,193,,,,,,,,184,186,190,192,,,,,185,188,,,195,196,179,180', +'182,183,,187,191,,,185,188,,181,195,196,179,180,182,183,,187,191,189', +'193,,,,181,,,,184,186,190,192,,,,193,,,,,,,,184,,,,,,,,185,188,193,', +'195,196,179,180,182,183,184,187,191,,,,,193,181,195,196,179,180,182', +'183,184,187,191,,,,,,181,,193,,195,196,179,180,182,183,184,187,191,', +',,,,181,195,196,179,180,182,183,,187,191,,284,,,,181,,,,195,196,179', +'180,182,183,,187,191,,369,,,26,181,32,1,,8,12,,18,,24,,29,319,2,,,11', +'26,,32,1,,8,12,,18,,24,367,29,,2,,26,11,32,1,,8,12,,18,,24,301,29,,2', +',26,11,32,1,,8,12,,18,,24,363,29,,2,,26,11,32,1,,8,12,,18,,24,351,29', +',2,,26,11,32,1,,8,12,,18,,24,,29,,2,,26,11,32,1,,8,12,,18,,24,,29,26', +'2,32,1,11,8,12,,18,,24,,29,26,2,32,1,11,8,12,,18,,24,,29,26,2,32,1,11', +'8,12,,18,,24,,29,,2,,,11,195,196,179,180,182,183,,187,191,,,,,,181,195', +'196,179,180,182,183,,187,191,,,,,,181' ] + racc_action_table = arr = Array.new(2074, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -125,94 +126,95 @@ end clist = [ -'129,129,117,95,95,163,102,137,59,255,95,246,255,129,129,35,217,217,216', -'280,137,33,129,129,129,129,59,280,216,216,217,102,163,163,285,246,246', -'216,216,216,216,95,225,117,204,129,129,285,70,129,129,129,129,129,129', -'191,129,129,191,33,216,216,33,129,216,216,216,216,216,216,229,216,216', -'170,170,243,31,170,216,170,31,33,204,173,173,204,243,173,23,173,23,243', -'235,174,174,170,157,174,37,174,223,67,37,23,204,173,170,157,201,37,170', -'170,157,201,170,174,173,237,170,170,173,173,170,238,173,170,174,23,173', -'173,174,174,173,170,174,173,75,239,174,174,175,175,174,173,175,174,175', -'75,240,335,345,345,75,174,335,223,223,223,223,158,176,176,175,76,176', -'24,176,158,291,24,206,241,291,175,76,291,24,175,175,76,32,175,176,345', -'32,175,175,345,345,175,73,345,175,176,66,345,65,176,176,345,175,176', -'60,21,21,176,176,21,206,176,345,206,176,337,337,276,276,337,320,337', -'176,320,276,177,177,21,74,177,153,177,206,153,153,336,336,337,21,336', -'42,336,21,21,42,254,21,177,337,212,21,42,337,337,21,276,337,336,177', -'78,337,337,177,177,337,21,177,337,336,99,177,177,336,336,177,337,336', -'177,330,330,336,336,121,121,336,177,208,336,178,178,207,26,178,100,178', -'336,121,101,322,322,26,26,322,203,322,202,261,261,28,28,178,330,28,261', -'28,330,330,262,262,330,322,178,57,330,262,178,178,330,56,178,28,322', -'54,178,178,322,322,178,330,322,178,28,52,322,322,28,28,322,178,28,322', -'306,306,28,28,29,29,28,322,29,28,29,50,49,48,179,179,47,28,179,45,179', -'199,43,284,180,180,29,190,180,198,180,190,190,287,308,308,179,29,308', -'164,288,29,29,164,164,29,180,179,289,29,29,179,179,29,114,179,29,180', -'194,179,179,180,180,179,29,180,179,308,116,180,180,308,308,180,179,308', -'180,224,133,308,134,181,181,308,180,181,135,181,313,315,139,182,182', -'30,308,182,140,182,27,323,141,183,183,181,130,183,219,183,130,130,219', -'219,329,182,181,25,331,143,181,181,145,22,181,183,182,20,181,181,182', -'182,181,342,182,181,183,344,182,182,183,183,182,181,183,182,150,346', -'183,183,184,184,183,182,184,183,184,19,19,19,19,151,152,183,260,260', -'172,44,44,260,260,44,184,44,171,1,260,18,18,18,18,364,366,184,,278,278', -'184,184,44,44,184,278,,,184,184,,,184,44,,184,,44,44,,,44,,184,,44,44', -'132,132,44,,278,44,132,,278,278,,,278,44,,,278,277,277,,278,277,,277', -'259,259,,,,259,259,278,,132,,,259,132,132,277,,132,185,185,,132,185', -',185,132,277,,,,277,277,,,277,,132,,277,277,185,,277,126,126,277,,126', -',126,,185,,277,,185,185,,,185,,,,185,185,126,126,185,127,127,185,,127', -',127,,126,,185,,126,126,,,126,,,,126,126,127,,126,125,125,126,,125,', -'125,,127,,126,,127,127,,,127,,,,127,127,125,,127,124,124,127,,124,,', -',125,,127,,125,125,,,125,,,,125,125,,,125,186,186,125,,186,,186,,124', -',125,,124,124,,,124,197,197,,124,,186,,124,,248,248,,,248,,248,186,', -'124,,186,186,,,186,,,,186,186,,248,186,197,,186,,197,197,,,197,248,186', -',197,248,248,,197,248,,236,236,248,248,236,,248,,197,248,62,62,,,62', -',62,248,,,64,64,,,64,64,64,,,,247,247,62,236,247,,247,236,236,,,236', -'64,62,,236,,62,62,236,,62,247,64,,62,62,64,64,62,236,64,62,247,,64,64', -'247,247,64,62,247,64,228,228,247,247,,,247,64,,247,72,72,,,72,,,247', -',,209,209,,,209,,209,,,,222,222,,228,222,,222,228,228,,,228,209,72,', -'228,,72,72,228,,72,222,209,,72,,209,209,72,228,209,,222,,209,209,222', -'222,209,72,222,209,167,,222,222,,,222,209,,222,167,167,7,7,7,7,,222', -',167,167,167,167,,,263,263,263,263,,94,94,263,263,94,94,94,,,263,,,167', -'167,,,167,167,167,167,167,167,94,167,167,77,77,,,77,167,77,,94,,,,94', -'94,,,94,,,,94,94,77,,94,210,210,94,,210,,210,,77,,94,,77,77,,,77,,,', -'77,77,210,,77,83,83,77,,83,,83,,210,,77,,210,210,,,210,,,,210,210,83', -',210,84,84,210,,84,,84,,83,,210,,83,83,,,83,,,,83,83,84,,83,85,85,83', -',85,,85,,84,,83,,84,84,,,84,,,,84,84,85,,84,86,86,84,,86,,86,,85,,84', -',85,85,,,85,,,,85,85,86,,85,91,91,85,,91,,91,,86,,85,,86,86,,,86,,,', -'86,86,91,,86,92,92,86,,92,,92,,91,,86,,91,91,,,91,,,,91,91,92,,91,93', -'93,91,,93,,93,,92,,91,,92,92,,,92,,,,92,92,93,,92,213,213,92,,213,,213', -',93,,92,,93,93,,,93,,,,93,93,213,,93,,,93,5,5,5,5,,213,,93,,213,213', -',,213,,,88,213,213,,,213,,,213,88,88,,,,,96,213,,88,88,88,88,,,96,96', -',,,,,,,96,96,96,96,,,,,88,88,,,88,88,88,88,88,88,,88,88,,,96,96,,88', -'96,96,96,96,96,96,,96,96,300,300,,,,96,,,,300,300,300,300,,,166,166', -',,,,,,,166,166,166,166,,,,,300,300,,,300,300,300,300,300,300,,300,300', -',,166,166,,300,166,166,166,166,166,166,,166,166,165,165,,,,166,,,,165', -'165,165,165,,,168,168,,,,,,,,168,168,168,168,,,,,165,165,,,165,165,165', -'165,165,165,,165,165,,,168,168,,165,168,168,168,168,168,168,,168,168', -'189,189,,,,168,,,189,189,189,189,189,,,358,358,,,,,,,,358,358,358,358', -',,,,189,189,,,189,189,189,189,189,189,,189,189,,,358,358,,189,358,358', -'358,358,358,358,,358,358,357,357,,,,358,,,,357,357,357,357,,,123,123', -',,,,,,,123,123,123,123,,,,,357,357,,,357,357,357,357,357,357,,357,357', -',,123,123,,357,123,123,123,123,123,123,,123,123,326,326,,,,123,,,,326', -'326,326,326,,,319,319,,,,,,,,319,319,319,319,,,,,326,326,,,326,326,326', -'326,326,326,,326,326,,,,,,326,319,319,319,319,319,319,,319,319,318,318', -',,,319,,,,318,318,318,318,,,298,298,,,,,,,,298,298,298,298,,,,,,,,,318', -'318,318,318,318,318,,318,318,,,298,298,,318,298,298,298,298,298,298', -',298,298,271,271,,,,298,,,,271,271,271,271,,,272,272,,,,,,,,272,272', -'272,272,,,,,,,,,271,271,271,271,271,271,,271,271,,,,272,,271,272,272', -'272,272,272,272,,272,272,297,297,,,,272,,,,297,297,297,297,,,,269,,', -',,,,,269,,,,,,,,297,297,268,,297,297,297,297,297,297,268,297,297,,,', -',267,297,269,269,269,269,269,269,267,269,269,,,,,,269,,270,,268,268', -'268,268,268,268,270,268,268,,,,,,268,267,267,267,267,267,267,,267,267', -',283,,,,267,,,,270,270,270,270,270,270,,270,270,,338,,,283,270,283,283', -',283,283,,283,,283,,283,359,283,,,283,338,,338,338,,338,338,,338,,338', -'353,338,,338,,359,338,359,359,,359,359,,359,,359,292,359,,359,,353,359', -'353,353,,353,353,,353,,353,169,353,,353,,292,353,292,292,,292,292,,292', -',292,352,292,,292,,169,292,169,169,,169,169,,169,,169,,169,,169,,352', -'169,352,352,,352,352,,352,,352,,352,0,352,0,0,352,0,0,,0,,0,,0,253,0', -'253,253,0,253,253,,253,,253,,253,2,253,2,2,253,2,2,,2,,2,,2,,2,,,2,266', -'266,266,266,266,266,,266,266,,,,,,266,265,265,265,265,265,265,,265,265', -'264,264,264,264,,265,,264,264,,,,,,264' ] - racc_action_check = arr = Array.new(2065, nil) +'169,169,142,6,134,6,263,263,88,287,287,292,298,169,169,59,287,298,6', +'292,263,164,169,169,169,169,88,166,166,101,101,134,134,50,50,333,101', +'50,333,50,59,166,6,142,83,169,169,287,213,169,169,169,169,169,169,50', +'169,169,170,170,327,327,170,169,170,217,50,101,357,357,50,50,213,213', +'50,127,217,226,50,50,170,217,50,127,18,50,171,171,147,158,171,170,109', +'50,12,170,170,109,12,170,49,357,158,170,170,357,357,170,1,357,170,49', +'1,357,268,268,49,357,170,171,227,268,18,171,171,18,147,171,357,147,8', +'171,174,174,120,171,174,230,174,8,8,231,342,342,18,120,171,82,147,220', +'120,45,175,175,174,174,175,108,175,233,40,108,45,233,40,174,233,45,108', +'174,174,40,235,174,175,342,81,174,174,342,342,174,239,342,174,175,79', +'342,241,175,175,342,174,175,242,243,247,175,175,179,179,175,342,179', +'175,179,250,13,77,180,180,13,175,180,199,180,75,199,13,334,334,179,72', +'334,260,334,70,267,267,325,325,180,179,325,267,261,179,179,90,91,179', +'334,180,94,179,179,180,180,179,107,180,179,334,211,180,180,334,334,180', +'179,334,180,325,209,334,334,325,325,334,180,325,334,24,24,325,208,24', +'69,325,334,122,26,26,122,122,26,68,26,57,325,261,261,261,261,24,55,145', +'284,181,181,284,54,181,26,181,24,53,129,207,24,24,129,129,24,26,205', +'283,24,26,26,181,24,26,202,178,111,26,26,178,178,26,181,24,26,145,181', +'181,145,114,181,191,26,48,181,181,29,29,181,172,29,181,29,172,172,46', +'128,145,187,181,285,285,297,182,182,285,285,182,29,182,87,132,285,300', +'270,270,270,270,37,29,133,270,270,29,29,182,306,29,270,264,139,29,29', +'264,264,29,182,32,29,143,182,182,23,318,182,320,29,146,182,182,183,183', +'182,150,183,182,183,152,137,271,271,271,271,182,15,336,271,271,137,137', +'286,286,183,271,155,286,286,137,137,137,137,159,286,183,343,9,160,183', +'183,5,355,183,356,161,2,183,183,162,366,183,137,137,183,368,137,137', +'137,137,137,137,183,137,137,299,299,,,299,137,299,,,,44,44,,,44,,44', +',,,295,295,299,,295,,295,28,28,28,28,,44,299,,,,299,299,,,299,295,44', +',299,299,44,44,299,,44,299,295,,44,44,295,295,44,299,295,44,,,295,295', +'290,290,295,44,,295,,290,,,47,47,,295,47,,47,,,,289,289,,,289,,289,', +',,184,184,47,290,184,,184,290,290,,,290,289,47,,290,,47,47,290,,47,184', +'289,,47,47,289,289,47,290,289,47,184,,289,289,184,184,289,47,184,289', +',,184,184,167,167,184,289,,184,167,,,,51,51,,184,51,,51,,,,52,52,,,52', +',52,,,,185,185,51,167,185,,185,167,167,,,167,52,51,,167,,51,51,167,', +'51,185,52,,51,51,52,52,51,167,52,51,185,,52,52,185,185,52,51,185,52', +',,185,185,186,186,185,52,186,185,186,,,,188,188,,185,188,,188,,,,98', +'98,186,,98,98,98,33,33,33,33,,188,186,,,,186,186,,,186,98,188,,186,186', +'188,188,186,,188,186,98,,188,188,98,98,188,186,98,188,,,98,98,190,190', +'98,188,190,98,190,,,,67,67,,98,67,34,34,34,34,,192,192,190,,192,,192', +'3,3,3,3,,,190,,,,190,190,,,190,192,67,,190,190,67,67,190,,67,190,192', +',67,,192,192,67,190,192,,,,192,192,193,193,192,67,193,192,193,,,,195', +'195,,192,195,,195,,,,,,193,,,,,,,,,,195,193,,,,193,193,,,193,,195,,193', +'193,195,195,193,,195,193,258,,195,195,,,195,193,,195,258,258,,,,,,195', +',258,258,258,258,,,,,,,,255,255,,,255,,255,,,,,,258,258,,,258,258,258', +'258,258,258,255,258,258,76,76,,,76,258,76,,255,,252,252,255,255,,,255', +',,,255,255,76,76,255,,,255,78,78,,,78,76,78,255,,76,76,,,76,,252,,76', +'76,252,252,76,78,252,76,240,240,252,,240,,252,76,78,,,,78,78,,,78,252', +',,78,78,,,78,196,196,78,,196,,196,,240,,78,,240,240,,,240,232,232,,240', +'232,196,232,240,,,,,,,,,196,,240,,196,196,232,,196,,,,196,196,,,196', +'232,,196,,232,232,,,232,,196,,232,232,225,225,232,,225,232,225,,,,85', +'85,,232,85,85,85,,,,224,224,225,,224,,224,,,,204,204,85,225,,,,225,225', +',,225,224,85,,225,225,85,85,225,,85,225,224,,85,85,224,224,85,225,224', +'85,204,,224,224,204,204,224,85,204,224,,,204,,219,219,204,224,219,,219', +',,,218,218,,204,218,,218,,,,103,103,219,,103,,103,,,,,,218,219,,,,219', +'219,,,219,103,218,,219,219,218,218,219,,218,219,103,,218,218,103,103', +'218,219,103,218,,,103,103,95,95,103,218,95,103,95,,,,96,96,,103,96,', +'96,,,,189,189,95,,189,,189,,,,,,96,95,,,,95,95,,,95,189,96,,95,95,96', +'96,95,,96,95,189,,96,96,189,189,96,95,189,96,,99,189,189,,,189,96,,189', +'99,99,,,,,104,189,,99,99,99,99,,,104,104,,,,,,,,104,104,104,104,,,,', +'99,99,,,99,99,99,99,99,99,,99,99,,,104,104,,99,104,104,104,104,104,104', +',104,104,308,308,,,,104,,,,308,308,308,308,,,344,344,,,,,,,,344,344', +'344,344,,,,,308,308,,,308,308,308,308,308,308,,308,308,,,344,344,,308', +'344,344,344,344,344,344,,344,344,339,339,,,,344,,,,339,339,339,339,', +',313,313,,,,,,,,313,313,313,313,,,,,339,339,,,339,339,339,339,339,339', +',339,339,,,313,313,,339,313,313,313,313,313,313,,313,313,347,347,,,', +'313,,,,347,347,347,347,,,176,176,,,,,,,176,176,176,176,176,,,,,347,347', +',,347,347,347,347,347,347,,347,347,,,176,176,,347,176,176,176,176,176', +'176,,176,176,117,117,,,,176,,,,117,117,117,117,,,273,273,,,,,,,,273', +'273,273,273,,,,,117,117,,,117,117,117,117,117,117,,117,117,,,,273,,117', +'273,273,273,273,273,273,,273,273,307,307,,,,273,,,,307,307,307,307,', +',305,305,,,,,,,,305,305,305,305,,,,,307,307,,,307,307,307,307,307,307', +',307,307,,,,,,307,305,305,305,305,305,305,,305,305,276,276,,,,305,,', +',276,276,276,276,,,304,304,,,,,,,,304,304,304,304,,,,,,,,,276,276,276', +'276,276,276,,276,276,,,,,,276,304,304,304,304,304,304,,304,304,130,130', +',,,304,,,,130,130,130,130,,,136,136,,,,,,,,136,136,136,136,,,,,130,130', +',,130,130,130,130,130,130,,130,130,,,136,136,,130,136,136,136,136,136', +'136,,136,136,135,135,,,,136,,,,135,135,135,135,,,,280,,,,,,,,280,,,', +',,,,135,135,274,,135,135,135,135,135,135,274,135,135,,,,,278,135,280', +'280,280,280,280,280,278,280,280,,,,,,280,,277,,274,274,274,274,274,274', +'277,274,274,,,,,,274,278,278,278,278,278,278,,278,278,,194,,,,278,,', +',277,277,277,277,277,277,,277,277,,362,,,194,277,194,194,,194,194,,194', +',194,,194,237,194,,,194,362,,362,362,,362,362,,362,,362,360,362,,362', +',237,362,237,237,,237,237,,237,,237,212,237,,237,,360,237,360,360,,360', +'360,,360,,360,350,360,,360,,212,360,212,212,,212,212,,212,,212,317,212', +',212,,350,212,350,350,,350,350,,350,,350,,350,,350,,317,350,317,317', +',317,317,,317,,317,,317,0,317,0,0,317,0,0,,0,,0,,0,17,0,17,17,0,17,17', +',17,,17,,17,282,17,282,282,17,282,282,,282,,282,,282,,282,,,282,281', +'281,281,281,281,281,,281,281,,,,,,281,272,272,272,272,272,272,,272,272', +',,,,,272' ] + racc_action_check = arr = Array.new(2074, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -222,210 +224,218 @@ end racc_action_pointer = [ - 1952, 522, 1978, nil, nil, 1188, nil, 892, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 461, 441, - 466, 201, 462, 82, 129, 420, 283, 432, 304, 351, - 440, 40, 144, 19, nil, 15, nil, 62, nil, nil, - nil, nil, 202, 331, 512, 356, nil, 342, 339, 338, - 337, nil, 317, nil, 324, nil, 303, 297, nil, 2, - 196, nil, 805, nil, 815, 190, 171, 78, nil, nil, - 42, nil, 878, 150, 218, 112, 139, 996, 249, nil, - nil, nil, nil, 1046, 1071, 1096, 1121, nil, 1259, nil, - nil, 1146, 1171, 1196, 971, 1, 1274, nil, nil, 255, - 267, 271, -6, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 397, nil, 405, -9, nil, nil, - nil, 269, nil, 1514, 701, 676, 626, 651, nil, -4, - 446, nil, 559, 386, 417, 415, nil, -4, nil, 416, - 422, 426, nil, 443, nil, 463, nil, nil, nil, nil, - 481, 497, 469, 182, nil, nil, nil, 72, 141, nil, - nil, nil, nil, -17, 381, 1379, 1334, 936, 1394, 1923, - 71, 459, 451, 81, 91, 138, 158, 221, 284, 361, - 371, 428, 438, 448, 495, 601, 726, nil, nil, 1439, - 369, 46, nil, nil, 396, nil, nil, 743, 376, 362, - nil, 73, 266, 293, 42, nil, 168, 279, 244, 888, - 1021, nil, 222, 1221, nil, nil, 11, 5, nil, 448, - nil, nil, 898, 92, 419, 18, nil, nil, 868, 59, - nil, nil, nil, nil, nil, 83, 795, 108, 83, 97, - 139, 159, nil, 51, nil, nil, -14, 825, 752, nil, - nil, nil, nil, 1965, 234, -22, nil, nil, nil, 530, - 456, 244, 255, 915, 1997, 1988, 1973, 1787, 1772, 1754, - 1805, 1679, 1694, nil, nil, nil, 213, 576, 530, nil, - 7, nil, nil, 1841, 347, 22, nil, 367, 374, 389, - nil, 132, 1907, nil, nil, nil, nil, 1739, 1634, nil, - 1319, nil, nil, nil, nil, nil, 338, nil, 381, nil, - nil, nil, nil, 425, nil, 429, nil, nil, 1619, 1574, - 187, nil, 294, 440, nil, nil, 1559, nil, nil, 453, - 274, 456, nil, nil, nil, 114, 231, 211, 1859, nil, - nil, nil, 471, nil, 475, 148, 485, nil, nil, nil, - nil, nil, 1939, 1891, nil, nil, nil, 1499, 1454, 1875, - nil, nil, nil, nil, 519, nil, 520, nil, nil, nil, - nil ] + 1970, 72, 409, 724, nil, 433, -3, nil, 124, 436, + nil, nil, 58, 171, nil, 423, nil, 1983, 82, nil, + nil, nil, nil, 393, 270, nil, 279, nil, 436, 343, + nil, nil, 394, 657, 712, nil, nil, 353, nil, nil, + 124, nil, nil, nil, 480, 127, 346, 547, 302, 76, + 31, 624, 634, 266, 277, 287, nil, 288, nil, 3, + nil, nil, nil, nil, nil, nil, nil, 768, 263, 254, + 220, nil, 216, nil, nil, 193, 933, 185, 961, 180, + nil, 170, 135, 21, nil, 1085, nil, 346, 2, nil, + 215, 216, nil, nil, 220, 1219, 1229, nil, 711, 1277, + nil, 27, nil, 1172, 1292, nil, nil, 237, 121, 57, + nil, 317, nil, nil, 332, nil, nil, 1517, nil, nil, + 110, nil, 234, nil, nil, nil, nil, 57, 315, 300, + 1697, nil, 359, 367, -18, 1757, 1712, 410, nil, 377, + nil, nil, -9, 361, nil, 294, 398, 86, nil, nil, + 392, nil, 393, nil, nil, 427, nil, nil, 78, 417, + 404, 429, 433, nil, 9, nil, 16, 614, nil, -4, + 56, 84, 341, nil, 130, 150, 1472, nil, 317, 197, + 207, 296, 360, 407, 567, 644, 691, 295, 701, 1239, + 758, 278, 778, 825, 1859, 835, 1011, nil, nil, 205, + nil, nil, 312, nil, 1105, 313, nil, 293, 250, 251, + nil, 238, 1925, 23, nil, nil, nil, 41, 1162, 1152, + 137, nil, nil, nil, 1095, 1075, 68, 80, nil, nil, + 128, 101, 1028, 123, nil, 164, nil, 1893, nil, 142, + 986, 179, 185, 170, nil, nil, nil, 185, nil, nil, + 182, nil, 943, nil, nil, 908, nil, nil, 873, nil, + 217, 227, nil, -5, 381, nil, nil, 167, 54, nil, + 320, 365, 2006, 1532, 1790, nil, 1637, 1823, 1805, nil, + 1772, 1991, 1996, 307, 266, 304, 374, 7, nil, 557, + 537, nil, -1, nil, nil, 490, nil, 336, -23, 470, + 363, nil, nil, nil, 1652, 1592, 376, 1577, 1337, nil, + nil, nil, nil, 1412, nil, nil, nil, 1957, 393, nil, + 392, nil, nil, nil, nil, 227, nil, 49, nil, nil, + nil, nil, nil, 4, 217, nil, 416, nil, nil, 1397, + nil, nil, 140, 435, 1352, nil, nil, 1457, nil, nil, + 1941, nil, nil, nil, nil, 440, 442, 66, nil, nil, + 1909, nil, 1877, nil, nil, nil, 448, nil, 453, nil, + nil, nil ] racc_action_default = [ - -180, -217, -1, -2, -3, -6, -7, -8, -9, -10, - -11, -12, -13, -14, -15, -16, -17, -18, -19, -217, - -23, -171, -217, -217, -217, -53, -217, -217, -217, -217, - -217, -217, -172, -217, -170, -217, -4, -217, -25, -26, - -27, -28, -217, -95, -217, -32, -33, -37, -38, -39, - -40, -41, -42, -43, -44, -45, -46, -47, -75, -76, - -77, -100, -217, -105, -217, -217, -217, -215, -158, -159, - -197, -205, -88, -88, -56, -180, -180, -217, -217, -52, - -171, -172, -54, -217, -217, -217, -217, -108, -217, -115, - -116, -217, -217, -217, -217, -217, -217, -160, -161, -163, - -180, -180, -180, -173, -175, -176, -177, -178, -179, 371, - -21, -22, -23, -24, -171, -20, -203, -217, -93, -94, - -96, -217, -31, -35, -217, -217, -217, -217, -101, -217, - -217, -200, -217, -73, -203, -217, -71, -76, -77, -78, - -79, -80, -81, -82, -83, -84, -89, -154, -155, -156, - -203, -217, -95, -217, -59, -60, -62, -180, -217, -68, - -69, -76, -197, -217, -217, -85, -87, -217, -86, -217, + -180, -217, -53, -217, -9, -217, -217, -10, -217, -23, + -11, -170, -172, -217, -12, -217, -13, -1, -217, -14, + -2, -15, -3, -217, -171, -16, -217, -17, -6, -217, + -18, -7, -217, -19, -8, -172, -171, -180, -54, -28, + -217, -25, -26, -27, -217, -180, -56, -217, -88, -180, + -217, -217, -217, -95, -180, -217, -52, -217, -4, -180, + -177, -173, -175, -205, -176, -179, -178, -88, -40, -215, + -217, -41, -197, -100, -45, -42, -217, -217, -217, -77, + -43, -44, -32, -46, -33, -217, -105, -47, -76, -75, + -37, -38, -159, -158, -39, -217, -217, -115, -217, -217, + -108, -217, -116, -217, -217, -160, -161, -163, -217, -181, + -182, -217, -20, -23, -171, -22, -24, -86, -197, -68, + -180, -59, -217, -60, -76, -62, -69, -217, -95, -217, + -35, -89, -217, -203, -217, -85, -87, -217, -93, -203, + -94, -96, -217, -180, 372, -217, -217, -217, -191, -155, + -217, -81, -82, -83, -77, -84, -154, -156, -76, -78, + -73, -79, -80, -71, -203, -31, -217, -217, -101, -217, + -217, -217, -217, -200, -217, -217, -217, -133, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, - -217, -217, -217, -217, -217, -217, -217, -126, -133, -217, - -217, -217, -208, -209, -217, -212, -213, -217, -217, -217, - -182, -181, -180, -217, -217, -191, -217, -217, -204, -217, - -217, -29, -202, -217, -201, -34, -217, -217, -99, -217, - -102, -103, -217, -198, -202, -76, -144, -145, -217, -217, - -150, -151, -152, -153, -157, -217, -74, -217, -204, -88, - -217, -203, -57, -217, -64, -65, -217, -217, -217, -58, - -107, -202, -214, -5, -217, -111, -117, -118, -119, -120, - -121, -122, -123, -124, -125, -127, -128, -129, -130, -131, - -132, -134, -135, -136, -198, -206, -217, -217, -217, -138, - -217, -142, -162, -217, -217, -217, -185, -188, -190, -217, - -193, -217, -217, -174, -192, -51, -97, -91, -92, -30, - -36, -216, -98, -106, -104, -199, -203, -147, -217, -48, - -72, -49, -90, -203, -50, -217, -61, -63, -66, -67, - -111, -110, -217, -217, -207, -210, -211, -137, -139, -217, - -217, -217, -165, -183, -184, -217, -217, -217, -217, -194, - -195, -196, -217, -169, -217, -217, -202, -149, -70, -55, - -109, -112, -217, -217, -143, -164, -186, -187, -189, -217, - -167, -168, -146, -148, -217, -114, -217, -141, -166, -113, - -140 ] + -217, -217, -217, -217, -217, -217, -217, -212, -213, -217, + -209, -208, -217, -126, -217, -217, -21, -190, -217, -203, + -185, -188, -217, -217, -57, -65, -64, -217, -217, -217, + -203, -201, -202, -107, -217, -217, -217, -204, -58, -214, + -217, -204, -217, -217, -193, -217, -174, -217, -192, -88, + -74, -217, -217, -202, -29, -157, -153, -217, -144, -145, + -76, -152, -217, -150, -151, -217, -103, -102, -217, -34, + -202, -198, -99, -217, -217, -136, -198, -123, -122, -117, + -124, -125, -128, -135, -130, -118, -134, -132, -129, -119, + -131, -127, -5, -217, -111, -120, -121, -217, -206, -217, + -217, -138, -217, -142, -162, -217, -183, -217, -204, -217, + -217, -165, -63, -61, -66, -67, -217, -36, -91, -50, + -90, -51, -97, -92, -195, -194, -196, -217, -217, -169, + -203, -72, -48, -49, -30, -217, -147, -203, -104, -216, + -199, -98, -106, -111, -217, -110, -217, -210, -207, -211, + -139, -137, -217, -217, -189, -184, -186, -187, -164, -55, + -217, -167, -168, -70, -149, -217, -202, -217, -109, -112, + -217, -143, -217, -166, -146, -148, -217, -114, -217, -141, + -113, -140 ] racc_goto_table = [ - 23, 36, 23, 27, 2, 27, 46, 87, 20, 193, - 20, 139, 149, 103, 148, 140, 108, 98, 160, 160, - 100, 101, 227, 286, 78, 3, 279, 229, 145, 146, - 146, 128, 134, 150, 196, 116, 207, 23, 321, 110, - 153, 163, 23, 113, 115, 112, 121, 133, 113, 79, - 112, 278, 136, 220, 237, 235, 88, 96, 37, 42, - 254, 226, 111, 296, 142, 144, 130, 111, 199, 202, - 240, 232, 149, 306, 148, 230, 345, 99, 316, 164, - 289, 102, 203, 74, 294, 284, 285, 45, 339, 191, - 129, 1, 281, nil, nil, nil, 190, nil, nil, nil, - 160, nil, nil, 350, nil, nil, nil, 328, nil, 215, - nil, 165, 166, 167, 168, nil, nil, nil, 307, 187, - 188, 189, 246, 229, nil, 200, 200, 205, 217, 219, - nil, nil, nil, 147, 141, 234, 232, 149, nil, 148, - 230, nil, nil, nil, 241, nil, nil, nil, nil, nil, - nil, nil, nil, 216, 257, 258, nil, 356, nil, nil, - nil, 315, nil, nil, nil, nil, nil, 232, 149, 23, - 148, 230, 27, 281, 331, 139, 149, 20, 148, 140, - nil, nil, nil, 342, 293, 282, 160, 108, nil, 108, - 325, 304, 145, 147, 231, 312, 146, nil, 256, 313, - 234, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 196, 310, 232, 149, 143, - 148, 230, 159, 159, nil, 354, 344, 290, 142, 144, - nil, 234, nil, 348, nil, 363, nil, 297, 298, nil, - 229, 300, nil, 364, 366, nil, nil, nil, nil, nil, - 129, nil, 36, 23, nil, nil, 27, nil, 147, 231, - nil, 20, nil, nil, nil, nil, nil, nil, nil, 232, - 149, nil, 148, 230, nil, 318, 319, nil, nil, 233, - 340, 234, nil, 23, 232, 149, 27, 148, 230, 147, - 231, 20, 23, 347, nil, 27, nil, 147, 141, nil, - 20, 351, nil, nil, 159, 326, nil, nil, nil, nil, + 6, 5, 58, 17, 9, 100, 84, 119, 133, 138, + 249, 119, 126, 55, 37, 210, 126, 6, 5, 168, + 106, 9, 129, 283, 162, 54, 20, 164, 151, 152, + 163, 61, 291, 157, 161, 149, 139, 156, 153, 226, + 6, 300, 247, 200, 113, 230, 122, 56, 155, 116, + 134, 166, 112, 335, 111, 159, 40, 248, 290, 257, + 172, 65, 241, 110, 160, 312, 318, 327, 357, 107, + 242, 143, 82, 178, 115, 235, 59, 146, 303, 293, + 110, 238, 119, 208, 138, 148, 108, 126, 209, 198, + 46, 315, 199, 15, nil, 326, nil, nil, nil, nil, + nil, nil, 358, nil, nil, nil, nil, nil, 6, nil, + nil, 220, 113, nil, nil, 297, nil, 116, 340, nil, + 206, 213, nil, nil, 254, nil, 306, 247, nil, 246, + nil, nil, nil, 157, 253, 149, nil, 156, nil, nil, + nil, nil, 115, nil, nil, nil, nil, nil, nil, 263, + 264, nil, nil, 259, nil, 251, nil, nil, 236, nil, + nil, 254, nil, nil, nil, 293, 246, nil, 245, 234, + 157, 253, 149, nil, 156, nil, nil, nil, nil, 119, + nil, nil, nil, 310, 126, nil, nil, 138, 65, 366, + 65, 368, 251, 294, 6, 5, 328, 162, 9, 320, + 365, 151, 152, 321, 346, 245, 157, 161, 149, 254, + 156, 153, 6, 5, 246, nil, 9, 361, 157, 253, + 149, 155, 156, nil, 99, nil, 353, 104, 159, 337, + 275, nil, 247, 355, 279, nil, nil, 6, 5, nil, + 251, 9, 117, nil, nil, nil, 314, 254, 135, 136, + 137, nil, 246, 245, nil, nil, 157, 253, 149, nil, + 156, nil, nil, nil, nil, nil, nil, 58, nil, nil, + nil, nil, nil, nil, nil, 198, 169, nil, 251, nil, + nil, nil, 6, 5, nil, nil, 9, nil, nil, nil, + nil, 245, nil, 176, 177, nil, nil, nil, nil, 254, + nil, 203, nil, nil, 246, nil, nil, 354, 157, 253, + 149, nil, 156, 359, 254, nil, nil, 6, 5, 246, + 350, 9, nil, 157, 253, 149, nil, 156, nil, nil, + 251, nil, nil, nil, nil, 58, nil, nil, nil, nil, + nil, nil, nil, 245, nil, 251, nil, nil, nil, nil, + 6, 5, nil, nil, 9, nil, nil, nil, 245, nil, + 6, 5, 6, 5, 9, nil, 9, nil, 258, nil, + nil, nil, nil, nil, nil, nil, nil, 267, 268, 269, + 270, 271, 272, 273, 274, nil, 276, 277, 278, nil, + 280, 281, nil, 285, 286, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 304, 305, nil, nil, + nil, nil, 307, 308, nil, nil, nil, nil, nil, nil, + 313, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 234, nil, nil, nil, nil, 23, 147, - 231, 27, 359, nil, 233, nil, 20, nil, 234, nil, - 88, nil, 23, 23, nil, 27, 27, nil, 36, 23, - 20, 20, 27, nil, 357, 358, nil, 20, nil, nil, - nil, nil, nil, nil, nil, 233, nil, nil, nil, nil, - nil, nil, nil, 143, nil, nil, nil, nil, nil, nil, - 159, 147, 231, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 147, 231, nil, nil, + nil, nil, nil, 169, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 233, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 339, nil, nil, + nil, nil, nil, 344, nil, nil, nil, 347, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 233, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 233 ] + nil, nil, 99 ] racc_goto_check = [ - 43, 4, 43, 54, 2, 54, 25, 60, 22, 84, - 22, 28, 37, 77, 31, 29, 63, 71, 29, 29, - 38, 38, 69, 81, 43, 3, 65, 67, 35, 55, - 55, 58, 41, 41, 28, 44, 42, 43, 61, 20, - 47, 47, 43, 8, 20, 22, 23, 39, 8, 6, - 22, 64, 52, 59, 42, 40, 26, 26, 21, 21, - 5, 68, 6, 57, 32, 34, 23, 6, 73, 73, - 42, 28, 37, 70, 31, 29, 27, 72, 48, 23, - 74, 75, 76, 46, 78, 79, 80, 24, 82, 83, - 26, 1, 67, nil, nil, nil, 23, nil, nil, nil, - 29, nil, nil, 61, nil, nil, nil, 65, nil, 25, - nil, 26, 26, 26, 26, nil, nil, nil, 69, 26, - 26, 26, 47, 67, nil, 3, 3, 3, 23, 23, - nil, nil, nil, 36, 30, 54, 28, 37, nil, 31, - 29, nil, nil, nil, 44, nil, nil, nil, nil, nil, - nil, nil, nil, 26, 63, 63, nil, 81, nil, nil, - nil, 42, nil, nil, nil, nil, nil, 28, 37, 43, - 31, 29, 54, 67, 5, 28, 37, 22, 31, 29, - nil, nil, nil, 5, 77, 71, 29, 63, nil, 63, - 84, 58, 35, 36, 30, 55, 55, nil, 26, 41, - 54, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 28, 52, 28, 37, 33, - 31, 29, 33, 33, nil, 67, 42, 3, 32, 34, - nil, 54, nil, 42, nil, 69, nil, 26, 26, nil, - 67, 26, nil, 5, 5, nil, nil, nil, nil, nil, - 26, nil, 4, 43, nil, nil, 54, nil, 36, 30, - nil, 22, nil, nil, nil, nil, nil, nil, nil, 28, - 37, nil, 31, 29, nil, 26, 26, nil, nil, 33, - 38, 54, nil, 43, 28, 37, 54, 31, 29, 36, - 30, 22, 43, 25, nil, 54, nil, 36, 30, nil, - 22, 60, nil, nil, 33, 26, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 43, 54, 4, 2, 22, 60, 25, 33, 41, 55, + 69, 33, 29, 43, 38, 81, 29, 43, 54, 58, + 71, 22, 23, 5, 30, 38, 3, 41, 32, 33, + 52, 77, 65, 37, 29, 31, 44, 36, 34, 42, + 43, 5, 67, 84, 22, 42, 47, 6, 35, 8, + 47, 23, 20, 61, 73, 28, 21, 68, 64, 59, + 23, 63, 40, 3, 39, 57, 5, 70, 27, 72, + 42, 73, 24, 23, 6, 74, 75, 76, 48, 67, + 3, 78, 33, 79, 55, 3, 21, 29, 80, 28, + 46, 82, 83, 1, nil, 69, nil, nil, nil, nil, + nil, nil, 61, nil, nil, nil, nil, nil, 43, nil, + nil, 44, 22, nil, nil, 42, nil, 8, 65, nil, + 20, 47, nil, nil, 30, nil, 42, 67, nil, 33, + nil, nil, nil, 37, 29, 31, nil, 36, nil, nil, + nil, nil, 6, nil, nil, nil, nil, nil, nil, 23, + 23, nil, nil, 25, nil, 28, nil, nil, 77, nil, + nil, 30, nil, nil, nil, 67, 33, nil, 54, 3, + 37, 29, 31, nil, 36, nil, nil, nil, nil, 33, + nil, nil, nil, 55, 29, nil, nil, 55, 63, 5, + 63, 5, 28, 71, 43, 54, 58, 30, 22, 41, + 69, 32, 33, 52, 81, 54, 37, 29, 31, 30, + 36, 34, 43, 54, 33, nil, 22, 67, 37, 29, + 31, 35, 36, nil, 26, nil, 42, 26, 28, 84, + 63, nil, 67, 42, 63, nil, nil, 43, 54, nil, + 28, 22, 26, nil, nil, nil, 38, 30, 26, 26, + 26, nil, 33, 54, nil, nil, 37, 29, 31, nil, + 36, nil, nil, nil, nil, nil, nil, 4, nil, nil, + nil, nil, nil, nil, nil, 28, 26, nil, 28, nil, + nil, nil, 43, 54, nil, nil, 22, nil, nil, nil, + nil, 54, nil, 26, 26, nil, nil, nil, nil, 30, + nil, 26, nil, nil, 33, nil, nil, 25, 37, 29, + 31, nil, 36, 60, 30, nil, nil, 43, 54, 33, + 2, 22, nil, 37, 29, 31, nil, 36, nil, nil, + 28, nil, nil, nil, nil, 4, nil, nil, nil, nil, + nil, nil, nil, 54, nil, 28, nil, nil, nil, nil, + 43, 54, nil, nil, 22, nil, nil, nil, 54, nil, + 43, 54, 43, 54, 22, nil, 22, nil, 26, nil, + nil, nil, nil, nil, nil, nil, nil, 26, 26, 26, + 26, 26, 26, 26, 26, nil, 26, 26, 26, nil, + 26, 26, nil, 26, 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 54, nil, nil, nil, nil, 43, 36, - 30, 54, 2, nil, 33, nil, 22, nil, 54, nil, - 26, nil, 43, 43, nil, 54, 54, nil, 4, 43, - 22, 22, 54, nil, 26, 26, nil, 22, nil, nil, - nil, nil, nil, nil, nil, 33, nil, nil, nil, nil, - nil, nil, nil, 33, nil, nil, nil, nil, nil, nil, - 33, 36, 30, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 36, 30, nil, nil, + nil, nil, nil, nil, nil, nil, 26, 26, nil, nil, + nil, nil, 26, 26, nil, nil, nil, nil, nil, nil, + 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 33, nil, nil, nil, nil, + nil, nil, nil, 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 26, nil, nil, + nil, nil, nil, 26, nil, nil, nil, 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 33, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 33 ] + nil, nil, 26 ] racc_goto_pointer = [ - nil, 91, 4, 25, -1, -109, 25, nil, 6, nil, + nil, 93, 3, 26, -15, -171, 34, nil, 9, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 2, 40, 8, 2, 66, -15, 28, -230, -61, -57, - 62, -58, -8, 147, -7, -44, 61, -60, -11, -25, - -78, -40, -80, 0, -8, nil, 60, -35, -165, nil, - nil, nil, -20, nil, 3, -43, nil, -145, -31, -76, - -21, -217, nil, -17, -146, -171, nil, -105, -71, -110, - -155, -13, 47, -32, -122, 48, -20, -20, -122, -116, - -115, -178, -203, -6, -86, nil ] + 12, 53, 4, -25, 48, -18, 198, -259, -12, -33, + -43, -32, -39, -38, -29, -19, -30, -34, 13, -3, + -98, -40, -94, 0, -17, nil, 84, 1, -139, nil, + nil, nil, -37, nil, 1, -44, nil, -166, -59, -110, + -21, -231, nil, 43, -146, -172, nil, -125, -110, -157, + -185, -12, 37, 17, -68, 58, 18, 13, -66, -26, + -21, -94, -142, -9, -58, nil ] racc_goto_default = [ - nil, nil, 253, 154, 4, nil, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, nil, 55, nil, nil, 89, 123, 213, 47, 48, - 49, 50, 51, 52, 53, 54, 56, 57, 22, nil, - nil, nil, nil, 65, nil, 24, nil, nil, 155, 243, - 156, 158, nil, 135, 67, 118, 119, 120, nil, nil, - nil, nil, 90, 69, nil, nil, 280, 66, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 104, nil, - nil, nil, nil, nil, nil, 194 ] + nil, nil, 282, 121, 22, nil, 28, 31, 34, 4, + 7, 10, 14, 16, 19, 21, 25, 27, 30, 33, + 3, nil, 74, nil, nil, 97, 130, 224, 90, 91, + 94, 68, 71, 75, 80, 81, 83, 87, 23, nil, + nil, nil, nil, 70, nil, 13, nil, nil, 123, 217, + 125, 127, nil, 150, 69, 131, 140, 141, nil, nil, + nil, nil, 102, 92, nil, nil, 292, 77, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 62, nil, + nil, nil, nil, nil, nil, 202 ] racc_reduce_table = [ 0, 0, :racc_error, @@ -612,7 +622,7 @@ 0, 147, :_reduce_181, 1, 141, :_reduce_none, 3, 141, :_reduce_183, - 3, 141, :_reduce_184, + 4, 141, :_reduce_184, 1, 148, :_reduce_none, 3, 148, :_reduce_186, 3, 149, :_reduce_187, @@ -648,7 +658,7 @@ racc_reduce_n = 217 -racc_shift_n = 371 +racc_shift_n = 372 racc_token_table = { false => 0, diff -Nru puppet-2.7.6/lib/puppet/property.rb puppet-2.7.9/lib/puppet/property.rb --- puppet-2.7.6/lib/puppet/property.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/property.rb 2011-12-08 22:58:09.000000000 +0000 @@ -100,11 +100,11 @@ def change_to_s(current_value, newvalue) begin if current_value == :absent - return "defined '#{name}' as '#{should_to_s(newvalue)}'" + return "defined '#{name}' as #{self.class.format_value_for_display should_to_s(newvalue)}" elsif newvalue == :absent or newvalue == [:absent] - return "undefined '#{name}' from '#{is_to_s(current_value)}'" + return "undefined '#{name}' from #{self.class.format_value_for_display is_to_s(current_value)}" else - return "#{name} changed '#{is_to_s(current_value)}' to '#{should_to_s(newvalue)}'" + return "#{name} changed #{self.class.format_value_for_display is_to_s(current_value)} to #{self.class.format_value_for_display should_to_s(newvalue)}" end rescue Puppet::Error, Puppet::DevError raise diff -Nru puppet-2.7.6/lib/puppet/provider/augeas/augeas.rb puppet-2.7.9/lib/puppet/provider/augeas/augeas.rb --- puppet-2.7.6/lib/puppet/provider/augeas/augeas.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/augeas/augeas.rb 2011-12-08 23:17:37.000000000 +0000 @@ -298,7 +298,7 @@ saved_files.each do |key| saved_file = @aug.get(key).to_s.sub(/^\/files/, root) if Puppet[:show_diff] - print diff(saved_file, saved_file + ".augnew") + notice "\n" + diff(saved_file, saved_file + ".augnew") end if resource.noop? File.delete(saved_file + ".augnew") diff -Nru puppet-2.7.6/lib/puppet/provider/exec/windows.rb puppet-2.7.9/lib/puppet/provider/exec/windows.rb --- puppet-2.7.6/lib/puppet/provider/exec/windows.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/exec/windows.rb 2011-12-08 22:58:09.000000000 +0000 @@ -3,8 +3,8 @@ Puppet::Type.type(:exec).provide :windows, :parent => Puppet::Provider::Exec do include Puppet::Util::Execution - confine :feature => :microsoft_windows - defaultfor :feature => :microsoft_windows + confine :operatingsystem => :windows + defaultfor :operatingsystem => :windows desc "Execute external binaries directly, on Windows systems. This does not pass through a shell, or perform any interpolation, but @@ -23,11 +23,10 @@ return end - path = resource[:path] || [] - - exts = [".exe", ".ps1", ".bat", ".com", ""] - withenv :PATH => path.join(File::PATH_SEPARATOR) do - return if exts.any? {|ext| which(exe + ext) } + if resource[:path] + withenv :PATH => resource[:path].join(File::PATH_SEPARATOR) do + return if which(exe) + end end raise ArgumentError, "Could not find command '#{exe}'" diff -Nru puppet-2.7.6/lib/puppet/provider/file/windows.rb puppet-2.7.9/lib/puppet/provider/file/windows.rb --- puppet-2.7.6/lib/puppet/provider/file/windows.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/file/windows.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,7 +1,7 @@ Puppet::Type.type(:file).provide :windows do desc "Uses Microsoft Windows functionality to manage file's users and rights." - confine :feature => :microsoft_windows + confine :operatingsystem => :windows include Puppet::Util::Warnings @@ -81,7 +81,8 @@ def mode if resource.exist? - get_mode(resource[:path]).to_s(8) + mode = get_mode(resource[:path]) + mode ? mode.to_s(8) : :absent else :absent end @@ -97,4 +98,10 @@ end :file_changed end + + def validate + if [:owner, :group, :mode].any?{|p| resource[p]} and !supports_acl?(resource[:path]) + resource.fail("Can only manage owner, group, and mode on filesystems that support Windows ACLs, such as NTFS") + end + end end diff -Nru puppet-2.7.6/lib/puppet/provider/group/aix.rb puppet-2.7.9/lib/puppet/provider/group/aix.rb --- puppet-2.7.6/lib/puppet/provider/group/aix.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/group/aix.rb 2011-12-08 22:58:09.000000000 +0000 @@ -3,11 +3,11 @@ # mkgroup, rmgroup, lsgroup, chgroup # # Author:: Hector Rivas Gandara -# +# require 'puppet/provider/aixobject' Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject do - desc "Group management for AIX! Users are managed with mkgroup, rmgroup, lsgroup, chgroup" + desc "Group management for AIX." # This will the the default provider for this platform defaultfor :operatingsystem => :aix @@ -29,7 +29,7 @@ end # AIX attributes to properties mapping. - # + # # Valid attributes to be managed by this provider. # It is a list with of hash # :aix_attr AIX command attribute name @@ -43,10 +43,10 @@ :from => :users_from_attr}, {:aix_attr => :attributes, :puppet_prop => :attributes}, ] - + #-------------- # Command definition - + # Return the IA module arguments based on the resource param ia_load_module def get_ia_module_args if @resource[:ia_load_module] @@ -55,7 +55,7 @@ [] end end - + def lscmd(value=@resource[:name]) [self.class.command(:list)] + self.get_ia_module_args + @@ -80,7 +80,7 @@ def modifycmd(hash = property_hash) args = self.hash2args(hash) return nil if args.empty? - + [self.class.command(:modify)] + self.get_ia_module_args + args + [@resource[:name]] @@ -123,7 +123,7 @@ #self.class.validate(param, value) param = :attributes cmd = modifycmd({param => filter_attributes(attr_hash)}) - if cmd + if cmd begin execute(cmd) rescue Puppet::ExecutionFailure => detail diff -Nru puppet-2.7.6/lib/puppet/provider/group/groupadd.rb puppet-2.7.9/lib/puppet/provider/group/groupadd.rb --- puppet-2.7.6/lib/puppet/provider/group/groupadd.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/group/groupadd.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,9 +1,7 @@ require 'puppet/provider/nameservice/objectadd' Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameService::ObjectAdd do - desc "Group management via `groupadd` and its ilk. - - The default for most platforms + desc "Group management via `groupadd` and its ilk. The default for most platforms. " diff -Nru puppet-2.7.6/lib/puppet/provider/group/ldap.rb puppet-2.7.9/lib/puppet/provider/group/ldap.rb --- puppet-2.7.6/lib/puppet/provider/group/ldap.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/group/ldap.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,18 +1,16 @@ require 'puppet/provider/ldap' Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do - desc "Group management via `ldap`. + desc "Group management via LDAP. - This provider requires that you have valid values for all of the - ldap-related settings, including `ldapbase`. You will also almost - definitely need settings for `ldapuser` and `ldappassword`, so that - your clients can write to ldap. - - Note that this provider will automatically generate a GID for you if you do - not specify one, but it is a potentially expensive operation, as it - iterates across all existing groups to pick the appropriate next one. - - " + This provider requires that you have valid values for all of the + LDAP-related settings in `puppet.conf`, including `ldapbase`. You will + almost definitely need settings for `ldapuser` and `ldappassword` in order + for your clients to write to LDAP. + + Note that this provider will automatically generate a GID for you if you do + not specify one, but it is a potentially expensive operation, as it + iterates across all existing groups to pick the appropriate next one." confine :true => Puppet.features.ldap?, :false => (Puppet[:ldapuser] == "") diff -Nru puppet-2.7.6/lib/puppet/provider/group/windows_adsi.rb puppet-2.7.9/lib/puppet/provider/group/windows_adsi.rb --- puppet-2.7.6/lib/puppet/provider/group/windows_adsi.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/group/windows_adsi.rb 2011-12-08 22:58:09.000000000 +0000 @@ -4,8 +4,7 @@ desc "Group management for Windows" defaultfor :operatingsystem => :windows - confine :operatingsystem => :windows - confine :feature => :microsoft_windows + confine :operatingsystem => :windows has_features :manages_members @@ -23,6 +22,8 @@ def create @group = Puppet::Util::ADSI::Group.create(@resource[:name]) + @group.commit + self.members = @resource[:members] end @@ -34,6 +35,11 @@ Puppet::Util::ADSI::Group.delete(@resource[:name]) end + # Only flush if we created or modified a group, not deleted + def flush + @group.commit if @group + end + def gid Puppet::Util::ADSI.sid_for_account(@resource[:name]) end diff -Nru puppet-2.7.6/lib/puppet/provider/package/aix.rb puppet-2.7.9/lib/puppet/provider/package/aix.rb --- puppet-2.7.6/lib/puppet/provider/package/aix.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/package/aix.rb 2011-12-08 22:58:09.000000000 +0000 @@ -2,7 +2,7 @@ require 'puppet/util/package' Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package do - desc "Installation from AIX Software directory" + desc "Installation from the AIX software directory." # The commands we are using on an AIX box are installed standard # (except nimclient) nimclient needs the bos.sysmgt.nim.client fileset. diff -Nru puppet-2.7.6/lib/puppet/provider/package/macports.rb puppet-2.7.9/lib/puppet/provider/package/macports.rb --- puppet-2.7.6/lib/puppet/provider/package/macports.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/package/macports.rb 2011-12-08 22:58:09.000000000 +0000 @@ -4,10 +4,10 @@ desc "Package management using MacPorts on OS X. Supports MacPorts versions and revisions, but not variants. - Variant preferences may be specified using the MacPorts variants.conf file - http://guide.macports.org/chunked/internals.configuration-files.html#internals.configuration-files.variants-conf + Variant preferences may be specified using + [the MacPorts variants.conf file](http://guide.macports.org/chunked/internals.configuration-files.html#internals.configuration-files.variants-conf). - When specifying a version in the Puppet DSL, only specify the version, not the revision + When specifying a version in the Puppet DSL, only specify the version, not the revision. Revisions are only used internally for ensuring the latest version/revision of a port. " diff -Nru puppet-2.7.6/lib/puppet/provider/package/msi.rb puppet-2.7.9/lib/puppet/provider/package/msi.rb --- puppet-2.7.6/lib/puppet/provider/package/msi.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/package/msi.rb 2011-12-08 22:58:09.000000000 +0000 @@ -38,32 +38,39 @@ # Unfortunately, we can't use the msiexec method defined earlier, # because of the special quoting we need to do around the MSI # properties to use. - execute ['msiexec.exe', '/qn', '/norestart', '/i', shell_quote(resource[:source]), properties_for_command].flatten.compact.join(' ') + execute ['msiexec.exe', '/qn', '/norestart', '/i', shell_quote(msi_source), properties_for_command].flatten.compact.join(' ') File.open(state_file, 'w') do |f| metadata = { 'name' => resource[:name], 'install_options' => resource[:install_options], - 'source' => resource[:source] + 'source' => msi_source } - f.puts(YAML.dump metadata) + f.puts(YAML.dump(metadata)) end end def uninstall - msiexec '/qn', '/norestart', '/x', resource[:source] + msiexec '/qn', '/norestart', '/x', msi_source File.delete state_file end def validate_source(value) - fail("The source parameter is required when using the MSI provider.") if value.nil? fail("The source parameter cannot be empty when using the MSI provider.") if value.empty? end private + def msi_source + resource[:source] ||= YAML.load_file(state_file)['source'] rescue nil + + fail("The source parameter is required when using the MSI provider.") unless resource[:source] + + resource[:source] + end + def self.installed_listing_dir listing_dir = File.join(Puppet[:vardir], 'db', 'package', 'msi') diff -Nru puppet-2.7.6/lib/puppet/provider/package/nim.rb puppet-2.7.9/lib/puppet/provider/package/nim.rb --- puppet-2.7.6/lib/puppet/provider/package/nim.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/package/nim.rb 2011-12-08 22:58:09.000000000 +0000 @@ -2,7 +2,7 @@ require 'puppet/util/package' Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do - desc "Installation from NIM LPP source" + desc "Installation from NIM LPP source." # The commands we are using on an AIX box are installed standard # (except nimclient) nimclient needs the bos.sysmgt.nim.client fileset. diff -Nru puppet-2.7.6/lib/puppet/provider/package/pkgdmg.rb puppet-2.7.9/lib/puppet/provider/package/pkgdmg.rb --- puppet-2.7.6/lib/puppet/provider/package/pkgdmg.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/package/pkgdmg.rb 2011-12-08 22:58:09.000000000 +0000 @@ -15,9 +15,9 @@ desc "Package management based on Apple's Installer.app and DiskUtility.app. This package works by checking the contents of a DMG image for Apple pkg or mpkg files. Any number of pkg or mpkg - files may exist in the root directory of the DMG file system. Sub - directories are not checked for packages. See `the wiki docs - ` + files may exist in the root directory of the DMG file system. + Subdirectories are not checked for packages. See + [the wiki docs on this provider](http://projects.puppetlabs.com/projects/puppet/wiki/Package_Management_With_Dmg_Patterns) for more detail." confine :operatingsystem => :darwin diff -Nru puppet-2.7.6/lib/puppet/provider/package/ports.rb puppet-2.7.9/lib/puppet/provider/package/ports.rb --- puppet-2.7.6/lib/puppet/provider/package/ports.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/package/ports.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,5 +1,5 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :freebsd do - desc "Support for FreeBSD's ports. Again, this still mixes packages and ports." + desc "Support for FreeBSD's ports. Note that this, too, mixes packages and ports." commands :portupgrade => "/usr/local/sbin/portupgrade", :portversion => "/usr/local/sbin/portversion", diff -Nru puppet-2.7.6/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb puppet-2.7.9/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb --- puppet-2.7.6/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb 1970-01-01 00:00:00.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb 2011-12-08 22:58:09.000000000 +0000 @@ -0,0 +1,560 @@ +require 'puppet/parameter' + +if Puppet.features.microsoft_windows? + require 'win32/taskscheduler' + require 'puppet/util/adsi' +end + +Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do + desc 'This uses the win32-taskscheduler gem to provide support for + managing scheduled tasks on Windows.' + + defaultfor :operatingsystem => :windows + confine :operatingsystem => :windows + + def self.instances + Win32::TaskScheduler.new.tasks.collect do |job_file| + job_title = File.basename(job_file, '.job') + + new( + :provider => :win32_taskscheduler, + :name => job_title + ) + end + end + + def exists? + Win32::TaskScheduler.new.exists? resource[:name] + end + + def task + return @task if @task + + @task ||= Win32::TaskScheduler.new + @task.activate(resource[:name] + '.job') if exists? + + @task + end + + def clear_task + @task = nil + @triggers = nil + end + + def enabled + task.flags & Win32::TaskScheduler::DISABLED == 0 ? :true : :false + end + + def command + task.application_name + end + + def arguments + task.parameters + end + + def working_dir + task.working_directory + end + + def user + account = task.account_information + return 'system' if account == '' + account + end + + def trigger + return @triggers if @triggers + + @triggers = [] + task.trigger_count.times do |i| + trigger = begin + task.trigger(i) + rescue Win32::TaskScheduler::Error => e + # Win32::TaskScheduler can't handle all of the + # trigger types Windows uses, so we need to skip the + # unhandled types to prevent "puppet resource" from + # blowing up. + nil + end + next unless trigger and scheduler_trigger_types.include?(trigger['trigger_type']) + + puppet_trigger = {} + case trigger['trigger_type'] + when Win32::TaskScheduler::TASK_TIME_TRIGGER_DAILY + puppet_trigger['schedule'] = 'daily' + puppet_trigger['every'] = trigger['type']['days_interval'].to_s + when Win32::TaskScheduler::TASK_TIME_TRIGGER_WEEKLY + puppet_trigger['schedule'] = 'weekly' + puppet_trigger['every'] = trigger['type']['weeks_interval'].to_s + puppet_trigger['on'] = days_of_week_from_bitfield(trigger['type']['days_of_week']) + when Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDATE + puppet_trigger['schedule'] = 'monthly' + puppet_trigger['months'] = months_from_bitfield(trigger['type']['months']) + puppet_trigger['on'] = days_from_bitfield(trigger['type']['days']) + when Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDOW + puppet_trigger['schedule'] = 'monthly' + puppet_trigger['months'] = months_from_bitfield(trigger['type']['months']) + puppet_trigger['which_occurrence'] = occurrence_constant_to_name(trigger['type']['weeks']) + puppet_trigger['day_of_week'] = days_of_week_from_bitfield(trigger['type']['days_of_week']) + when Win32::TaskScheduler::TASK_TIME_TRIGGER_ONCE + puppet_trigger['schedule'] = 'once' + end + puppet_trigger['start_date'] = self.class.normalized_date("#{trigger['start_year']}-#{trigger['start_month']}-#{trigger['start_day']}") + puppet_trigger['start_time'] = self.class.normalized_time("#{trigger['start_hour']}:#{trigger['start_minute']}") + puppet_trigger['enabled'] = trigger['flags'] & Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED == 0 + puppet_trigger['index'] = i + + @triggers << puppet_trigger + end + @triggers = @triggers[0] if @triggers.length == 1 + + @triggers + end + + def user_insync?(current, should) + return false unless current + + # Win32::TaskScheduler can return the 'SYSTEM' account as the + # empty string. + current = 'system' if current == '' + + # By comparing account SIDs we don't have to worry about case + # sensitivity, or canonicalization of the account name. + Puppet::Util::ADSI.sid_for_account(current) == Puppet::Util::ADSI.sid_for_account(should[0]) + end + + def trigger_insync?(current, should) + should = [should] unless should.is_a?(Array) + current = [current] unless current.is_a?(Array) + return false unless current.length == should.length + + current_in_sync = current.all? do |c| + should.any? {|s| triggers_same?(c, s)} + end + + should_in_sync = should.all? do |s| + current.any? {|c| triggers_same?(c,s)} + end + + current_in_sync && should_in_sync + end + + def command=(value) + task.application_name = value + end + + def arguments=(value) + task.parameters = value + end + + def working_dir=(value) + task.working_directory = value + end + + def enabled=(value) + if value == :true + task.flags = task.flags & ~Win32::TaskScheduler::DISABLED + else + task.flags = task.flags | Win32::TaskScheduler::DISABLED + end + end + + def trigger=(value) + desired_triggers = value.is_a?(Array) ? value : [value] + current_triggers = trigger.is_a?(Array) ? trigger : [trigger] + + extra_triggers = [] + desired_to_search = desired_triggers.dup + current_triggers.each do |current| + if found = desired_to_search.find {|desired| triggers_same?(current, desired)} + desired_to_search.delete(found) + else + extra_triggers << current['index'] + end + end + + needed_triggers = [] + current_to_search = current_triggers.dup + desired_triggers.each do |desired| + if found = current_to_search.find {|current| triggers_same?(current, desired)} + current_to_search.delete(found) + else + needed_triggers << desired + end + end + + extra_triggers.reverse_each do |index| + task.delete_trigger(index) + end + + needed_triggers.each do |trigger_hash| + # Even though this is an assignment, the API for + # Win32::TaskScheduler ends up appending this trigger to the + # list of triggers for the task, while #add_trigger is only able + # to replace existing triggers. *shrug* + task.trigger = translate_hash_to_trigger(trigger_hash) + end + end + + def user=(value) + self.fail("Invalid user: #{value}") unless Puppet::Util::ADSI.sid_for_account(value) + + if value.to_s.downcase != 'system' + task.set_account_information(value, resource[:password]) + else + # Win32::TaskScheduler treats a nil/empty username & password as + # requesting the SYSTEM account. + task.set_account_information(nil, nil) + end + end + + def create + clear_task + @task = Win32::TaskScheduler.new(resource[:name], dummy_time_trigger) + + self.command = resource[:command] + + [:arguments, :working_dir, :enabled, :trigger, :user].each do |prop| + send("#{prop}=", resource[prop]) if resource[prop] + end + end + + def destroy + Win32::TaskScheduler.new.delete(resource[:name] + '.job') + end + + def flush + unless resource[:ensure] == :absent + self.fail('Parameter command is required.') unless resource[:command] + task.save + end + end + + def triggers_same?(current_trigger, desired_trigger) + return false unless current_trigger['schedule'] == desired_trigger['schedule'] + return false if current_trigger.has_key?('enabled') && !current_trigger['enabled'] + + desired = desired_trigger.dup + + desired['every'] ||= current_trigger['every'] if current_trigger.has_key?('every') + desired['months'] ||= current_trigger['months'] if current_trigger.has_key?('months') + desired['on'] ||= current_trigger['on'] if current_trigger.has_key?('on') + desired['day_of_week'] ||= current_trigger['day_of_week'] if current_trigger.has_key?('day_of_week') + + translate_hash_to_trigger(current_trigger) == translate_hash_to_trigger(desired) + end + + def self.normalized_date(date_string) + date = Date.parse("#{date_string}") + "#{date.year}-#{date.month}-#{date.day}" + end + + def self.normalized_time(time_string) + Time.parse("#{time_string}").strftime('%H:%M') + end + + def dummy_time_trigger + now = Time.now + + { + 'flags' => 0, + 'random_minutes_interval' => 0, + 'end_day' => 0, + "end_year" => 0, + "trigger_type" => 0, + "minutes_interval" => 0, + "end_month" => 0, + "minutes_duration" => 0, + 'start_year' => now.year, + 'start_month' => now.month, + 'start_day' => now.day, + 'start_hour' => now.hour, + 'start_minute' => now.min, + 'trigger_type' => Win32::TaskScheduler::ONCE, + } + end + + def translate_hash_to_trigger(puppet_trigger, user_provided_input=false) + trigger = dummy_time_trigger + + if user_provided_input + self.fail "'enabled' is read-only on triggers" if puppet_trigger.has_key?('enabled') + self.fail "'index' is read-only on triggers" if puppet_trigger.has_key?('index') + end + puppet_trigger.delete('index') + + if puppet_trigger.delete('enabled') == false + trigger['flags'] |= Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED + else + trigger['flags'] &= ~Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED + end + + extra_keys = puppet_trigger.keys.sort - ['schedule', 'start_date', 'start_time', 'every', 'months', 'on', 'which_occurrence', 'day_of_week'] + self.fail "Unknown trigger option(s): #{Puppet::Parameter.format_value_for_display(extra_keys)}" unless extra_keys.empty? + self.fail "Must specify 'start_time' when defining a trigger" unless puppet_trigger['start_time'] + + case puppet_trigger['schedule'] + when 'daily' + trigger['trigger_type'] = Win32::TaskScheduler::DAILY + trigger['type'] = { + 'days_interval' => Integer(puppet_trigger['every'] || 1) + } + when 'weekly' + trigger['trigger_type'] = Win32::TaskScheduler::WEEKLY + trigger['type'] = { + 'weeks_interval' => Integer(puppet_trigger['every'] || 1) + } + + trigger['type']['days_of_week'] = if puppet_trigger['day_of_week'] + bitfield_from_days_of_week(puppet_trigger['day_of_week']) + else + scheduler_days_of_week.inject(0) {|day_flags,day| day_flags |= day} + end + when 'monthly' + trigger['type'] = { + 'months' => bitfield_from_months(puppet_trigger['months'] || (1..12).to_a), + } + + if puppet_trigger.keys.include?('on') + if puppet_trigger.has_key?('day_of_week') or puppet_trigger.has_key?('which_occurrence') + self.fail "Neither 'day_of_week' nor 'which_occurrence' can be specified when creating a monthly date-based trigger" + end + + trigger['trigger_type'] = Win32::TaskScheduler::MONTHLYDATE + trigger['type']['days'] = bitfield_from_days(puppet_trigger['on']) + elsif puppet_trigger.keys.include?('which_occurrence') or puppet_trigger.keys.include?('day_of_week') + self.fail 'which_occurrence cannot be specified as an array' if puppet_trigger['which_occurrence'].is_a?(Array) + %w{day_of_week which_occurrence}.each do |field| + self.fail "#{field} must be specified when creating a monthly day-of-week based trigger" unless puppet_trigger.has_key?(field) + end + + trigger['trigger_type'] = Win32::TaskScheduler::MONTHLYDOW + trigger['type']['weeks'] = occurrence_name_to_constant(puppet_trigger['which_occurrence']) + trigger['type']['days_of_week'] = bitfield_from_days_of_week(puppet_trigger['day_of_week']) + else + self.fail "Don't know how to create a 'monthly' schedule with the options: #{puppet_trigger.keys.sort.join(', ')}" + end + when 'once' + self.fail "Must specify 'start_date' when defining a one-time trigger" unless puppet_trigger['start_date'] + + trigger['trigger_type'] = Win32::TaskScheduler::ONCE + else + self.fail "Unknown schedule type: #{puppet_trigger["schedule"].inspect}" + end + + if start_date = puppet_trigger['start_date'] + start_date = Date.parse(start_date) + self.fail "start_date must be on or after 1753-01-01" unless start_date >= Date.new(1753, 1, 1) + + trigger['start_year'] = start_date.year + trigger['start_month'] = start_date.month + trigger['start_day'] = start_date.day + end + + start_time = Time.parse(puppet_trigger['start_time']) + trigger['start_hour'] = start_time.hour + trigger['start_minute'] = start_time.min + + trigger + end + + def validate_trigger(value) + value = [value] unless value.is_a?(Array) + + # translate_hash_to_trigger handles the same validation that we + # would be doing here at the individual trigger level. + value.each {|t| translate_hash_to_trigger(t, true)} + + true + end + + private + + def bitfield_from_months(months) + bitfield = 0 + + months = [months] unless months.is_a?(Array) + months.each do |month| + integer_month = Integer(month) rescue nil + self.fail 'Month must be specified as an integer in the range 1-12' unless integer_month == month.to_f and integer_month.between?(1,12) + + bitfield |= scheduler_months[integer_month - 1] + end + + bitfield + end + + def bitfield_from_days(days) + bitfield = 0 + + days = [days] unless days.is_a?(Array) + days.each do |day| + # The special "day" of 'last' is represented by day "number" + # 32. 'last' has the special meaning of "the last day of the + # month", no matter how many days there are in the month. + day = 32 if day == 'last' + + integer_day = Integer(day) + self.fail "Day must be specified as an integer in the range 1-31, or as 'last'" unless integer_day = day.to_f and integer_day.between?(1,32) + + bitfield |= 1 << integer_day - 1 + end + + bitfield + end + + def bitfield_from_days_of_week(days_of_week) + bitfield = 0 + + days_of_week = [days_of_week] unless days_of_week.is_a?(Array) + days_of_week.each do |day_of_week| + bitfield |= day_of_week_name_to_constant(day_of_week) + end + + bitfield + end + + def months_from_bitfield(bitfield) + months = [] + + scheduler_months.each do |month| + if bitfield & month != 0 + months << month_constant_to_number(month) + end + end + + months + end + + def days_from_bitfield(bitfield) + days = [] + + i = 0 + while bitfield > 0 + if bitfield & 1 > 0 + # Day 32 has the special meaning of "the last day of the + # month", no matter how many days there are in the month. + days << (i == 31 ? 'last' : i + 1) + end + + bitfield = bitfield >> 1 + i += 1 + end + + days + end + + def days_of_week_from_bitfield(bitfield) + days_of_week = [] + + scheduler_days_of_week.each do |day_of_week| + if bitfield & day_of_week != 0 + days_of_week << day_of_week_constant_to_name(day_of_week) + end + end + + days_of_week + end + + def scheduler_trigger_types + [ + Win32::TaskScheduler::TASK_TIME_TRIGGER_DAILY, + Win32::TaskScheduler::TASK_TIME_TRIGGER_WEEKLY, + Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDATE, + Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDOW, + Win32::TaskScheduler::TASK_TIME_TRIGGER_ONCE + ] + end + + def scheduler_days_of_week + [ + Win32::TaskScheduler::SUNDAY, + Win32::TaskScheduler::MONDAY, + Win32::TaskScheduler::TUESDAY, + Win32::TaskScheduler::WEDNESDAY, + Win32::TaskScheduler::THURSDAY, + Win32::TaskScheduler::FRIDAY, + Win32::TaskScheduler::SATURDAY + ] + end + + def scheduler_months + [ + Win32::TaskScheduler::JANUARY, + Win32::TaskScheduler::FEBRUARY, + Win32::TaskScheduler::MARCH, + Win32::TaskScheduler::APRIL, + Win32::TaskScheduler::MAY, + Win32::TaskScheduler::JUNE, + Win32::TaskScheduler::JULY, + Win32::TaskScheduler::AUGUST, + Win32::TaskScheduler::SEPTEMBER, + Win32::TaskScheduler::OCTOBER, + Win32::TaskScheduler::NOVEMBER, + Win32::TaskScheduler::DECEMBER + ] + end + + def scheduler_occurrences + [ + Win32::TaskScheduler::FIRST_WEEK, + Win32::TaskScheduler::SECOND_WEEK, + Win32::TaskScheduler::THIRD_WEEK, + Win32::TaskScheduler::FOURTH_WEEK, + Win32::TaskScheduler::LAST_WEEK + ] + end + + def day_of_week_constant_to_name(constant) + case constant + when Win32::TaskScheduler::SUNDAY; 'sun' + when Win32::TaskScheduler::MONDAY; 'mon' + when Win32::TaskScheduler::TUESDAY; 'tues' + when Win32::TaskScheduler::WEDNESDAY; 'wed' + when Win32::TaskScheduler::THURSDAY; 'thurs' + when Win32::TaskScheduler::FRIDAY; 'fri' + when Win32::TaskScheduler::SATURDAY; 'sat' + end + end + + def day_of_week_name_to_constant(name) + case name + when 'sun'; Win32::TaskScheduler::SUNDAY + when 'mon'; Win32::TaskScheduler::MONDAY + when 'tues'; Win32::TaskScheduler::TUESDAY + when 'wed'; Win32::TaskScheduler::WEDNESDAY + when 'thurs'; Win32::TaskScheduler::THURSDAY + when 'fri'; Win32::TaskScheduler::FRIDAY + when 'sat'; Win32::TaskScheduler::SATURDAY + end + end + + def month_constant_to_number(constant) + month_num = 1 + while constant >> month_num - 1 > 1 + month_num += 1 + end + month_num + end + + def occurrence_constant_to_name(constant) + case constant + when Win32::TaskScheduler::FIRST_WEEK; 'first' + when Win32::TaskScheduler::SECOND_WEEK; 'second' + when Win32::TaskScheduler::THIRD_WEEK; 'third' + when Win32::TaskScheduler::FOURTH_WEEK; 'fourth' + when Win32::TaskScheduler::LAST_WEEK; 'last' + end + end + + def occurrence_name_to_constant(name) + case name + when 'first'; Win32::TaskScheduler::FIRST_WEEK + when 'second'; Win32::TaskScheduler::SECOND_WEEK + when 'third'; Win32::TaskScheduler::THIRD_WEEK + when 'fourth'; Win32::TaskScheduler::FOURTH_WEEK + when 'last'; Win32::TaskScheduler::LAST_WEEK + end + end +end diff -Nru puppet-2.7.6/lib/puppet/provider/service/base.rb puppet-2.7.9/lib/puppet/provider/service/base.rb --- puppet-2.7.6/lib/puppet/provider/service/base.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/base.rb 2011-12-08 22:58:09.000000000 +0000 @@ -4,8 +4,8 @@ You have to specify enough about your service for this to work; the minimum you can specify is a binary for starting the process, and this same binary will be searched for in the process table to stop the - service. It is preferable to specify start, stop, and status commands, - akin to how you would do so using `init`. + service. As with `init`-style services, it is preferable to specify start, + stop, and status commands. " diff -Nru puppet-2.7.6/lib/puppet/provider/service/bsd.rb puppet-2.7.9/lib/puppet/provider/service/bsd.rb --- puppet-2.7.6/lib/puppet/provider/service/bsd.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/bsd.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,10 +1,11 @@ # Manage FreeBSD services. Puppet::Type.type(:service).provide :bsd, :parent => :init do - desc "FreeBSD's (and probably NetBSD?) form of `init`-style service management. + desc <<-EOT + FreeBSD's (and probably NetBSD's?) form of `init`-style service management. - Uses `rc.conf.d` for service enabling and disabling. + Uses `rc.conf.d` for service enabling and disabling. -" + EOT confine :operatingsystem => [:freebsd, :netbsd, :openbsd] diff -Nru puppet-2.7.6/lib/puppet/provider/service/daemontools.rb puppet-2.7.9/lib/puppet/provider/service/daemontools.rb --- puppet-2.7.6/lib/puppet/provider/service/daemontools.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/daemontools.rb 2011-12-08 22:58:09.000000000 +0000 @@ -2,42 +2,42 @@ # # author Brice Figureau Puppet::Type.type(:service).provide :daemontools, :parent => :base do - desc "Daemontools service management. + desc <<-EOT + Daemontools service management. - This provider manages daemons running supervised by D.J.Bernstein daemontools. - It tries to detect the service directory, with by order of preference: + This provider manages daemons supervised by D.J. Bernstein daemontools. + When detecting the service directory it will check, in order of preference: - * /service - * /etc/service - * /var/lib/svscan + * `/service` + * `/etc/service` + * `/var/lib/svscan` - The daemon directory should be placed in a directory that can be - by default in: + The daemon directory should be in one of the following locations: - * /var/lib/service - * /etc + * `/var/lib/service` + * `/etc` - or this can be overriden in the service resource parameters:: + ...or this can be overriden in the resource's attributes: - service { \"myservice\": - provider => \"daemontools\", - path => \"/path/to/daemons\", - } + service { "myservice": + provider => "daemontools", + path => "/path/to/daemons", + } - This provider supports out of the box: + This provider supports out of the box: - * start/stop (mapped to enable/disable) - * enable/disable - * restart - * status + * start/stop (mapped to enable/disable) + * enable/disable + * restart + * status - If a service has `ensure => \"running\"`, it will link /path/to/daemon to - /path/to/service, which will automatically enable the service. + If a service has `ensure => "running"`, it will link /path/to/daemon to + /path/to/service, which will automatically enable the service. - If a service has `ensure => \"stopped\"`, it will only down the service, not - remove the /path/to/service link. + If a service has `ensure => "stopped"`, it will only shut down the service, not + remove the `/path/to/service` link. - " + EOT commands :svc => "/usr/bin/svc", :svstat => "/usr/bin/svstat" diff -Nru puppet-2.7.6/lib/puppet/provider/service/debian.rb puppet-2.7.9/lib/puppet/provider/service/debian.rb --- puppet-2.7.6/lib/puppet/provider/service/debian.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/debian.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,12 +1,14 @@ # Manage debian services. Start/stop is the same as InitSvc, but enable/disable # is special. Puppet::Type.type(:service).provide :debian, :parent => :init do - desc "Debian's form of `init`-style management. + desc <<-EOT + Debian's form of `init`-style management. - The only difference is that this supports service enabling and disabling - via `update-rc.d` and determines enabled status via `invoke-rc.d`. + The only differences from `init` are support for enabling and disabling + services via `update-rc.d` and the ability to determine enabled status via + `invoke-rc.d`. - " + EOT commands :update_rc => "/usr/sbin/update-rc.d" # note this isn't being used as a command until diff -Nru puppet-2.7.6/lib/puppet/provider/service/freebsd.rb puppet-2.7.9/lib/puppet/provider/service/freebsd.rb --- puppet-2.7.6/lib/puppet/provider/service/freebsd.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/freebsd.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,6 +1,6 @@ Puppet::Type.type(:service).provide :freebsd, :parent => :init do - desc "Provider for FreeBSD. Makes use of rcvar argument of init scripts and parses/edits rc files." + desc "Provider for FreeBSD. Uses the `rcvar` argument of init scripts and parses/edits rc files." confine :operatingsystem => [:freebsd] defaultfor :operatingsystem => [:freebsd] diff -Nru puppet-2.7.6/lib/puppet/provider/service/gentoo.rb puppet-2.7.9/lib/puppet/provider/service/gentoo.rb --- puppet-2.7.6/lib/puppet/provider/service/gentoo.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/gentoo.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,11 +1,12 @@ # Manage gentoo services. Start/stop is the same as InitSvc, but enable/disable # is special. Puppet::Type.type(:service).provide :gentoo, :parent => :init do - desc "Gentoo's form of `init`-style service management. + desc <<-EOT + Gentoo's form of `init`-style service management. - Uses `rc-update` for service enabling and disabling. + Uses `rc-update` for service enabling and disabling. - " + EOT commands :update => "/sbin/rc-update" diff -Nru puppet-2.7.6/lib/puppet/provider/service/init.rb puppet-2.7.9/lib/puppet/provider/service/init.rb --- puppet-2.7.6/lib/puppet/provider/service/init.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/init.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,14 +1,7 @@ # The standard init-based service type. Many other service types are # customizations of this module. Puppet::Type.type(:service).provide :init, :parent => :base do - desc "Standard init service management. - - This provider assumes that the init script has no `status` command, - because so few scripts do, so you need to either provide a status - command or specify via `hasstatus` that one already exists in the - init script. - -" + desc "Standard `init`-style service management." class << self attr_accessor :defpath @@ -19,6 +12,8 @@ @defpath = ["/etc/rc.d", "/usr/local/etc/rc.d"] when "HP-UX" @defpath = "/sbin/init.d" + when "Archlinux" + @defpath = "/etc/rc.d" else @defpath = "/etc/init.d" end diff -Nru puppet-2.7.6/lib/puppet/provider/service/launchd.rb puppet-2.7.9/lib/puppet/provider/service/launchd.rb --- puppet-2.7.6/lib/puppet/provider/service/launchd.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/launchd.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,114 +1,167 @@ require 'facter/util/plist' - Puppet::Type.type(:service).provide :launchd, :parent => :base do - desc "launchd service management framework. + desc <<-EOT + This provider manages jobs with `launchd`, which is the default service + framework for Mac OS X (and may be available for use on other platforms). - This provider manages jobs with launchd, which is the default service framework for - Mac OS X and is potentially available for use on other platforms. + For `launchd` documentation, see: - See: - - * http://developer.apple.com/macosx/launchd.html - * http://launchd.macosforge.org/ + * + * - This provider reads plists out of the following directories: - - * /System/Library/LaunchDaemons - * /System/Library/LaunchAgents - * /Library/LaunchDaemons - * /Library/LaunchAgents + This provider reads plists out of the following directories: - ...and builds up a list of services based upon each plist's \"Label\" entry. + * `/System/Library/LaunchDaemons` + * `/System/Library/LaunchAgents` + * `/Library/LaunchDaemons` + * `/Library/LaunchAgents` - This provider supports: - - * ensure => running/stopped, - * enable => true/false - * status - * restart + ...and builds up a list of services based upon each plist's "Label" entry. - Here is how the Puppet states correspond to launchd states: - - * stopped --- job unloaded - * started --- job loaded - * enabled --- 'Disable' removed from job plist file - * disabled --- 'Disable' added to job plist file + This provider supports: + + * ensure => running/stopped, + * enable => true/false + * status + * restart + + Here is how the Puppet states correspond to `launchd` states: + + * stopped --- job unloaded + * started --- job loaded + * enabled --- 'Disable' removed from job plist file + * disabled --- 'Disable' added to job plist file - Note that this allows you to do something launchctl can't do, which is to - be in a state of \"stopped/enabled\ or \"running/disabled\". + Note that this allows you to do something `launchctl` can't do, which is to + be in a state of "stopped/enabled" or "running/disabled". - " + EOT + + include Puppet::Util::Warnings commands :launchctl => "/bin/launchctl" - commands :sw_vers => "/usr/bin/sw_vers" - commands :plutil => "/usr/bin/plutil" + commands :sw_vers => "/usr/bin/sw_vers" + commands :plutil => "/usr/bin/plutil" defaultfor :operatingsystem => :darwin - confine :operatingsystem => :darwin + confine :operatingsystem => :darwin has_feature :enableable + mk_resource_methods - Launchd_Paths = ["/Library/LaunchAgents", - "/Library/LaunchDaemons", - "/System/Library/LaunchAgents", - "/System/Library/LaunchDaemons",] + Launchd_Paths = [ "/Library/LaunchAgents", + "/Library/LaunchDaemons", + "/System/Library/LaunchAgents", + "/System/Library/LaunchDaemons"] Launchd_Overrides = "/var/db/launchd.db/com.apple.launchd/overrides.plist" + + # Caching is enabled through the following three methods. Self.prefetch will + # call self.instances to create an instance for each service. Self.flush will + # clear out our cache when we're done. + def self.prefetch(resources) + instances.each do |prov| + if resource = resources[prov.name] + resource.provider = prov + end + end + end - - # Read a plist, whether its format is XML or in Apple's "binary1" - # format. - def self.read_plist(path) - Plist::parse_xml(plutil('-convert', 'xml1', '-o', '/dev/stdout', path)) + # Self.instances will return an array with each element being a hash + # containing the name, provider, path, and status of each service on the + # system. + def self.instances + jobs = self.jobsearch + @job_list ||= self.job_list + jobs.keys.collect do |job| + job_status = @job_list.has_key?(job) ? :running : :stopped + new(:name => job, :provider => :launchd, :path => jobs[job], :status => job_status) + end end - # returns a label => path map for either all jobs, or just a single - # job if the label is specified + # Sets a class instance variable with a hash of all launchd plist files that + # are found on the system. The key of the hash is the job id and the value + # is the path to the file. If a label is passed, we return the job id and + # path for that specific job. def self.jobsearch(label=nil) - label_to_path_map = {} - Launchd_Paths.each do |path| - if FileTest.exists?(path) - Dir.entries(path).each do |f| - next if f =~ /^\..*$/ - next if FileTest.directory?(f) - fullpath = File.join(path, f) - if FileTest.file?(fullpath) and job = read_plist(fullpath) and job.has_key?("Label") - if job["Label"] == label - return { label => fullpath } - else - label_to_path_map[job["Label"]] = fullpath - end + @label_to_path_map ||= {} + if @label_to_path_map.empty? + Launchd_Paths.each do |path| + Dir.glob(File.join(path,'*')).each do |filepath| + next if ! File.file?(filepath) + job = read_plist(filepath) + if job.has_key?("Label") and job["Label"] == label + return { label => filepath } + else + @label_to_path_map[job["Label"]] = filepath end end end end - # if we didn't find the job above and we should have, error. - raise Puppet::Error.new("Unable to find launchd plist for job: #{label}") if label - # if returning all jobs - label_to_path_map + if label + if @label_to_path_map.has_key? label + return { label => @label_to_path_map[label] } + else + raise Puppet::Error.new("Unable to find launchd plist for job: #{label}") + end + else + @label_to_path_map + end end - - def self.instances - jobs = self.jobsearch - jobs.keys.collect do |job| - new(:name => job, :provider => :launchd, :path => jobs[job]) + # This status method lists out all currently running services. + # This hash is returned at the end of the method. + def self.job_list + @job_list = Hash.new + begin + output = launchctl :list + raise Puppet::Error.new("launchctl list failed to return any data.") if output.nil? + output.split("\n").each do |line| + @job_list[line.split(/\s/).last] = :running + end + rescue Puppet::ExecutionFailure + raise Puppet::Error.new("Unable to determine status of #{resource[:name]}") end + @job_list + end + + # Launchd implemented plist overrides in version 10.6. + # This method checks the major_version of OS X and returns true if + # it is 10.6 or greater. This allows us to implement different plist + # behavior for versions >= 10.6 + def has_macosx_plist_overrides? + @product_version ||= self.class.get_macosx_version_major + return true unless /^10\.[0-5]/.match(@product_version) + return false end + # Read a plist, whether its format is XML or in Apple's "binary1" + # format. + def self.read_plist(path) + Plist::parse_xml(plutil('-convert', 'xml1', '-o', '/dev/stdout', path)) + end + + # Clean out the @property_hash variable containing the cached list of services + def flush + @property_hash.clear + end + + def exists? + Puppet.debug("Puppet::Provider::Launchd:Ensure for #{@property_hash[:name]}: #{@property_hash[:ensure]}") + @property_hash[:ensure] != :absent + end def self.get_macosx_version_major - return @macosx_version_major if defined?(@macosx_version_major) + return @macosx_version_major if @macosx_version_major begin # Make sure we've loaded all of the facts Facter.loadfacts - if Facter.value(:macosx_productversion_major) product_version_major = Facter.value(:macosx_productversion_major) else # TODO: remove this code chunk once we require Facter 1.5.5 or higher. - Puppet.warning("DEPRECATION WARNING: Future versions of the launchd provider will require Facter 1.5.5 or newer.") + warnonce("DEPRECATION WARNING: Future versions of the launchd provider will require Facter 1.5.5 or newer.") product_version = Facter.value(:macosx_productversion) fail("Could not determine OS X version from Facter") if product_version.nil? product_version_major = product_version.scan(/(\d+)\.(\d+)./).join(".") @@ -135,26 +188,6 @@ [job_path, job_plist] end - - def status - # launchctl list exits zero if the job is loaded - # and non-zero if it isn't. Simple way to check... but is only - # available on OS X 10.5 unfortunately, so we grab the whole list - # and check if our resource is included. The output formats differ - # between 10.4 and 10.5, thus the necessity for splitting - begin - output = launchctl :list - raise Puppet::Error.new("launchctl list failed to return any data.") if output.nil? - output.split("\n").each do |j| - return :running if j.split(/\s/).last == resource[:name] - end - return :stopped - rescue Puppet::ExecutionFailure - raise Puppet::Error.new("Unable to determine status of #{resource[:name]}") - end - end - - # start the service. To get to a state of running/enabled, we need to # conditionally enable at load, then disable by modifying the plist file # directly. @@ -200,8 +233,8 @@ # launchd jobs are enabled by default. They are only disabled if the key # "Disabled" is set to true, but it can also be set to false to enable it. - # In 10.6, the Disabled key in the job plist is consulted, but only if there - # is no entry in the global overrides plist. + # Starting in 10.6, the Disabled key in the job plist is consulted, but only + # if there is no entry in the global overrides plist. # We need to draw a distinction between undefined, true and false for both # locations where the Disabled flag can be defined. def enabled? @@ -211,7 +244,7 @@ job_path, job_plist = plist_from_label(resource[:name]) job_plist_disabled = job_plist["Disabled"] if job_plist.has_key?("Disabled") - if self.class.get_macosx_version_major == "10.6" + if has_macosx_plist_overrides? if FileTest.file?(Launchd_Overrides) and overrides = self.class.read_plist(Launchd_Overrides) if overrides.has_key?(resource[:name]) overrides_disabled = overrides[resource[:name]]["Disabled"] if overrides[resource[:name]].has_key?("Disabled") @@ -233,10 +266,10 @@ # enable and disable are a bit hacky. We write out the plist with the appropriate value # rather than dealing with launchctl as it is unable to change the Disabled flag # without actually loading/unloading the job. - # In 10.6 we need to write out a disabled key to the global overrides plist, in earlier - # versions this is stored in the job plist itself. + # Starting in 10.6 we need to write out a disabled key to the global + # overrides plist, in earlier versions this is stored in the job plist itself. def enable - if self.class.get_macosx_version_major == "10.6" + if has_macosx_plist_overrides? overrides = self.class.read_plist(Launchd_Overrides) overrides[resource[:name]] = { "Disabled" => false } Plist::Emit.save_plist(overrides, Launchd_Overrides) @@ -251,7 +284,7 @@ def disable - if self.class.get_macosx_version_major == "10.6" + if has_macosx_plist_overrides? overrides = self.class.read_plist(Launchd_Overrides) overrides[resource[:name]] = { "Disabled" => true } Plist::Emit.save_plist(overrides, Launchd_Overrides) diff -Nru puppet-2.7.6/lib/puppet/provider/service/redhat.rb puppet-2.7.9/lib/puppet/provider/service/redhat.rb --- puppet-2.7.6/lib/puppet/provider/service/redhat.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/redhat.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,9 +1,8 @@ # Manage Red Hat services. Start/stop uses /sbin/service and enable/disable uses chkconfig Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init do - desc "Red Hat's (and probably many others) form of `init`-style service management: - - Uses `chkconfig` for service enabling and disabling. + desc "Red Hat's (and probably many others') form of `init`-style service + management. Uses `chkconfig` for service enabling and disabling. " diff -Nru puppet-2.7.6/lib/puppet/provider/service/runit.rb puppet-2.7.9/lib/puppet/provider/service/runit.rb --- puppet-2.7.6/lib/puppet/provider/service/runit.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/runit.rb 2011-12-08 22:58:09.000000000 +0000 @@ -2,36 +2,36 @@ # # author Brice Figureau Puppet::Type.type(:service).provide :runit, :parent => :daemontools do - desc "Runit service management. + desc <<-EOT + Runit service management. - This provider manages daemons running supervised by Runit. - It tries to detect the service directory, with by order of preference: + This provider manages daemons running supervised by Runit. + When detecting the service directory it will check, in order of preference: - * /service - * /var/service - * /etc/service + * `/service` + * `/var/service` + * `/etc/service` - The daemon directory should be placed in a directory that can be - by default in: + The daemon directory should be in one of the following locations: - * /etc/sv + * `/etc/sv` - or this can be overriden in the service resource parameters:: + or this can be overriden in the service resource parameters:: - service { \"myservice\": - provider => \"runit\", - path => \"/path/to/daemons\", - } + service { "myservice": + provider => "runit", + path => "/path/to/daemons", + } - This provider supports out of the box: + This provider supports out of the box: - * start/stop - * enable/disable - * restart - * status + * start/stop + * enable/disable + * restart + * status -" + EOT commands :sv => "/usr/bin/sv" diff -Nru puppet-2.7.6/lib/puppet/provider/service/smf.rb puppet-2.7.9/lib/puppet/provider/service/smf.rb --- puppet-2.7.6/lib/puppet/provider/service/smf.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/smf.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,15 +1,16 @@ # Solaris 10 SMF-style services. Puppet::Type.type(:service).provide :smf, :parent => :base do - desc "Support for Sun's new Service Management Framework. + desc <<-EOT + Support for Sun's new Service Management Framework. - Starting a service is effectively equivalent to enabling it, so there is - only support for starting and stopping services, which also enables and - disables them, respectively. + Starting a service is effectively equivalent to enabling it, so there is + only support for starting and stopping services, which also enables and + disables them, respectively. - By specifying manifest => \"/path/to/service.xml\", the SMF manifest will - be imported if it does not exist. + By specifying `manifest => "/path/to/service.xml"`, the SMF manifest will + be imported if it does not exist. - " + EOT defaultfor :operatingsystem => :solaris diff -Nru puppet-2.7.6/lib/puppet/provider/service/src.rb puppet-2.7.9/lib/puppet/provider/service/src.rb --- puppet-2.7.6/lib/puppet/provider/service/src.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/src.rb 2011-12-08 22:58:09.000000000 +0000 @@ -3,13 +3,12 @@ desc "Support for AIX's System Resource controller. - Services are started/stopped based on the stopsrc and startsrc - commands, and some services can be refreshed with refresh command. + Services are started/stopped based on the `stopsrc` and `startsrc` + commands, and some services can be refreshed with `refresh` command. - * Enabling and disableing services is not supported, as it requires - modifications to /etc/inittab. - - * Starting and stopping groups of subsystems is not yet supported + Enabling and disabling services is not supported, as it requires + modifications to `/etc/inittab`. Starting and stopping groups of subsystems + is not yet supported. " defaultfor :operatingsystem => :aix diff -Nru puppet-2.7.6/lib/puppet/provider/service/systemd.rb puppet-2.7.9/lib/puppet/provider/service/systemd.rb --- puppet-2.7.6/lib/puppet/provider/service/systemd.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/systemd.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,7 +1,7 @@ # Manage systemd services using /bin/systemctl Puppet::Type.type(:service).provide :systemd, :parent => :base do - desc "Manage systemd services using /bin/systemctl" + desc "Manages `systemd` services using `/bin/systemctl`." commands :systemctl => "/bin/systemctl" diff -Nru puppet-2.7.6/lib/puppet/provider/service/upstart.rb puppet-2.7.9/lib/puppet/provider/service/upstart.rb --- puppet-2.7.6/lib/puppet/provider/service/upstart.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/upstart.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,10 +1,8 @@ Puppet::Type.type(:service).provide :upstart, :parent => :init do - desc "Ubuntu service manager upstart. + desc "Ubuntu service management with `upstart`. - This provider manages upstart jobs which have replaced initd. - - See: - * http://upstart.ubuntu.com/ + This provider manages `upstart` jobs, which have replaced `initd` services + on Ubuntu. For `upstart` documentation, see . " # confine to :ubuntu for now because I haven't tested on other platforms confine :operatingsystem => :ubuntu #[:ubuntu, :fedora, :debian] diff -Nru puppet-2.7.6/lib/puppet/provider/service/windows.rb puppet-2.7.9/lib/puppet/provider/service/windows.rb --- puppet-2.7.6/lib/puppet/provider/service/windows.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/service/windows.rb 2011-12-08 22:58:09.000000000 +0000 @@ -4,16 +4,16 @@ Puppet::Type.type(:service).provide :windows do - desc "Support for Windows Service Control Manager (SCM). + desc <<-EOT + Support for Windows Service Control Manager (SCM). - Services are controlled according to win32-service gem. - - * All SCM operations (start/stop/enable/disable/query) are supported. - - * Control of service groups (dependencies) is not yet supported." + Services are controlled according to the capabilities of the `win32-service` + gem. All SCM operations (start/stop/enable/disable/query) are supported. + Control of service groups (dependencies) is not yet supported. + EOT defaultfor :operatingsystem => :windows - confine :operatingsystem => :windows + confine :operatingsystem => :windows has_feature :refreshable diff -Nru puppet-2.7.6/lib/puppet/provider/sshkey/parsed.rb puppet-2.7.9/lib/puppet/provider/sshkey/parsed.rb --- puppet-2.7.6/lib/puppet/provider/sshkey/parsed.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/sshkey/parsed.rb 2011-12-08 22:58:09.000000000 +0000 @@ -8,11 +8,10 @@ end - Puppet::Type.type(:sshkey).provide( - :parsed, +Puppet::Type.type(:sshkey).provide( + :parsed, :parent => Puppet::Provider::ParsedFile, :default_target => known, - :filetype => :flat ) do desc "Parse and generate host-wide known hosts files for SSH." diff -Nru puppet-2.7.6/lib/puppet/provider/user/aix.rb puppet-2.7.9/lib/puppet/provider/user/aix.rb --- puppet-2.7.6/lib/puppet/provider/user/aix.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/user/aix.rb 2011-12-08 22:58:09.000000000 +0000 @@ -17,7 +17,7 @@ require 'date' Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do - desc "User management for AIX! Users are managed with mkuser, rmuser, chuser, lsuser" + desc "User management for AIX." # This will the the default provider for this platform defaultfor :operatingsystem => :aix @@ -28,7 +28,7 @@ commands :add => "/usr/bin/mkuser" commands :delete => "/usr/sbin/rmuser" commands :modify => "/usr/bin/chuser" - + commands :lsgroup => "/usr/sbin/lsgroup" commands :chpasswd => "/bin/chpasswd" @@ -52,7 +52,7 @@ end # AIX attributes to properties mapping. - # + # # Valid attributes to be managed by this provider. # It is a list with of hash # :aix_attr AIX command attribute name @@ -73,10 +73,10 @@ {:aix_attr => :minage, :puppet_prop => :password_min_age}, {:aix_attr => :attributes, :puppet_prop => :attributes}, ] - + #-------------- # Command definition - + # Return the IA module arguments based on the resource param ia_load_module def get_ia_module_args if @resource[:ia_load_module] @@ -85,7 +85,7 @@ [] end end - + # List groups and Ids def lsgroupscmd(value=@resource[:name]) [command(:lsgroup)] + @@ -116,7 +116,7 @@ def modifycmd(hash = property_hash) args = self.hash2args(hash) return nil if args.empty? - + [self.class.command(:modify)] + self.get_ia_module_args + args + [@resource[:name]] end @@ -131,9 +131,9 @@ super # Reset the password if needed self.password = @resource[:password] if @resource[:password] - end + end + - def get_arguments(key, value, mapping, objectinfo) # In the case of attributes, return a list of key=vlaue if key == :attributes @@ -141,10 +141,10 @@ unless value and value.is_a? Hash return value.select { |k,v| true }.map { |pair| pair.join("=") } end - + super(key, value, mapping, objectinfo) end - + # Get the groupname from its id def self.groupname_by_id(gid) groupname=nil @@ -165,16 +165,16 @@ # Check that a group exists and is valid def verify_group(value) - if value.is_a? Integer or value.is_a? Fixnum + if value.is_a? Integer or value.is_a? Fixnum groupname = self.groupname_by_id(value) raise ArgumentError, "AIX group must be a valid existing group" unless groupname - else + else raise ArgumentError, "AIX group must be a valid existing group" unless groupid_by_name(value) groupname = value end groupname end - + # The user's primary group. Can be specified numerically or by name. def gid_to_attr(value) verify_group(value) @@ -186,7 +186,7 @@ end # The expiry date for this user. Must be provided in - # a zero padded YYYY-MM-DD HH:MM format + # a zero padded YYYY-MM-DD HH:MM format def expiry_to_attr(value) # For chuser the expires parameter is a 10-character string in the MMDDhhmmyy format # that is,"%m%d%H%M%y" @@ -197,7 +197,7 @@ end newdate end - + def expiry_from_attr(value) if value =~ /(..)(..)(..)(..)(..)/ #d= DateTime.parse("20#{$5}-#{$1}-#{$2} #{$3}:#{$4}") @@ -233,7 +233,7 @@ if ! f.eof? f.each { |l| # If there is a new user stanza, stop - break if l =~ /^\S*:\s*$/ + break if l =~ /^\S*:\s*$/ # If the password= entry is found, return it if l =~ /^\s*password\s*=\s*(.*)$/ password = $1; break; @@ -242,11 +242,11 @@ end f.close() return password - end + end def password=(value) user = @resource[:name] - + # Puppet execute does not support strings as input, only files. tmpfile = Tempfile.new('puppet_#{user}_pw') tmpfile << "#{user}:#{value}\n" @@ -264,7 +264,7 @@ ensure tmpfile.delete() end - end + end def filter_attributes(hash) # Return only not managed attributtes. @@ -284,7 +284,7 @@ #self.class.validate(param, value) param = :attributes cmd = modifycmd({param => filter_attributes(attr_hash)}) - if cmd + if cmd begin execute(cmd) rescue Puppet::ExecutionFailure => detail diff -Nru puppet-2.7.6/lib/puppet/provider/user/hpux.rb puppet-2.7.9/lib/puppet/provider/user/hpux.rb --- puppet-2.7.6/lib/puppet/provider/user/hpux.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/user/hpux.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,5 +1,7 @@ Puppet::Type.type(:user).provide :hpuxuseradd, :parent => :useradd do - desc "User management for hp-ux! Undocumented switch to special usermod because HP-UX regular usermod is TOO STUPID to change stuff while the user is logged in." + desc "User management for HP-UX. This provider uses the undocumented `-F` + switch to HP-UX's special `usermod` binary to work around the fact that + its standard `usermod` cannot make changes while the user is logged in." defaultfor :operatingsystem => "hp-ux" confine :operatingsystem => "hp-ux" diff -Nru puppet-2.7.6/lib/puppet/provider/user/ldap.rb puppet-2.7.9/lib/puppet/provider/user/ldap.rb --- puppet-2.7.6/lib/puppet/provider/user/ldap.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/user/ldap.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,16 +1,16 @@ require 'puppet/provider/ldap' Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do - desc "User management via `ldap`. This provider requires that you - have valid values for all of the ldap-related settings, - including `ldapbase`. You will also almost definitely need settings - for `ldapuser` and `ldappassword`, so that your clients can write - to ldap. + desc "User management via LDAP. + + This provider requires that you have valid values for all of the + LDAP-related settings in `puppet.conf`, including `ldapbase`. You will + almost definitely need settings for `ldapuser` and `ldappassword` in order + for your clients to write to LDAP. Note that this provider will automatically generate a UID for you if you do not specify one, but it is a potentially expensive operation, - as it iterates across all existing users to pick the appropriate next - one." + as it iterates across all existing users to pick the appropriate next one." confine :feature => :ldap, :false => (Puppet[:ldapuser] == "") diff -Nru puppet-2.7.6/lib/puppet/provider/user/useradd.rb puppet-2.7.9/lib/puppet/provider/user/useradd.rb --- puppet-2.7.6/lib/puppet/provider/user/useradd.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/user/useradd.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,7 +1,9 @@ require 'puppet/provider/nameservice/objectadd' Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameService::ObjectAdd do - desc "User management via `useradd` and its ilk. Note that you will need to install the `Shadow Password` Ruby library often known as ruby-libshadow to manage user passwords." + desc "User management via `useradd` and its ilk. Note that you will need to + install Ruby's shadow password library (often known as `ruby-libshadow`) + if you wish to manage user passwords." commands :add => "useradd", :delete => "userdel", :modify => "usermod", :password => "chage" diff -Nru puppet-2.7.6/lib/puppet/provider/user/user_role_add.rb puppet-2.7.9/lib/puppet/provider/user/user_role_add.rb --- puppet-2.7.6/lib/puppet/provider/user/user_role_add.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/user/user_role_add.rb 2011-12-08 22:58:09.000000000 +0000 @@ -2,7 +2,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source => :useradd do - desc "User management inherits `useradd` and adds logic to manage roles on Solaris using roleadd." + desc "User and role management on Solaris, via `useradd` and `roleadd`." defaultfor :operatingsystem => :solaris @@ -168,25 +168,29 @@ #Smooth like 80 grit def password=(cryptopw) begin - File.open("/etc/shadow", "r") do |shadow| - File.open("/etc/shadow_tmp", "w", 0600) do |shadow_tmp| + File.open(shadow_file, "r") do |shadow| + File.open("#{shadow_file}_tmp", "w", 0600) do |shadow_tmp| while line = shadow.gets line_arr = line.split(':') if line_arr[0] == @resource[:name] line_arr[1] = cryptopw + line_arr[2] = Time.now().to_i / 86400 line = line_arr.join(':') end shadow_tmp.print line end end end - File.rename("/etc/shadow_tmp", "/etc/shadow") + File.rename("#{shadow_file}_tmp", shadow_file) rescue => detail fail "Could not write temporary shadow file: #{detail}" ensure # Make sure this *always* gets deleted - File.unlink("/etc/shadow_tmp") if File.exist?("/etc/shadow_tmp") + File.unlink("#{shadow_file}_tmp") if File.exist?("#{shadow_file}_tmp") end end -end + private + + def shadow_file; '/etc/shadow'; end +end diff -Nru puppet-2.7.6/lib/puppet/provider/user/windows_adsi.rb puppet-2.7.9/lib/puppet/provider/user/windows_adsi.rb --- puppet-2.7.6/lib/puppet/provider/user/windows_adsi.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/provider/user/windows_adsi.rb 2011-12-08 22:58:09.000000000 +0000 @@ -1,11 +1,10 @@ require 'puppet/util/adsi' Puppet::Type.type(:user).provide :windows_adsi do - desc "User management for Windows" + desc "User management for Windows." defaultfor :operatingsystem => :windows - confine :operatingsystem => :windows - confine :feature => :microsoft_windows + confine :operatingsystem => :windows has_features :manages_homedir, :manages_passwords @@ -23,6 +22,8 @@ def create @user = Puppet::Util::ADSI::User.create(@resource[:name]) + @user.commit + [:comment, :home, :groups].each do |prop| send("#{prop}=", @resource[prop]) if @resource[prop] end diff -Nru puppet-2.7.6/lib/puppet/rb_tree_map.rb puppet-2.7.9/lib/puppet/rb_tree_map.rb --- puppet-2.7.6/lib/puppet/rb_tree_map.rb 1970-01-01 00:00:00.000000000 +0000 +++ puppet-2.7.9/lib/puppet/rb_tree_map.rb 2011-12-08 22:58:09.000000000 +0000 @@ -0,0 +1,388 @@ +# Algorithms and Containers project is Copyright (c) 2009 Kanwei Li +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the 'Software'), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# A RbTreeMap is a map that is stored in sorted order based on the order of its keys. This ordering is +# determined by applying the function <=> to compare the keys. No duplicate values for keys are allowed, +# so duplicate values are overwritten. +# +# A major advantage of RBTreeMap over a Hash is the fact that keys are stored in order and can thus be +# iterated over in order. This is useful for many datasets. +# +# The implementation is adapted from Robert Sedgewick's Left Leaning Red-Black Tree implementation, +# which can be found at http://www.cs.princeton.edu/~rs/talks/LLRB/Java/RedBlackBST.java +# +# Most methods have O(log n) complexity. + +class Puppet::RbTreeMap + include Enumerable + + attr_reader :size + + alias_method :length, :size + + # Create and initialize a new empty TreeMap. + def initialize + @root = nil + @size = 0 + end + + # Insert an item with an associated key into the TreeMap, and returns the item inserted + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") #=> "Massachusetts" + # map.get("MA") #=> "Massachusetts" + def push(key, value) + @root = insert(@root, key, value) + @root.color = :black + value + end + alias_method :[]=, :push + + # Return true if key is found in the TreeMap, false otherwise + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") + # map.push("GA", "Georgia") + # map.has_key?("GA") #=> true + # map.has_key?("DE") #=> false + def has_key?(key) + !get_recursive(@root, key).nil? + end + + # Return the item associated with the key, or nil if none found. + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") + # map.push("GA", "Georgia") + # map.get("GA") #=> "Georgia" + def get(key) + node = get_recursive(@root, key) + node ? node.value : nil + node.value if node + end + alias_method :[], :get + + # Return the smallest key in the map. + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") + # map.push("GA", "Georgia") + # map.min_key #=> "GA" + def min_key + @root.nil? ? nil : min_recursive(@root).key + end + + # Return the largest key in the map. + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") + # map.push("GA", "Georgia") + # map.max_key #=> "MA" + def max_key + @root.nil? ? nil : max_recursive(@root).key + end + + # Deletes the item and key if it's found, and returns the item. Returns nil + # if key is not present. + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") + # map.push("GA", "Georgia") + # map.delete("MA") #=> "Massachusetts" + def delete(key) + result = nil + if @root + return unless has_key? key + @root, result = delete_recursive(@root, key) + @root.color = :black if @root + @size -= 1 + end + result + end + + # Returns true if the tree is empty, false otherwise + def empty? + @root.nil? + end + + # Deletes the item with the smallest key and returns the item. Returns nil + # if key is not present. + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") + # map.push("GA", "Georgia") + # map.delete_min #=> "Massachusetts" + # map.size #=> 1 + def delete_min + result = nil + if @root + @root, result = delete_min_recursive(@root) + @root.color = :black if @root + @size -= 1 + end + result + end + + # Deletes the item with the largest key and returns the item. Returns nil + # if key is not present. + # + # Complexity: O(log n) + # + # map = Containers::TreeMap.new + # map.push("MA", "Massachusetts") + # map.push("GA", "Georgia") + # map.delete_max #=> "Georgia" + # map.size #=> 1 + def delete_max + result = nil + if @root + @root, result = delete_max_recursive(@root) + @root.color = :black if @root + @size -= 1 + end + result + end + + # Yields [key, value] pairs in order by key. + def each(&blk) + recursive_yield(@root, &blk) + end + + def first + return nil unless @root + node = min_recursive(@root) + [node.key, node.value] + end + + def last + return nil unless @root + node = max_recursive(@root) + [node.key, node.value] + end + + def to_hash + @root ? @root.to_hash : {} + end + + class Node # :nodoc: all + attr_accessor :color, :key, :value, :left, :right + def initialize(key, value) + @key = key + @value = value + @color = :red + @left = nil + @right = nil + end + + def to_hash + h = { + :node => { + :key => @key, + :value => @value, + :color => @color, + } + } + h.merge!(:left => left.to_hash) if @left + h.merge!(:right => right.to_hash) if @right + h + end + + def red? + @color == :red + end + + def colorflip + @color = @color == :red ? :black : :red + @left.color = @left.color == :red ? :black : :red + @right.color = @right.color == :red ? :black : :red + end + + def rotate_left + r = @right + r_key, r_value, r_color = r.key, r.value, r.color + b = r.left + r.left = @left + @left = r + @right = r.right + r.right = b + r.color, r.key, r.value = :red, @key, @value + @key, @value = r_key, r_value + self + end + + def rotate_right + l = @left + l_key, l_value, l_color = l.key, l.value, l.color + b = l.right + l.right = @right + @right = l + @left = l.left + l.left = b + l.color, l.key, l.value = :red, @key, @value + @key, @value = l_key, l_value + self + end + + def move_red_left + colorflip + if (@right.left && @right.left.red?) + @right.rotate_right + rotate_left + colorflip + end + self + end + + def move_red_right + colorflip + if (@left.left && @left.left.red?) + rotate_right + colorflip + end + self + end + + def fixup + rotate_left if @right && @right.red? + rotate_right if (@left && @left.red?) && (@left.left && @left.left.red?) + colorflip if (@left && @left.red?) && (@right && @right.red?) + + self + end + end + + private + + def recursive_yield(node, &blk) + return unless node + recursive_yield(node.left, &blk) + yield node.key, node.value + recursive_yield(node.right, &blk) + end + + def delete_recursive(node, key) + if (key <=> node.key) == -1 + node.move_red_left if ( !isred(node.left) && !isred(node.left.left) ) + node.left, result = delete_recursive(node.left, key) + else + node.rotate_right if isred(node.left) + if ( ( (key <=> node.key) == 0) && node.right.nil? ) + return nil, node.value + end + if ( !isred(node.right) && !isred(node.right.left) ) + node.move_red_right + end + if (key <=> node.key) == 0 + result = node.value + min_child = min_recursive(node.right) + node.value = min_child.value + node.key = min_child.key + node.right = delete_min_recursive(node.right).first + else + node.right, result = delete_recursive(node.right, key) + end + end + return node.fixup, result + end + + def delete_min_recursive(node) + if node.left.nil? + return nil, node.value + end + if ( !isred(node.left) && !isred(node.left.left) ) + node.move_red_left + end + node.left, result = delete_min_recursive(node.left) + + return node.fixup, result + end + + def delete_max_recursive(node) + if (isred(node.left)) + node = node.rotate_right + end + return nil, node.value if node.right.nil? + if ( !isred(node.right) && !isred(node.right.left) ) + node.move_red_right + end + node.right, result = delete_max_recursive(node.right) + + return node.fixup, result + end + + def get_recursive(node, key) + return nil if node.nil? + case key <=> node.key + when 0 then return node + when -1 then return get_recursive(node.left, key) + when 1 then return get_recursive(node.right, key) + end + end + + def min_recursive(node) + return node if node.left.nil? + + min_recursive(node.left) + end + + def max_recursive(node) + return node if node.right.nil? + + max_recursive(node.right) + end + + def insert(node, key, value) + unless node + @size += 1 + return Node.new(key, value) + end + + case key <=> node.key + when 0 then node.value = value + when -1 then node.left = insert(node.left, key, value) + when 1 then node.right = insert(node.right, key, value) + end + + node.rotate_left if (node.right && node.right.red?) + node.rotate_right if (node.left && node.left.red? && node.left.left && node.left.left.red?) + node.colorflip if (node.left && node.left.red? && node.right && node.right.red?) + node + end + + def isred(node) + return false if node.nil? + + node.color == :red + end +end diff -Nru puppet-2.7.6/lib/puppet/reference/configuration.rb puppet-2.7.9/lib/puppet/reference/configuration.rb --- puppet-2.7.6/lib/puppet/reference/configuration.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/reference/configuration.rb 2011-12-08 22:58:09.000000000 +0000 @@ -10,19 +10,19 @@ }.each do |name, object| # Make each name an anchor header = name.to_s - str += h(header, 3) + str << markdown_header(header, 3) # Print the doc string itself begin - str += object.desc.gsub(/\n/, " ") + str << object.desc.gsub(/\n/, " ") rescue => detail puts detail.backtrace puts detail end - str += "\n\n" + str << "\n\n" # Now print the data about the item. - str += "" + str << "" val = object.default if name.to_s == "vardir" val = "/var/lib/puppet" @@ -31,11 +31,11 @@ end # Leave out the section information; it was apparently confusing people. - #str += "- **Section**: #{object.section}\n" + #str << "- **Section**: #{object.section}\n" unless val == "" - str += "- *Default*: #{val}\n" + str << "- *Default*: #{val}\n" end - str += "\n" + str << "\n" end return str diff -Nru puppet-2.7.6/lib/puppet/reference/indirection.rb puppet-2.7.9/lib/puppet/reference/indirection.rb --- puppet-2.7.6/lib/puppet/reference/indirection.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/reference/indirection.rb 2011-12-08 22:58:09.000000000 +0000 @@ -8,16 +8,15 @@ Puppet::Indirector::Indirection.instances.sort { |a,b| a.to_s <=> b.to_s }.each do |indirection| ind = Puppet::Indirector::Indirection.instance(indirection) name = indirection.to_s.capitalize - text += "## " + indirection.to_s + "\n\n" + text << "## " + indirection.to_s + "\n\n" - text += ind.doc + "\n\n" + text << ind.doc + "\n\n" Puppet::Indirector::Terminus.terminus_classes(ind.name).sort { |a,b| a.to_s <=> b.to_s }.each do |terminus| - text += "### " + terminus.to_s + "\n\n" - + terminus_name = terminus.to_s term_class = Puppet::Indirector::Terminus.terminus_class(ind.name, terminus) - - text += Puppet::Util::Docs.scrub(term_class.doc) + "\n\n" + terminus_doc = Puppet::Util::Docs.scrub(term_class.doc) + text << markdown_definitionlist(terminus_name, terminus_doc) end end diff -Nru puppet-2.7.6/lib/puppet/reference/metaparameter.rb puppet-2.7.9/lib/puppet/reference/metaparameter.rb --- puppet-2.7.6/lib/puppet/reference/metaparameter.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/reference/metaparameter.rb 2011-12-08 22:58:09.000000000 +0000 @@ -29,7 +29,9 @@ params.sort { |a,b| a.to_s <=> b.to_s }.each { |param| - str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level => 3) + str << markdown_header(param.to_s, 3) + str << scrub(Puppet::Type.metaparamdoc(param)) + str << "\n\n" } rescue => detail puts detail.backtrace diff -Nru puppet-2.7.6/lib/puppet/reference/network.rb puppet-2.7.9/lib/puppet/reference/network.rb --- puppet-2.7.6/lib/puppet/reference/network.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/reference/network.rb 2011-12-08 22:58:09.000000000 +0000 @@ -9,14 +9,14 @@ interface = handler.interface - ret += h(name, 2) + ret << markdown_header(name, 2) - ret += scrub(handler.doc) - ret += "\n\n" - ret += option(:prefix, interface.prefix) - ret += option(:side, handler.side.to_s.capitalize) - ret += option(:methods, interface.methods.collect { |ary| ary[0] }.join(", ") ) - ret += "\n\n" + ret << scrub(handler.doc) + ret << "\n\n" + ret << option(:prefix, interface.prefix) + ret << option(:side, handler.side.to_s.capitalize) + ret << option(:methods, interface.methods.collect { |ary| ary[0] }.join(", ") ) + ret << "\n\n" end ret diff -Nru puppet-2.7.6/lib/puppet/reference/providers.rb puppet-2.7.9/lib/puppet/reference/providers.rb --- puppet-2.7.6/lib/puppet/reference/providers.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/reference/providers.rb 2011-12-08 22:58:09.000000000 +0000 @@ -17,16 +17,16 @@ ["Ruby Version", "Puppet Version", "Operating System", "Operating System Release"].each do |label| name = label.gsub(/\s+/, '') value = Facter.value(name) - ret += option(label, value) + ret << option(label, value) end - ret += "\n" + ret << "\n" count = 1 # Produce output for each type. types.each do |type| features = type.features - ret += "\n" # add a trailing newline + ret << "\n" # add a trailing newline # Now build up a table of provider suitability. headers = %w{Provider Suitable?} + features.collect { |f| f.to_s }.sort @@ -35,11 +35,7 @@ functional = false notes = [] - begin - default = type.defaultprovider.name - rescue Puppet::DevError - default = "none" - end + default = type.defaultprovider ? type.defaultprovider.name : 'none' type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname| data = [] table_data[pname] = data @@ -61,21 +57,21 @@ missing.each do |test, values| case test when :exists - details += " - Missing files #{values.join(", ")}\n" + details << " - Missing files #{values.join(", ")}\n" when :variable values.each do |name, facts| if Puppet.settings.valid?(name) - details += " - Setting #{name} (currently #{Puppet.settings.value(name).inspect}) not in list #{facts.join(", ")}\n" + details << " - Setting #{name} (currently #{Puppet.settings.value(name).inspect}) not in list #{facts.join(", ")}\n" else - details += " - Fact #{name} (currently #{Facter.value(name).inspect}) not in list #{facts.join(", ")}\n" + details << " - Fact #{name} (currently #{Facter.value(name).inspect}) not in list #{facts.join(", ")}\n" end end when :true - details += " - Got #{values} true tests that should have been false\n" + details << " - Got #{values} true tests that should have been false\n" when :false - details += " - Got #{values} false tests that should have been true\n" + details << " - Got #{values} false tests that should have been true\n" when :feature - details += " - Missing features #{values.collect { |f| f.to_s }.join(",")}\n" + details << " - Missing features #{values.collect { |f| f.to_s }.join(",")}\n" end end notes << details @@ -93,20 +89,20 @@ end end - ret += h(type.name.to_s + "_", 2) + ret << markdown_header(type.name.to_s + "_", 2) - ret += "[#{type.name}](#{"http://docs.puppetlabs.com/references/stable/type.html##{type.name}"})\n\n" - ret += option("Default provider", default) - ret += doctable(headers, table_data) + ret << "[#{type.name}](#{"http://docs.puppetlabs.com/references/stable/type.html##{type.name}"})\n\n" + ret << option("Default provider", default) + ret << doctable(headers, table_data) notes.each do |note| - ret += note + "\n" + ret << note + "\n" end - ret += "\n" + ret << "\n" end - ret += "\n" + ret << "\n" ret end diff -Nru puppet-2.7.6/lib/puppet/reference/type.rb puppet-2.7.9/lib/puppet/reference/type.rb --- puppet-2.7.6/lib/puppet/reference/type.rb 2011-10-22 06:18:24.000000000 +0000 +++ puppet-2.7.9/lib/puppet/reference/type.rb 2011-12-08 22:58:09.000000000 +0000 @@ -23,7 +23,7 @@ file { "/etc/passwd": owner => root, group => root, - mode => 644 + mode => 644 } `/etc/passwd` is considered the title of the file object (used for things like @@ -54,19 +54,19 @@ a.to_s <=> b.to_s }.each { |name,type| - str += " + str << " ---------------- " - str += h(name, 3) - str += scrub(type.doc) + "\n\n" + str << markdown_header(name, 3) + str << scrub(type.doc) + "\n\n" # Handle the feature docs. if featuredocs = type.featuredocs - str += h("Features", 4) - str += featuredocs + str << markdown_header("Features", 4) + str << featuredocs end docs = {} @@ -92,7 +92,7 @@ docs[sname] = tmp } - str += h("Parameters", 4) + "\n" + str << markdown_header("Parameters", 4) + "\n" type.parameters.sort { |a,b| a.to_s <=> b.to_s }.each { |name,param| @@ -104,9 +104,12 @@ docs.sort { |a, b| a[0].to_s <=> b[0].to_s }.each { |name, doc| - str += paramwrap(name, doc, :namevar => additional_key_attributes.include?(name)) + if additional_key_attributes.include?(name) + doc = "(**Namevar:** If omitted, this parameter's value defaults to the resource's title.)\n\n" + doc + end + str << markdown_definitionlist(name, doc) } - str += "\n" + str << "\n" } str diff -Nru puppet-2.7.6/lib/puppet/resource/catalog.rb puppet-2.7.9/lib/puppet/resource/catalog.rb --- puppet-2.7.6/lib/puppet/resource/catalog.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/resource/catalog.rb 2011-12-08 22:58:09.000000000 +0000 @@ -361,7 +361,7 @@ # # These two hashes comprise the aforementioned attention to the possible # case of containers that contain / depend on other containers; they map - # containers to their sentinals but pass other verticies through. Thus we + # containers to their sentinels but pass other verticies through. Thus we # can "do the right thing" for references to other verticies that may or # may not be containers. # diff -Nru puppet-2.7.6/lib/puppet/resource.rb puppet-2.7.9/lib/puppet/resource.rb --- puppet-2.7.6/lib/puppet/resource.rb 2011-10-22 07:16:40.000000000 +0000 +++ puppet-2.7.9/lib/puppet/resource.rb 2011-12-08 23:17:37.000000000 +0000 @@ -1,6 +1,7 @@ require 'puppet' require 'puppet/util/tagging' require 'puppet/util/pson' +require 'puppet/parameter' # The simplest resource class. Eventually it will function as the # base class for all resource-like behaviour. @@ -264,11 +265,7 @@ attributes = attr.collect { |k| v = parameters[k] - if v.is_a? Array - " %-#{attr_max}s => %s,\n" % [ k, "[\'#{v.join("', '")}\']" ] - else - " %-#{attr_max}s => %s,\n" % [ k, "\'#{v}\'" ] - end + " %-#{attr_max}s => %s,\n" % [k, Puppet::Parameter.format_value_for_display(v)] }.join "%s { '%s':\n%s}" % [self.type.to_s.downcase, self.title, attributes] diff -Nru puppet-2.7.6/lib/puppet/ssl/certificate_request.rb puppet-2.7.9/lib/puppet/ssl/certificate_request.rb --- puppet-2.7.6/lib/puppet/ssl/certificate_request.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/ssl/certificate_request.rb 2011-12-08 22:58:09.000000000 +0000 @@ -146,4 +146,74 @@ sort. uniq end + + # Return the set of extensions requested on this CSR, in a form designed to + # be useful to Ruby: a hash. Which, not coincidentally, you can pass + # successfully to the OpenSSL constructor later, if you want. + def request_extensions + raise Puppet::Error, "CSR needs content to extract fields" unless @content + + # Prefer the standard extReq, but accept the Microsoft specific version as + # a fallback, if the standard version isn't found. + ext = @content.attributes.find {|x| x.oid == "extReq" } or + @content.attributes.find {|x| x.oid == "msExtReq" } + return [] unless ext + + # Assert the structure and extract the names into an array of arrays. + unless ext.value.is_a? OpenSSL::ASN1::Set + raise Puppet::Error, "In #{ext.oid}, expected Set but found #{ext.value.class}" + end + + unless ext.value.value.is_a? Array + raise Puppet::Error, "In #{ext.oid}, expected Set[Array] but found #{ext.value.value.class}" + end + + unless ext.value.value.length == 1 + raise Puppet::Error, "In #{ext.oid}, expected Set[Array[...]], but found #{ext.value.value.length} items in the array" + end + + san = ext.value.value.first + unless san.is_a? OpenSSL::ASN1::Sequence + raise Puppet::Error, "In #{ext.oid}, expected Set[Array[Sequence[...]]], but found #{san.class}" + end + san = san.value + + # OK, now san should be the array of items, validate that... + index = -1 + san.map do |name| + index += 1 + + unless name.is_a? OpenSSL::ASN1::Sequence + raise Puppet::Error, "In #{ext.oid}, expected request extension record #{index} to be a Sequence, but found #{name.class}" + end + name = name.value + + # OK, turn that into an extension, to unpack the content. Lovely that + # we have to swap the order of arguments to the underlying method, or + # perhaps that the ASN.1 representation chose to pack them in a + # strange order where the optional component comes *earlier* than the + # fixed component in the sequence. + case name.length + when 2 + ev = OpenSSL::X509::Extension.new(name[0].value, name[1].value) + { "oid" => ev.oid, "value" => ev.value } + + when 3 + ev = OpenSSL::X509::Extension.new(name[0].value, name[2].value, name[1].value) + { "oid" => ev.oid, "value" => ev.value, "critical" => ev.critical? } + + else + raise Puppet::Error, "In #{ext.oid}, expected extension record #{index} to have two or three items, but found #{name.length}" + end + end.flatten + end + + def subject_alt_names + @subject_alt_names ||= request_extensions. + select {|x| x["oid"] = "subjectAltName" }. + map {|x| x["value"].split(/\s*,\s*/) }. + flatten. + sort. + uniq + end end diff -Nru puppet-2.7.6/lib/puppet/ssl/host.rb puppet-2.7.9/lib/puppet/ssl/host.rb --- puppet-2.7.6/lib/puppet/ssl/host.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/ssl/host.rb 2011-12-10 03:07:18.000000000 +0000 @@ -160,6 +160,10 @@ name == Puppet[:certname].downcase end + def this_csr_is_for_the_current_host + name == Puppet[:certname].downcase + end + # Our certificate request requires the key but that's all. def generate_certificate_request(options = {}) generate_key unless key @@ -169,6 +173,8 @@ # ...add our configured dns_alt_names if Puppet[:dns_alt_names] and Puppet[:dns_alt_names] != '' options[:dns_alt_names] ||= Puppet[:dns_alt_names] + elsif Puppet::SSL::CertificateAuthority.ca? and fqdn = Facter.value(:fqdn) and domain = Facter.value(:domain) + options[:dns_alt_names] = "puppet, #{fqdn}, puppet.#{domain}" end end diff -Nru puppet-2.7.6/lib/puppet/transaction/event_manager.rb puppet-2.7.9/lib/puppet/transaction/event_manager.rb --- puppet-2.7.6/lib/puppet/transaction/event_manager.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/transaction/event_manager.rb 2011-12-08 22:58:09.000000000 +0000 @@ -77,7 +77,7 @@ @event_queues[target] ||= {} @event_queues[target][callback] ||= [] - @event_queues[target][callback] += events + @event_queues[target][callback].concat(events) end def queued_events(resource) diff -Nru puppet-2.7.6/lib/puppet/transaction.rb puppet-2.7.9/lib/puppet/transaction.rb --- puppet-2.7.6/lib/puppet/transaction.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/transaction.rb 2011-12-10 02:49:11.000000000 +0000 @@ -92,7 +92,7 @@ # collects all of the changes, executes them, and responds to any # necessary events. def evaluate - prepare + add_dynamically_generated_resources Puppet.info "Applying configuration version '#{catalog.version}'" if catalog.version @@ -145,15 +145,18 @@ end def eval_generate(resource) + return false unless resource.respond_to?(:eval_generate) raise Puppet::DevError,"Depthfirst resources are not supported by eval_generate" if resource.depthfirst? begin - made = resource.eval_generate.uniq.reverse + made = resource.eval_generate.uniq + return false if made.empty? + made = made.inject({}) {|a,v| a.merge(v.name => v) } rescue => detail puts detail.backtrace if Puppet[:trace] resource.err "Failed to generate additional resources using 'eval_generate: #{detail}" - return + return false end - made.each do |res| + made.values.each do |res| begin res.tag(*resource.tags) @catalog.add_resource(res) @@ -162,17 +165,34 @@ res.info "Duplicate generated resource; skipping" end end - sentinal = Puppet::Type::Whit.new(:name => "completed_#{resource.title}", :catalog => resource.catalog) + sentinel = Puppet::Type.type(:whit).new(:name => "completed_#{resource.title}", :catalog => resource.catalog) + + # The completed whit is now the thing that represents the resource is done relationship_graph.adjacent(resource,:direction => :out,:type => :edges).each { |e| - add_conditional_directed_dependency(sentinal, e.target, e.label) + # But children run as part of the resource, not after it + next if made[e.target.name] + + add_conditional_directed_dependency(sentinel, e.target, e.label) relationship_graph.remove_edge! e } + default_label = Puppet::Resource::Catalog::Default_label - made.each do |res| - add_conditional_directed_dependency(made.find { |r| r != res && r.name == res.name[0,r.name.length]} || resource, res) - add_conditional_directed_dependency(res, sentinal, default_label) + made.values.each do |res| + # Depend on the nearest ancestor we generated, falling back to the + # resource if we have none + parent_name = res.ancestors.find { |a| made[a] and made[a] != res } + parent = made[parent_name] || resource + + add_conditional_directed_dependency(parent, res) + + # This resource isn't 'completed' until each child has run + add_conditional_directed_dependency(res, sentinel, default_label) end - add_conditional_directed_dependency(resource, sentinal, default_label) + + # This edge allows the resource's events to propagate, though it isn't + # strictly necessary for ordering purposes + add_conditional_directed_dependency(resource, sentinel, default_label) + true end # A general method for recursively generating new resources from a @@ -200,9 +220,7 @@ end end - # Collect any dynamically generated resources. This method is called - # before the transaction starts. - def xgenerate + def add_dynamically_generated_resources @catalog.vertices.each { |resource| generate_additional_resources(resource) } end @@ -221,41 +239,56 @@ @event_manager = Puppet::Transaction::EventManager.new(self) @resource_harness = Puppet::Transaction::ResourceHarness.new(self) + + @prefetched_providers = Hash.new { |h,k| h[k] = {} } end - # Prefetch any providers that support it. We don't support prefetching - # types, just providers. - def prefetch - prefetchers = {} - @catalog.vertices.each do |resource| - if provider = resource.provider and provider.class.respond_to?(:prefetch) - prefetchers[provider.class] ||= {} - prefetchers[provider.class][resource.name] = resource - end - end + def resources_by_provider(type_name, provider_name) + unless @resources_by_provider + @resources_by_provider = Hash.new { |h, k| h[k] = Hash.new { |h, k| h[k] = {} } } - # Now call prefetch, passing in the resources so that the provider instances can be replaced. - prefetchers.each do |provider, resources| - Puppet.debug "Prefetching #{provider.name} resources for #{provider.resource_type.name}" - begin - provider.prefetch(resources) - rescue => detail - puts detail.backtrace if Puppet[:trace] - Puppet.err "Could not prefetch #{provider.resource_type.name} provider '#{provider.name}': #{detail}" + @catalog.vertices.each do |resource| + if resource.class.attrclass(:provider) + prov = resource.provider && resource.provider.class.name + @resources_by_provider[resource.type][prov][resource.name] = resource + end end end + + @resources_by_provider[type_name][provider_name] || {} end - # Prepare to evaluate the resources in a transaction. - def prepare - # Now add any dynamically generated resources - xgenerate + def prefetch_if_necessary(resource) + provider_class = resource.provider.class + return unless provider_class.respond_to?(:prefetch) and !prefetched_providers[resource.type][provider_class.name] - # Then prefetch. It's important that we generate and then prefetch, - # so that any generated resources also get prefetched. - prefetch + resources = resources_by_provider(resource.type, provider_class.name) + + if provider_class == resource.class.defaultprovider + providerless_resources = resources_by_provider(resource.type, nil) + providerless_resources.values.each {|res| res.provider = provider_class.name} + resources.merge! providerless_resources + end + + prefetch(provider_class, resources) end + attr_reader :prefetched_providers + + # Prefetch any providers that support it, yo. We don't support prefetching + # types, just providers. + def prefetch(provider_class, resources) + type_name = provider_class.resource_type.name + return if @prefetched_providers[type_name][provider_class.name] + Puppet.debug "Prefetching #{provider_class.name} resources for #{type_name}" + begin + provider_class.prefetch(resources) + rescue => detail + puts detail.backtrace if Puppet[:trace] + Puppet.err "Could not prefetch #{type_name} provider '#{provider_class.name}': #{detail}" + end + @prefetched_providers[type_name][provider_class.name] = true + end # We want to monitor changes in the relationship graph of our # catalog but this is complicated by the fact that the catalog @@ -273,46 +306,116 @@ # except via the Transaction#relationship_graph class Relationship_graph_wrapper - attr_reader :real_graph,:transaction,:ready,:generated,:done,:unguessable_deterministic_key + require 'puppet/rb_tree_map' + attr_reader :real_graph,:transaction,:ready,:generated,:done,:blockers,:unguessable_deterministic_key def initialize(real_graph,transaction) @real_graph = real_graph @transaction = transaction - @ready = {} + @ready = Puppet::RbTreeMap.new @generated = {} @done = {} - @unguessable_deterministic_key = Hash.new { |h,k| h[k] = Digest::SHA1.hexdigest("NaCl, MgSO4 (salts) and then #{k.title}") } - vertices.each { |v| check_if_now_ready(v) } + @blockers = {} + @unguessable_deterministic_key = Hash.new { |h,k| h[k] = Digest::SHA1.hexdigest("NaCl, MgSO4 (salts) and then #{k.ref}") } + @providerless_types = [] + vertices.each do |v| + blockers[v] = direct_dependencies_of(v).length + enqueue(v) if blockers[v] == 0 + end end def method_missing(*args,&block) real_graph.send(*args,&block) end def add_vertex(v) real_graph.add_vertex(v) - check_if_now_ready(v) # ????????????????????????????????????????? end def add_edge(f,t,label=nil) - ready.delete(t) + key = unguessable_deterministic_key[t] + + ready.delete(key) + real_graph.add_edge(f,t,label) end - def check_if_now_ready(r) - ready[r] = true if direct_dependencies_of(r).all? { |r2| done[r2] } + # Decrement the blocker count for the resource by 1. If the number of + # blockers is unknown, count them and THEN decrement by 1. + def unblock(resource) + blockers[resource] ||= direct_dependencies_of(resource).select { |r2| !done[r2] }.length + if blockers[resource] > 0 + blockers[resource] -= 1 + else + resource.warning "appears to have a negative number of dependencies" + end + blockers[resource] <= 0 + end + def enqueue(*resources) + resources.each do |resource| + key = unguessable_deterministic_key[resource] + ready[key] = resource + end + end + def finish(resource) + direct_dependents_of(resource).each do |v| + enqueue(v) if unblock(v) + end + done[resource] = true end def next_resource - ready.keys.sort_by { |r0| unguessable_deterministic_key[r0] }.first + ready.delete_min end def traverse(&block) real_graph.report_cycles_in_graph - while (r = next_resource) && !transaction.stop_processing? - if !generated[r] && r.respond_to?(:eval_generate) - transaction.eval_generate(r) - generated[r] = true + + deferred_resources = [] + + while (resource = next_resource) && !transaction.stop_processing? + if resource.suitable? + made_progress = true + + transaction.prefetch_if_necessary(resource) + + # If we generated resources, we don't know what they are now + # blocking, so we opt to recompute it, rather than try to track every + # change that would affect the number. + blockers.clear if transaction.eval_generate(resource) + + yield resource + + finish(resource) else - ready.delete(r) - yield r - done[r] = true - direct_dependents_of(r).each { |v| check_if_now_ready(v) } + deferred_resources << resource + end + + if ready.empty? and deferred_resources.any? + if made_progress + enqueue(*deferred_resources) + else + fail_unsuitable_resources(deferred_resources) + end + + made_progress = false + deferred_resources = [] end end + + # Just once per type. No need to punish the user. + @providerless_types.uniq.each do |type| + Puppet.err "Could not find a suitable provider for #{type}" + end + end + + def fail_unsuitable_resources(resources) + resources.each do |resource| + # We don't automatically assign unsuitable providers, so if there + # is one, it must have been selected by the user. + if resource.provider + resource.err "Provider #{resource.provider.class.name} is not functional on this host" + else + @providerless_types << resource.type + end + + transaction.resource_status(resource).failed = true + + finish(resource) + end end end diff -Nru puppet-2.7.6/lib/puppet/type/augeas.rb puppet-2.7.9/lib/puppet/type/augeas.rb --- puppet-2.7.6/lib/puppet/type/augeas.rb 2011-10-22 07:15:54.000000000 +0000 +++ puppet-2.7.9/lib/puppet/type/augeas.rb 2011-12-08 22:58:09.000000000 +0000 @@ -21,13 +21,13 @@ feature :execute_changes, "Actually make the changes" @doc = <<-EOT - Apply the changes (single or array of changes) to the filesystem - via the augeas tool. + Apply a change or an array of changes to the filesystem + using the augeas tool. Requires: - - augeas to be installed (http://www.augeas.net) - - ruby-augeas bindings + - [Augeas](http://www.augeas.net) + - The ruby-augeas bindings Sample usage with a string: @@ -40,23 +40,25 @@ Sample usage with an array and custom lenses: augeas{"jboss_conf": - context => "/files", - changes => [ - "set etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress", - "set etc/jbossas/jbossas.conf/JAVA_HOME /usr", - ], + context => "/files", + changes => [ + "set etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress", + "set etc/jbossas/jbossas.conf/JAVA_HOME /usr", + ], load_path => "$/usr/share/jbossas/lenses", } EOT newparam (:name) do - desc "The name of this task. Used for uniqueness" + desc "The name of this task. Used for uniqueness." isnamevar end newparam (:context) do - desc "Optional context path. This value is prepended to the paths of all changes if the path is relative. If INCL is set, defaults to '/files' + INCL, otherwise the empty string" + desc "Optional context path. This value is prepended to the paths of all + changes if the path is relative. If the `incl` parameter is set, + defaults to `/files + incl`; otherwise, defaults to the empty string." defaultto "" munge do |value| if value.empty? and resource[:incl] @@ -71,91 +73,123 @@ desc "Optional augeas command and comparisons to control the execution of this type. Supported onlyif syntax: - get [AUGEAS_PATH] [COMPARATOR] [STRING] - match [MATCH_PATH] size [COMPARATOR] [INT] - match [MATCH_PATH] include [STRING] - match [MATCH_PATH] not_include [STRING] - match [MATCH_PATH] == [AN_ARRAY] - match [MATCH_PATH] != [AN_ARRAY] + * `get ` + * `match size ` + * `match include ` + * `match not_include ` + * `match == ` + * `match != ` where: - AUGEAS_PATH is a valid path scoped by the context - MATCH_PATH is a valid match synatx scoped by the context - COMPARATOR is in the set [> >= != == <= <] - STRING is a string - INT is a number - AN_ARRAY is in the form ['a string', 'another']" + * `AUGEAS_PATH` is a valid path scoped by the context + * `MATCH_PATH` is a valid match synatx scoped by the context + * `COMPARATOR` is one of `>, >=, !=, ==, <=,` or `<` + * `STRING` is a string + * `INT` is a number + * `AN_ARRAY` is in the form `['a string', 'another']`" defaultto "" end newparam(:changes) do desc "The changes which should be applied to the filesystem. This - can be either a string which contains a command or an array of commands. - Commands supported are: + can be a command or an array of commands. The following commands are supported: - set [PATH] [VALUE] Sets the value VALUE at loction PATH - setm [PATH] [SUB] [VALUE] Sets multiple nodes matching SUB relative to PATH, to VALUE - rm [PATH] Removes the node at location PATH - remove [PATH] Synonym for rm - clear [PATH] Sets the node at PATH to NULL, creating it if needed - ins [LABEL] [WHERE] [PATH] Inserts an empty node LABEL either [WHERE={before|after}] PATH. - insert [LABEL] [WHERE] [PATH] Synonym for ins - mv [PATH] [PATH] Moves a node at PATH to the new location PATH - move [PATH] [PATH] Synonym for mv - defvar [NAME] [PATH] Sets Augeas variable $NAME to PATH - defnode [NAME] [PATH] [VALUE] Sets Augeas variable $NAME to PATH, creating it with VALUE if needed + `set ` + : Sets the value `VALUE` at loction `PATH` - If the parameter 'context' is set that value is prepended to a relative PATH" + + `setm ` + : Sets multiple nodes (matching `SUB` relative to `PATH`) to `VALUE` + + + `rm ` + : Removes the node at location `PATH` + + + `remove ` + : Synonym for `rm` + + + `clear ` + : Sets the node at `PATH` to `NULL`, creating it if needed + + + `ins