From ffddaa3465d95638e8e43b28dcad37085b13257b Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Wed, 25 Apr 2012 09:28:28 -0400 Subject: [PATCH] Update to 2.7.13 Note that the license has changed from GPLv2 to ASL 2.0. With 2.7, the puppetstoredconfigclean script has been dropped from ext/ because 'puppet node clean' performs this task. Unfortunately, it does more than just cleaning up the storeconfig db (removing signed certificates and reports), so we can't just call 'puppet node clean'. Instead, restore the script and add a note that it is deprecated, pointing to 'puppet node clean' as the supported method of cleaning storedconfig and other node data. --- puppet-2.6.13-augeas-0.10.patch | 60 ------------------ puppet-2.7.13.tar.gz.asc | 17 +++++ puppet.spec | 59 +++++++++++------ puppetstoredconfigclean.rb | 109 ++++++++++++++++++++++++++++++++ sources | 2 +- 5 files changed, 168 insertions(+), 79 deletions(-) delete mode 100644 puppet-2.6.13-augeas-0.10.patch create mode 100644 puppet-2.7.13.tar.gz.asc create mode 100644 puppetstoredconfigclean.rb diff --git a/puppet-2.6.13-augeas-0.10.patch b/puppet-2.6.13-augeas-0.10.patch deleted file mode 100644 index 2d2ee7c..0000000 --- a/puppet-2.6.13-augeas-0.10.patch +++ /dev/null @@ -1,60 +0,0 @@ -From e3fc5c4960de988b81e470d9e1f6a66c1bfd15e2 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Mon, 19 Dec 2011 22:56:43 +0000 -Subject: [PATCH] (#11414) Test Augeas versions correctly with versioncmp - -The release of Augeas 0.10.0 broke simplistic version comparisons with the >= -operator, so now use versioncmp. - -(Cherry pick of 735acad5 but without the accompanying test, which doesn't exist -in 2.6.x). ---- - lib/puppet/provider/augeas/augeas.rb | 8 +++++--- - 1 files changed, 5 insertions(+), 3 deletions(-) - -diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb -index 7dbd062..70406f6 100644 ---- a/lib/puppet/provider/augeas/augeas.rb -+++ b/lib/puppet/provider/augeas/augeas.rb -@@ -19,9 +19,11 @@ - - require 'augeas' if Puppet.features.augeas? - require 'strscan' -+require 'puppet/util/package' - - Puppet::Type.type(:augeas).provide(:augeas) do - include Puppet::Util -+ include Puppet::Util::Package - - confine :true => Puppet.features.augeas? - -@@ -143,7 +145,7 @@ def open_augeas - debug("Opening augeas with root #{root}, lens path #{load_path}, flags #{flags}") - @aug = Augeas::open(root, load_path,flags) - -- debug("Augeas version #{get_augeas_version} is installed") if get_augeas_version >= "0.3.6" -+ debug("Augeas version #{get_augeas_version} is installed") if versioncmp(get_augeas_version, "0.3.6") >= 0 - - if resource[:incl] - aug.set("/augeas/load/Xfm/lens", resource[:lens]) -@@ -279,7 +281,7 @@ def need_to_run? - # If we have a verison of augeas which is at least 0.3.6 then we - # can make the changes now, see if changes were made, and - # actually do the save. -- if return_value and get_augeas_version >= "0.3.6" -+ if return_value and versioncmp(get_augeas_version, "0.3.6") >= 0 - debug("Will attempt to save and only run if files changed") - set_augeas_save_mode(SAVE_NOOP) - do_execute_changes -@@ -303,7 +305,7 @@ def execute_changes - # Re-connect to augeas, and re-execute the changes - begin - open_augeas -- set_augeas_save_mode(SAVE_OVERWRITE) if get_augeas_version >= "0.3.6" -+ set_augeas_save_mode(SAVE_OVERWRITE) if versioncmp(get_augeas_version, "0.3.6") >= 0 - - do_execute_changes - --- -1.7.5.4 - diff --git a/puppet-2.7.13.tar.gz.asc b/puppet-2.7.13.tar.gz.asc new file mode 100644 index 0000000..0bf26bc --- /dev/null +++ b/puppet-2.7.13.tar.gz.asc @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.11 (Darwin) + +iQIcBAABAgAGBQJPhJb0AAoJEBBUt6JL1uwwZDYP/jTEbdhzM5l1t2aUgdNdkk6d +otYWofbq4ClsUJfMP4giHUDtlzM5GJCqtMcDeIp8HfqsQNdDIL9BFCLyVCo7VukS +EE9VaNv8E5oOyAUAFR8wsETyPN5V7WH34o3XQ2Og1+7O6RSDXEGdWH8dkjioJ78C +HNVJvCOEdYKCGgZt6/aZUOvCXAHEolb5lcKeyQCLpK+dP5Bp/Hp/JbVqbhOmiMi2 +yJm/eV/zlFQ9sz2JovFgAzaJwSDLEetx01ROsDrJks44LaH4ibEu+MoLOPTVIGkk +EJJRfojOKrEQIBco1zjvsx7D6gIe/WGlshT9s7bvNGCAmQvhxRoga2PvZwyhQxkE +kZbSiBprYW9Z0J2FTdSuLCH9dcAcqVzvtaEJpfgzRM5lkhnSKVaBdwRYOmtSxPP4 +WyecLc1TZSkJklqc70kTq7pMFrrBkZrgufVlckXrA4ZKV8ZnP1KxPBQ/0lFseOHO +qnJV1tNgZUTRrFjPM58Va7TSD5tH5RlFci/k6v+0FowdDgko8J4vXr2XU0QTzPSK +CaR75g+jpyBk2XIkTdkQ/VR46imsMw6NEIkPuSbAo1O00BAStvJ4/7xvR+dZQ1nj +tYHO3naagP/rPRxbYZJek6lcKn9frQsx1Epev4VH1mi8NiHmc6aN4BvkxP0L0oUZ +mIfuFz6Kwagt5FSue1VL +=DjHL +-----END PGP SIGNATURE----- diff --git a/puppet.spec b/puppet.spec index ba12f37..ebc0ca1 100644 --- a/puppet.spec +++ b/puppet.spec @@ -12,18 +12,16 @@ %global ruby_version %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]') Name: puppet -Version: 2.6.16 +Version: 2.7.13 Release: 1%{?dist} Summary: A network tool for managing many disparate systems -License: GPLv2 +License: ASL 2.0 URL: http://puppetlabs.com Source0: http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.gz Source1: http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.gz.asc +Source2: puppetstoredconfigclean.rb # https://projects.puppetlabs.com/issues/9167 Patch0: 0001-9167-Do-not-sent-tagmail-reports-if-no-changes.patch -# http://projects.puppetlabs.com/issues/11414 -# https://bugzilla.redhat.com/771097 -Patch1: puppet-2.6.13-augeas-0.10.patch Group: System Environment/Base @@ -84,11 +82,9 @@ The server can also function as a certificate authority and file server. %prep %setup -q %patch0 -p1 -%patch1 -p1 patch -s -p1 < conf/redhat/rundir-perms.patch # Fix some rpmlint complaints -sed -i '/^#!\/usr\/bin\/env ruby/,/^$/d' lib/puppet/util/command_line/* for f in mac_dscl.pp mac_dscl_revert.pp \ mac_pkgdmg.pp ; do sed -i -e'1d' examples/$f @@ -97,8 +93,7 @@ done for f in external/nagios.rb network/http_server/mongrel.rb relationship.rb; do sed -i -e '1d' lib/puppet/$f done -chmod +x ext/puppet-load.rb ext/puppetstoredconfigclean.rb \ - ext/regexp_nodes/regexp_nodes.rb +chmod +x ext/puppet-load.rb ext/regexp_nodes/regexp_nodes.rb find examples/ -type f -empty | xargs rm find examples/ -type f | xargs chmod a-x @@ -132,12 +127,31 @@ touch %{buildroot}%{_sysconfdir}/puppet/puppetmasterd.conf touch %{buildroot}%{_sysconfdir}/puppet/puppetca.conf touch %{buildroot}%{_sysconfdir}/puppet/puppetd.conf +# Replace redundant man pages with links to the canonical man page +pushd %{buildroot}%{_mandir}/man8 >/dev/null +ln -svf puppet-cert.8.gz puppetca.8.gz +ln -svf puppet-queue.8.gz puppetqd.8.gz +ln -svf puppet-kick.8.gz puppetrun.8.gz +ln -svf puppet-describe.8.gz pi.8.gz +ln -svf puppet-master.8.gz puppetmasterd.8.gz +ln -svf puppet-filebucket.8.gz filebucket.8.gz +ln -svf puppet-agent.8.gz puppetd.8.gz +ln -svf puppet-doc.8.gz puppetdoc.8.gz +ln -svf puppet-resource.8.gz ralsh.8.gz +popd >/dev/null + # Install the ext/ directory to %{_datadir}/%{name} install -d %{buildroot}%{_datadir}/%{name} cp -a ext/ %{buildroot}%{_datadir}/%{name} # emacs and vim bits are installed elsewhere rm -rf %{buildroot}%{_datadir}/%{name}/ext/{emacs,vim} +# The puppetstoredconfigclean script was removed now that puppet node clean +# does this job and more. For folks that were using this, let's provide the +# script and give them a hint to use puppet node clean. Remove this for the +# next major release after 2.7. +install -pv %{SOURCE2} %{buildroot}%{_datadir}/%{name}/ext/ + # Install emacs mode files emacsdir=%{buildroot}%{_datadir}/emacs/site-lisp install -Dp -m0644 ext/emacs/puppet-mode.el $emacsdir/puppet-mode.el @@ -158,7 +172,7 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \ %files %defattr(-, root, root, 0755) -%doc CHANGELOG COPYING LICENSE README.md README.queueing examples +%doc CHANGELOG LICENSE README.md examples %{_bindir}/pi %{_bindir}/puppet %{_bindir}/ralsh @@ -187,13 +201,15 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \ %attr(-, puppet, puppet) %{_localstatedir}/run/puppet %attr(0750, puppet, puppet) %{_localstatedir}/log/puppet %attr(-, puppet, puppet) %{_localstatedir}/lib/puppet +# Exclude man pages from the server package +%exclude %{_mandir}/man8/puppet-kick.8.gz +%exclude %{_mandir}/man8/puppet-master.8.gz +%exclude %{_mandir}/man8/puppet-queue.8.gz +%exclude %{_mandir}/man8/puppetmasterd.8.gz +%exclude %{_mandir}/man8/puppetqd.8.gz +%exclude %{_mandir}/man8/puppetrun.8.gz %{_mandir}/man5/puppet.conf.5.gz -%{_mandir}/man8/pi.8.gz -%{_mandir}/man8/puppet.8.gz -%{_mandir}/man8/puppetca.8.gz -%{_mandir}/man8/puppetd.8.gz -%{_mandir}/man8/ralsh.8.gz -%{_mandir}/man8/puppetdoc.8.gz +%{_mandir}/man8/*.8.gz %files server %defattr(-, root, root, 0755) @@ -205,10 +221,13 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \ %dir %{_sysconfdir}/puppet/manifests %config(noreplace) %{_sysconfdir}/sysconfig/puppetmaster %ghost %config(noreplace,missingok) %{_sysconfdir}/puppet/puppetmasterd.conf -%{_mandir}/man8/filebucket.8.gz +# Ensure that man pages listed here are excluded from the main package +%{_mandir}/man8/puppet-kick.8.gz +%{_mandir}/man8/puppet-master.8.gz +%{_mandir}/man8/puppet-queue.8.gz %{_mandir}/man8/puppetmasterd.8.gz -%{_mandir}/man8/puppetrun.8.gz %{_mandir}/man8/puppetqd.8.gz +%{_mandir}/man8/puppetrun.8.gz # Fixed uid/gid were assigned in bz 472073 (Fedora), 471918 (RHEL-5), # and 471919 (RHEL-4) @@ -279,6 +298,10 @@ fi rm -rf %{buildroot} %changelog +* Wed Apr 25 2012 Todd Zullinger - 2.7.13-1 +- Update to 2.7.13 +- Change license from GPLv2 to ASL 2.0 + * Wed Apr 11 2012 Todd Zullinger - 2.6.16-1 - Update to 2.6.16, fixes CVE-2012-1986, CVE-2012-1987, and CVE-2012-1988 - Correct permissions of /var/log/puppet (0750) diff --git a/puppetstoredconfigclean.rb b/puppetstoredconfigclean.rb new file mode 100644 index 0000000..3d0abdd --- /dev/null +++ b/puppetstoredconfigclean.rb @@ -0,0 +1,109 @@ +#!/usr/bin/env ruby + +# Script to clean up stored configs for (a) given host(s) +# +# Credits: +# Script was taken from http://reductivelabs.com/trac/puppet/attachment/wiki/UsingStoredConfiguration/kill_node_in_storedconfigs_db.rb (link no longer valid), +# which haven been initially posted by James Turnbull +# duritong adapted and improved the script a bit. + +require 'getoptlong' +require 'puppet' +require 'puppet/rails' + +config = Puppet[:config] + +def printusage(error_code) + puts "Usage: #{$0} [ list of hostnames as stored in hosts table ]" + puts "\n Options:" + puts "--config " + exit(error_code) +end + +# Print a deprecation notice, pointing to puppet node clean the supported +# method of cleaning nodes in puppet >= 2.7. Unfortunately, puppet node clean +# removes far more than just storedconfig data. +puts "\nTHIS SCRIPT IS DEPRECATED." +puts "'puppet node clean' replaces it, but also removes certificates and reports.\n\n" + +opts = GetoptLong.new( + [ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ], + [ "--help", "-h", GetoptLong::NO_ARGUMENT ], + [ "--usage", "-u", GetoptLong::NO_ARGUMENT ], + [ "--version", "-v", GetoptLong::NO_ARGUMENT ] +) + +begin + opts.each do |opt, arg| + case opt + when "--config" + config = arg + + when "--help" + printusage(0) + + when "--usage" + printusage(0) + + when "--version" + puts "#{Puppet.version}" + exit + end + end +rescue GetoptLong::InvalidOption => detail + $stderr.puts "Try '#{$0} --help'" + exit(1) +end + +printusage(1) unless ARGV.size > 0 + +if config != Puppet[:config] + Puppet[:config]=config + Puppet.settings.parse +end + +master = Puppet.settings.instance_variable_get(:@values)[:master] +main = Puppet.settings.instance_variable_get(:@values)[:main] +db_config = main.merge(master) + +# get default values +[:master, :main, :rails].each do |section| + Puppet.settings.params(section).each do |key| + db_config[key] ||= Puppet[key] + end +end + +adapter = db_config[:dbadapter] +args = {:adapter => adapter, :log_level => db_config[:rails_loglevel]} + +case adapter + when "sqlite3" + args[:dbfile] = db_config[:dblocation] + when "mysql", "mysql2", "postgresql" + args[:host] = db_config[:dbserver] unless db_config[:dbserver].to_s.empty? + args[:username] = db_config[:dbuser] unless db_config[:dbuser].to_s.empty? + args[:password] = db_config[:dbpassword] unless db_config[:dbpassword].to_s.empty? + args[:database] = db_config[:dbname] unless db_config[:dbname].to_s.empty? + args[:port] = db_config[:dbport] unless db_config[:dbport].to_s.empty? + socket = db_config[:dbsocket] + args[:socket] = socket unless socket.to_s.empty? + else + raise ArgumentError, "Invalid db adapter #{adapter}" +end + +args[:database] = "puppet" unless not args[:database].to_s.empty? + +ActiveRecord::Base.establish_connection(args) + +ARGV.each do |hostname| + if @host = Puppet::Rails::Host.find_by_name(hostname.strip) + print "Removing #{hostname} from storedconfig..." + $stdout.flush + @host.destroy + puts "done." + else + puts "Error: Can't find host #{hostname}." + end +end + +exit 0 diff --git a/sources b/sources index bdba51b..2872b17 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b565a4ea60fe678e1ce1cb275c4aeeb2 puppet-2.6.16.tar.gz +8062f371cc7ec5c7e5cd5f4b6c3f9278 puppet-2.7.13.tar.gz