Control: tags -1 - moreinfo Hi,
On 21:35 Wed 11 Mar , Niels Thykier wrote: > Ack, looks good. Please upload it to unstable and remove the moreinfo > tag once it has been accepted. Uploaded and accepted into unstable with the following minor changes: - Add a note in README.Debian clarifying the dependencies needed for stored configs to work and noting the deprecation status. - Improve the ActiveRecord 4 patch to also include clear_active_connections! stubs in the testsuite's specs. We do not use the test suite directly, but are shipping it in puppet-testsuite, so I did the change for completeness. Full debdiff since 3.7.2-2 and interdiff attached. Regards, Apollon
diff -u puppet-3.7.2/debian/changelog puppet-3.7.2/debian/changelog --- puppet-3.7.2/debian/changelog 2015-03-10 19:57:24.000000000 +0200 +++ puppet-3.7.2/debian/changelog 2015-03-12 11:46:11.000000000 +0200 @@ -5,6 +5,8 @@ * Fix service enable/disable in the Debian service provider (Closes: #775795) * Fix stored configs with ActiveRecord 4.x (Closes: #774643) + puppetmaster-common: add Recommends for stored configs + + Mention stored configs dependencies in README.Debian. Also add a + note for the deprecation of AR-based stored configs. * Preserve and honor changes in /etc/default/puppet (Closes: #778891) + Do not remove /etc/default/puppet on upgrade + Disable the agent when upgrading and START != yes diff -u puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch --- puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch 2015-03-10 19:57:24.000000000 +0200 +++ puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch 2015-03-12 11:46:11.000000000 +0200 @@ -1,6 +1,6 @@ -From 988b0aff88429f820ee247533b8aed4a77d11a62 Mon Sep 17 00:00:00 2001 +From 5628459ba86a5d535babd6e904de9db42045d6d4 Mon Sep 17 00:00:00 2001 From: Apollon Oikonomopoulos <apoi...@debian.org> -Date: Tue, 10 Mar 2015 19:46:39 +0200 +Date: Thu, 12 Mar 2015 11:33:05 +0200 Subject: Stored configs compatibility with ActiveRecord 4.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -30,7 +30,8 @@ lib/puppet/rails/fact_value.rb | 3 +++ lib/puppet/rails/param_value.rb | 4 ++-- lib/puppet/rails/resource_tag.rb | 4 ++-- - 6 files changed, 24 insertions(+), 15 deletions(-) + spec/unit/rails_spec.rb | 6 +++--- + 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index 2c97c02..adb20fb 100644 @@ -189,6 +190,30 @@ tags.each do |val| val['resource_id'] = Integer(val['resource_id']) end +diff --git a/spec/unit/rails_spec.rb b/spec/unit/rails_spec.rb +index b12f81f..2fb0e4f 100755 +--- a/spec/unit/rails_spec.rb ++++ b/spec/unit/rails_spec.rb +@@ -37,7 +37,7 @@ describe Puppet::Rails, "when initializing any connection", :if => Puppet.featur + logger.expects(:level=).with(Logger::DEBUG) + + ActiveRecord::Base.stubs(:allow_concurrency=) +- ActiveRecord::Base.stubs(:verify_active_connections!) ++ ActiveRecord::Base.stubs(:clear_active_connections!) + ActiveRecord::Base.stubs(:establish_connection) + Puppet::Rails.stubs(:database_arguments).returns({}) + +@@ -60,8 +60,8 @@ describe Puppet::Rails, "when initializing any connection", :if => Puppet.featur + end + end + +- it "should call ActiveRecord::Base.verify_active_connections!" do +- ActiveRecord::Base.expects(:verify_active_connections!) ++ it "should call ActiveRecord::Base.clear_active_connections!" do ++ ActiveRecord::Base.expects(:clear_active_connections!) + + Puppet::Rails.connect + end -- 2.1.4 only in patch2: unchanged: --- puppet-3.7.2/debian/README.Debian 2014-11-13 13:56:19.000000000 +0200 +++ puppet-3.7.2/debian/README.Debian 2015-03-12 11:45:42.000000000 +0200 @@ -10,3 +10,17 @@ changes made to files in /etc via etckeeper before and after its run. -- Stig Sandbeck Mathisen <s...@debian.org>, Mon, 5 Aug 2013 23:36:19 +0200 + +Using stored configs +-------------------- + +Using the master's stored configs functionality with the ActiveRecord backend +requires the ruby-activerecord (and, since Jessie, +ruby-activerecord-deprecated-finders) packages to be installed. Furthermore a +database adapter for the database of choice (e.g. ruby-mysql) must be +installed. + +Note that ActiveRecord-based stored configs are deprecated and will be removed +in Puppet 4 in favor of PuppetDB. + + -- Apollon Oikonomopulos <apoi...@debian.org> Thu, 12 Mar 2015 10:50:47 +0200
diff -Nru puppet-3.7.2/debian/changelog puppet-3.7.2/debian/changelog --- puppet-3.7.2/debian/changelog 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/changelog 2015-03-12 11:46:11.000000000 +0200 @@ -1,3 +1,23 @@ +puppet (3.7.2-3) unstable; urgency=medium + + [ Apollon Oikonomopoulos ] + * Team upload. + * Fix service enable/disable in the Debian service provider (Closes: #775795) + * Fix stored configs with ActiveRecord 4.x (Closes: #774643) + + puppetmaster-common: add Recommends for stored configs + + Mention stored configs dependencies in README.Debian. Also add a + note for the deprecation of AR-based stored configs. + * Preserve and honor changes in /etc/default/puppet (Closes: #778891) + + Do not remove /etc/default/puppet on upgrade + + Disable the agent when upgrading and START != yes + + puppet.service: pass $DAEMON_OPTS to puppet agent. Thanks to Rik Theys! + + Add a NEWS note about the START flag + + [ Stig Sandbeck Mathisen ] + * Add upstream metadata + + -- Apollon Oikonomopoulos <apoi...@debian.org> Tue, 10 Mar 2015 14:33:45 +0200 + puppet (3.7.2-2) unstable; urgency=medium [ Gaudenz Steinlin ] diff -Nru puppet-3.7.2/debian/control puppet-3.7.2/debian/control --- puppet-3.7.2/debian/control 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/control 2015-03-10 19:57:24.000000000 +0200 @@ -81,6 +81,8 @@ ruby | ruby-interpreter, Breaks: puppet (<< 0.24.7-1), puppetmaster (<< 2.7.6-1~) Replaces: puppet (<< 0.24.7-1), puppetmaster (<< 2.7.6-1~) +Recommends: ruby-activerecord, + ruby-activerecord-deprecated-finders Suggests: apache2 | nginx, puppet-el, diff -Nru puppet-3.7.2/debian/copyright puppet-3.7.2/debian/copyright --- puppet-3.7.2/debian/copyright 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/copyright 2015-03-10 16:11:08.000000000 +0200 @@ -1,6 +1,6 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Puppet -Source: git://github.com/reductivelabs/puppet.git, +Source: https://github.com/puppetlabs/puppet Files: * Copyright: 2004-2012 Puppet Labs Inc diff -Nru puppet-3.7.2/debian/NEWS puppet-3.7.2/debian/NEWS --- puppet-3.7.2/debian/NEWS 2014-11-13 13:56:19.000000000 +0200 +++ puppet-3.7.2/debian/NEWS 2015-03-10 19:57:24.000000000 +0200 @@ -1,3 +1,17 @@ +puppet (3.7.2-3) unstable; urgency=medium + + The START flag in /etc/default/puppet is since 3.2.4-1 no longer effective. + To preserve state across upgrades for old setups where the puppet agent was + disabled using the START flag, the agent will be disabled using its built-in + disable facility if START is not set to true. In that case, you will need to + run "puppet agent --enable" before the agent can connect to a puppet master. + + On systems running the puppet agent via cron, make sure that you do not rely + on the START variable in /etc/default/puppet and instead disable the + service using update-rc.d or systemctl. + + -- Apollon Oikonomopoulos <apoi...@debian.org> Tue, 10 Mar 2015 14:54:15 +0200 + puppet (3.2.4-1) unstable; urgency=high The puppet agent is now started by default, regardless of init system. diff -Nru puppet-3.7.2/debian/patches/0005-Fix-service-listing-and-enable-disable-in-Debian.patch puppet-3.7.2/debian/patches/0005-Fix-service-listing-and-enable-disable-in-Debian.patch --- puppet-3.7.2/debian/patches/0005-Fix-service-listing-and-enable-disable-in-Debian.patch 1970-01-01 02:00:00.000000000 +0200 +++ puppet-3.7.2/debian/patches/0005-Fix-service-listing-and-enable-disable-in-Debian.patch 2015-03-10 16:11:08.000000000 +0200 @@ -0,0 +1,161 @@ +From a9b76dbfba96f537227c445297d3ccd115de46ca Mon Sep 17 00:00:00 2001 +From: Apollon Oikonomopoulos <apoi...@debian.org> +Date: Fri, 27 Feb 2015 10:55:34 +0200 +Subject: [PATCH] Fix service listing and enable/disable in Debian +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add two support methods to detect when we're running systemd as PID 1 +and if a service has only an initscript. + +Use these to implement the following functionality: + + • Under systemd, use systemctl enable/disable for all services. This + works correctly for all types of services. + + • Under systemd, use systemctl is-enabled only for services that have a + systemd unit file and fall back to invoke-rc.d for sysv services. + +Also, fix self.instances to augment the list of systemd-enabled services +with the sysv services. + +Finally drop pre-2.88 sysv-rc support and use `update-rc.d enable' for +all services when running under sysv-rc, preserving order changes. +--- + lib/puppet/provider/service/debian.rb | 94 ++++++++++++++++++++++++++--------- + 1 file changed, 71 insertions(+), 23 deletions(-) + +diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb +index 9f7a2f5..7a26409 100644 +--- a/lib/puppet/provider/service/debian.rb ++++ b/lib/puppet/provider/service/debian.rb +@@ -15,6 +15,7 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do + # http://projects.reductivelabs.com/issues/2538 + # is resolved. + commands :invoke_rc => "/usr/sbin/invoke-rc.d" ++ optional_commands :systemctl => "/bin/systemctl" + + # This isn't being used directly, it's just here to ensure + # that the /usr/sbin/service binary is available. +@@ -23,38 +24,82 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do + + defaultfor :operatingsystem => :debian + ++ def self.runs_on_systemd? ++ Dir.exists? "/run/systemd/system" ++ end ++ ++ def is_sysv_unit? ++ # The sysv generator sets the SourcePath attribute to the name of the ++ # initscript. Use this to detect whether a unit is backed by an initscript ++ # or not. ++ source = systemctl(:show, "-pSourcePath", @resource[:name]) ++ source.start_with? "SourcePath=/etc/init.d/" ++ end ++ ++ def self.instances ++ # We need to merge services with systemd unit files with those only having ++ # an initscript. Note that we could use `systemctl --all` to get sysv ++ # services as well, however it would only output *enabled* services. ++ i = {} ++ if self.runs_on_systemd? ++ begin ++ output = systemctl('list-unit-files', '--type', 'service', '--full', '--all', '--no-pager') ++ output.scan(/^(\S+)\.service\s+(disabled|enabled)\s*$/i).each do |m| ++ i[m[0]] = new(:name => m[0]) ++ end ++ rescue Puppet::ExecutionFailure ++ end ++ end ++ get_services(defpath).each do |sysv| ++ unless i.has_key?(sysv.name) ++ i[sysv.name] = sysv ++ end ++ end ++ return i.values ++ end ++ + # Remove the symlinks + def disable +- if `dpkg --compare-versions $(dpkg-query -W --showformat '${Version}' sysv-rc) ge 2.88 ; echo $?`.to_i == 0 +- update_rc @resource[:name], "disable" ++ if self.class.runs_on_systemd? ++ systemctl(:disable, @resource[:name]) + else +- update_rc "-f", @resource[:name], "remove" +- update_rc @resource[:name], "stop", "00", "1", "2", "3", "4", "5", "6", "." ++ update_rc @resource[:name], "disable" + end + end + + def enabled? +- # TODO: Replace system call when Puppet::Util::Execution.execute gives us a way +- # to determine exit status. http://projects.reductivelabs.com/issues/2538 +- system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") +- +- # 104 is the exit status when you query start an enabled service. +- # 106 is the exit status when the policy layer supplies a fallback action +- # See x-man-page://invoke-rc.d +- if [104, 106].include?($CHILD_STATUS.exitstatus) +- return :true +- elsif [105].include?($CHILD_STATUS.exitstatus) +- # 105 is unknown, which generally means the iniscript does not support query +- # The debian policy states that the initscript should support methods of query +- # For those that do not, peform the checks manually +- # http://www.debian.org/doc/debian-policy/ch-opersys.html +- if get_start_link_count >= 4 ++ # Initscript-backed services have no enabled status in systemd, so we ++ # need to query them using invoke-rc.d. ++ if self.class.runs_on_systemd? and not is_sysv_unit? ++ begin ++ systemctl("is-enabled", @resource[:name]) + return :true +- else ++ rescue Puppet::ExecutionFailure + return :false + end + else +- return :false ++ # TODO: Replace system call when Puppet::Util::Execution.execute gives us a way ++ # to determine exit status. http://projects.reductivelabs.com/issues/2538 ++ system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") ++ ++ # 104 is the exit status when you query start an enabled service. ++ # 106 is the exit status when the policy layer supplies a fallback action ++ # See x-man-page://invoke-rc.d ++ if [104, 106].include?($CHILD_STATUS.exitstatus) ++ return :true ++ elsif [105].include?($CHILD_STATUS.exitstatus) ++ # 105 is unknown, which generally means the iniscript does not support query ++ # The debian policy states that the initscript should support methods of query ++ # For those that do not, peform the checks manually ++ # http://www.debian.org/doc/debian-policy/ch-opersys.html ++ if get_start_link_count >= 4 ++ return :true ++ else ++ return :false ++ end ++ else ++ return :false ++ end + end + end + +@@ -63,8 +108,11 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do + end + + def enable +- update_rc "-f", @resource[:name], "remove" +- update_rc @resource[:name], "defaults" ++ if self.class.runs_on_systemd? ++ systemctl(:enable, @resource[:name]) ++ else ++ update_rc @resource[:name], "enable" ++ end + end + + # The start, stop, restart and status command use service +-- +2.1.4 + diff -Nru puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch --- puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch 1970-01-01 02:00:00.000000000 +0200 +++ puppet-3.7.2/debian/patches/0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch 2015-03-12 11:46:11.000000000 +0200 @@ -0,0 +1,219 @@ +From 5628459ba86a5d535babd6e904de9db42045d6d4 Mon Sep 17 00:00:00 2001 +From: Apollon Oikonomopoulos <apoi...@debian.org> +Date: Thu, 12 Mar 2015 11:33:05 +0200 +Subject: Stored configs compatibility with ActiveRecord 4.x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make ActiveRecord-based stored configs work again with ActiveRecord 4.x: + + • Use AR::Base.clear_active_connections! instead of + AR::Base.verify_active_connections! + + • Always call AR::Base.connection as a class method, never as an + instance method. + + • Require 'activerecord/deprecated_finders' for AR versions later than 4.1 to + make all #find(:all) and #find_by_x methods work again. + + • Silence AR's deprecation warnings. We know we are using deprecated + finders so these warnings are just (a lot of) noise. + + • Drop all ":integer => true" options passed to add_index in the + schema. This was probably never a valid option anyway and was ignored + until Rails 4.x, but currently causes the DB bootstrapping to fail. +--- + lib/puppet/rails.rb | 5 ++++- + lib/puppet/rails/database/schema.rb | 20 ++++++++++---------- + lib/puppet/rails/fact_name.rb | 3 +++ + lib/puppet/rails/fact_value.rb | 3 +++ + lib/puppet/rails/param_value.rb | 4 ++-- + lib/puppet/rails/resource_tag.rb | 4 ++-- + spec/unit/rails_spec.rb | 6 +++--- + 7 files changed, 27 insertions(+), 18 deletions(-) + +diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb +index 2c97c02..adb20fb 100644 +--- a/lib/puppet/rails.rb ++++ b/lib/puppet/rails.rb +@@ -8,6 +8,9 @@ module Puppet::Rails + TIME_DEBUG = true + + def self.connect ++ # Silence activerecord deprecation warnings ++ ActiveSupport::Deprecation.silenced = true ++ + # This global init does not work for testing, because we remove + # the state dir on every test. + return if ActiveRecord::Base.connected? +@@ -26,7 +29,7 @@ module Puppet::Rails + # As of ActiveRecord 2.2 allow_concurrency has been deprecated and no longer has any effect. + ActiveRecord::Base.allow_concurrency = true if Puppet::Util.activerecord_version < 2.2 + +- ActiveRecord::Base.verify_active_connections! ++ ActiveRecord::Base.clear_active_connections! + + begin + args = database_arguments +diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb +index 931a1b6..1216719 100644 +--- a/lib/puppet/rails/database/schema.rb ++++ b/lib/puppet/rails/database/schema.rb +@@ -19,8 +19,8 @@ class Puppet::Rails::Schema + t.column :updated_at, :datetime + t.column :created_at, :datetime + end +- add_index :resources, :host_id, :integer => true +- add_index :resources, :source_file_id, :integer => true ++ add_index :resources, :host_id ++ add_index :resources, :source_file_id + + # Thanks, mysql! MySQL requires a length on indexes in text fields. + # So, we provide them for mysql and handle everything else specially. +@@ -45,8 +45,8 @@ class Puppet::Rails::Schema + t.column :updated_at, :datetime + t.column :created_at, :datetime + end +- add_index :resource_tags, :resource_id, :integer => true +- add_index :resource_tags, :puppet_tag_id, :integer => true ++ add_index :resource_tags, :resource_id ++ add_index :resource_tags, :puppet_tag_id + + create_table :puppet_tags do |t| + t.column :name, :string +@@ -55,7 +55,7 @@ class Puppet::Rails::Schema + end + + # Oracle automatically creates a primary key index +- add_index :puppet_tags, :id, :integer => true if Puppet[:dbadapter] != "oracle_enhanced" ++ add_index :puppet_tags, :id if Puppet[:dbadapter] != "oracle_enhanced" + + create_table :hosts do |t| + t.column :name, :string, :null => false +@@ -69,7 +69,7 @@ class Puppet::Rails::Schema + t.column :source_file_id, :integer + t.column :created_at, :datetime + end +- add_index :hosts, :source_file_id, :integer => true ++ add_index :hosts, :source_file_id + add_index :hosts, :name + + create_table :fact_names do |t| +@@ -86,8 +86,8 @@ class Puppet::Rails::Schema + t.column :updated_at, :datetime + t.column :created_at, :datetime + end +- add_index :fact_values, :fact_name_id, :integer => true +- add_index :fact_values, :host_id, :integer => true ++ add_index :fact_values, :fact_name_id ++ add_index :fact_values, :host_id + + create_table :param_values do |t| + t.column :value, :text, :null => false +@@ -97,8 +97,8 @@ class Puppet::Rails::Schema + t.column :updated_at, :datetime + t.column :created_at, :datetime + end +- add_index :param_values, :param_name_id, :integer => true +- add_index :param_values, :resource_id, :integer => true ++ add_index :param_values, :param_name_id ++ add_index :param_values, :resource_id + + create_table :param_names do |t| + t.column :name, :string, :null => false +diff --git a/lib/puppet/rails/fact_name.rb b/lib/puppet/rails/fact_name.rb +index 073bbcb..5fe5264 100644 +--- a/lib/puppet/rails/fact_name.rb ++++ b/lib/puppet/rails/fact_name.rb +@@ -1,4 +1,7 @@ + require 'active_record' ++if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('4.1') ++ require 'active_record/deprecated_finders' ++end + require 'puppet/rails' + require 'puppet/rails/fact_value' + +diff --git a/lib/puppet/rails/fact_value.rb b/lib/puppet/rails/fact_value.rb +index 918c0ac..d1657b9 100644 +--- a/lib/puppet/rails/fact_value.rb ++++ b/lib/puppet/rails/fact_value.rb +@@ -1,4 +1,7 @@ + require 'active_record' ++if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('4.1') ++ require 'active_record/deprecated_finders' ++end + + class Puppet::Rails::FactValue < ActiveRecord::Base + belongs_to :fact_name +diff --git a/lib/puppet/rails/param_value.rb b/lib/puppet/rails/param_value.rb +index d7c88f8..e082ed8 100644 +--- a/lib/puppet/rails/param_value.rb ++++ b/lib/puppet/rails/param_value.rb +@@ -48,7 +48,7 @@ class Puppet::Rails::ParamValue < ActiveRecord::Base + + # returns an array of hash containing all the parameters of a given resource + def self.find_all_params_from_resource(db_resource) +- params = db_resource.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN param_names n ON v.param_name_id=n.id WHERE v.resource_id=#{db_resource.id}") ++ params = ActiveRecord::Base.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN param_names n ON v.param_name_id=n.id WHERE v.resource_id=#{db_resource.id}") + params.each do |val| + val['value'] = unserialize_value(val['value']) + val['line'] = val['line'] ? Integer(val['line']) : nil +@@ -59,7 +59,7 @@ class Puppet::Rails::ParamValue < ActiveRecord::Base + + # returns an array of hash containing all the parameters of a given host + def self.find_all_params_from_host(db_host) +- params = db_host.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN resources r ON v.resource_id=r.id INNER JOIN param_names n ON v.param_name_id=n.id WHERE r.host_id=#{db_host.id}") ++ params = ActiveRecord::Base.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN resources r ON v.resource_id=r.id INNER JOIN param_names n ON v.param_name_id=n.id WHERE r.host_id=#{db_host.id}") + params.each do |val| + val['value'] = unserialize_value(val['value']) + val['line'] = val['line'] ? Integer(val['line']) : nil +diff --git a/lib/puppet/rails/resource_tag.rb b/lib/puppet/rails/resource_tag.rb +index 1c1aa45..1493d3e 100644 +--- a/lib/puppet/rails/resource_tag.rb ++++ b/lib/puppet/rails/resource_tag.rb +@@ -8,7 +8,7 @@ class Puppet::Rails::ResourceTag < ActiveRecord::Base + + # returns an array of hash containing tags of resource + def self.find_all_tags_from_resource(db_resource) +- tags = db_resource.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE t.resource_id=#{db_resource.id}") ++ tags = ActiveRecord::Base.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE t.resource_id=#{db_resource.id}") + tags.each do |val| + val['resource_id'] = Integer(val['resource_id']) + end +@@ -17,7 +17,7 @@ class Puppet::Rails::ResourceTag < ActiveRecord::Base + + # returns an array of hash containing tags of a host + def self.find_all_tags_from_host(db_host) +- tags = db_host.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN resources r ON t.resource_id=r.id INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE r.host_id=#{db_host.id}") ++ tags = ActiveRecord::Base.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN resources r ON t.resource_id=r.id INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE r.host_id=#{db_host.id}") + tags.each do |val| + val['resource_id'] = Integer(val['resource_id']) + end +diff --git a/spec/unit/rails_spec.rb b/spec/unit/rails_spec.rb +index b12f81f..2fb0e4f 100755 +--- a/spec/unit/rails_spec.rb ++++ b/spec/unit/rails_spec.rb +@@ -37,7 +37,7 @@ describe Puppet::Rails, "when initializing any connection", :if => Puppet.featur + logger.expects(:level=).with(Logger::DEBUG) + + ActiveRecord::Base.stubs(:allow_concurrency=) +- ActiveRecord::Base.stubs(:verify_active_connections!) ++ ActiveRecord::Base.stubs(:clear_active_connections!) + ActiveRecord::Base.stubs(:establish_connection) + Puppet::Rails.stubs(:database_arguments).returns({}) + +@@ -60,8 +60,8 @@ describe Puppet::Rails, "when initializing any connection", :if => Puppet.featur + end + end + +- it "should call ActiveRecord::Base.verify_active_connections!" do +- ActiveRecord::Base.expects(:verify_active_connections!) ++ it "should call ActiveRecord::Base.clear_active_connections!" do ++ ActiveRecord::Base.expects(:clear_active_connections!) + + Puppet::Rails.connect + end +-- +2.1.4 + diff -Nru puppet-3.7.2/debian/patches/series puppet-3.7.2/debian/patches/series --- puppet-3.7.2/debian/patches/series 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/patches/series 2015-03-10 16:11:08.000000000 +0200 @@ -2,3 +2,5 @@ 0002-Set-passenger-puppet-master-document-root.patch 0003-fix-puppet-master-logcheck-rule.patch 0004-debian-service-provider-use-service.patch +0005-Fix-service-listing-and-enable-disable-in-Debian.patch +0006-Storeconfigs-compatibility-with-ActiveRecord-4.patch diff -Nru puppet-3.7.2/debian/puppet-common.preinst puppet-3.7.2/debian/puppet-common.preinst --- puppet-3.7.2/debian/puppet-common.preinst 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/puppet-common.preinst 2015-03-10 19:57:24.000000000 +0200 @@ -18,7 +18,7 @@ tmp_lockfile=$(mktemp /var/lib/puppet/state/agent_disabled.lock.XXXXXXXX) lockfile=/var/lib/puppet/state/agent_disabled.lock - printf '{"disabled_message":"Disabled by default on new installations"}' \ + printf '{"disabled_message":"Disabled by default on new or unconfigured old installations"}' \ > $tmp_lockfile mv $tmp_lockfile $lockfile @@ -29,10 +29,33 @@ # disable the puppet agent on the first install if [ -z "$2" ]; then disable_puppet_agent + elif dpkg --compare-versions "$2" lt "3.2.4-1~" && \ + [ -e "/etc/default/puppet" ]; then + # Also disable puppet if we use conffiles from a version where the + # START flag mattered. + . /etc/default/puppet + + if [ "x$START" != "xtrue" -a "x$START" != "xyes" -a "x$START" != "x0" ]; then + # Note that "0" is not a typo, it reflects the checks done + # in wheezy's initscript. + disable_puppet_agent + fi fi ;; upgrade) + # Disable puppet if we are upgrading from a version where the START + # flag mattered. + if dpkg --compare-versions "$2" lt "3.2.4-1~" && \ + [ -e "/etc/default/puppet" ]; then + . /etc/default/puppet + + if [ "x$START" != "xtrue" -a "x$START" != "xyes" -a "x$START" != "x0" ]; then + # Note that "0" is not a typo, it reflects the checks done + # in wheezy's initscript. + disable_puppet_agent + fi + fi ;; abort-upgrade) diff -Nru puppet-3.7.2/debian/puppet.postinst puppet-3.7.2/debian/puppet.postinst --- puppet-3.7.2/debian/puppet.postinst 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/puppet.postinst 1970-01-01 02:00:00.000000000 +0200 @@ -1,44 +0,0 @@ -#!/bin/sh -# postinst script for puppet -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * <postinst> `configure' <most-recently-configured-version> -# * <old-postinst> `abort-upgrade' <new version> -# * <conflictor's-postinst> `abort-remove' `in-favour' <package> -# <new-version> -# * <postinst> `abort-remove' -# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' -# <failed-install-package> <version> `removing' -# <conflicting-package> <version> -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -if dpkg-maintscript-helper supports rm_conffile; then - dpkg-maintscript-helper rm_conffile \ - /etc/default/puppet 3.2.3-1 puppet -- "$@" -fi - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff -Nru puppet-3.7.2/debian/puppet.postrm puppet-3.7.2/debian/puppet.postrm --- puppet-3.7.2/debian/puppet.postrm 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/puppet.postrm 1970-01-01 02:00:00.000000000 +0200 @@ -1,42 +0,0 @@ -#!/bin/sh -# postrm script for puppet -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * <postrm> `remove' -# * <postrm> `purge' -# * <old-postrm> `upgrade' <new-version> -# * <new-postrm> `failed-upgrade' <old-version> -# * <new-postrm> `abort-install' -# * <new-postrm> `abort-install' <old-version> -# * <new-postrm> `abort-upgrade' <old-version> -# * <disappearer's-postrm> `disappear' <overwriter> -# <overwriter-version> -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - if dpkg-maintscript-helper supports rm_conffile; then - dpkg-maintscript-helper rm_conffile \ - /etc/default/puppet 3.2.3-1 puppet -- "$@" - fi - - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff -Nru puppet-3.7.2/debian/puppet.preinst puppet-3.7.2/debian/puppet.preinst --- puppet-3.7.2/debian/puppet.preinst 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/puppet.preinst 1970-01-01 02:00:00.000000000 +0200 @@ -1,40 +0,0 @@ -#!/bin/sh -# preinst script for #PACKAGE# -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * <new-preinst> `install' -# * <new-preinst> `install' <old-version> -# * <new-preinst> `upgrade' <old-version> -# * <old-preinst> `abort-upgrade' <new-version> -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - install|upgrade) - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -if dpkg-maintscript-helper supports rm_conffile; then - dpkg-maintscript-helper rm_conffile \ - /etc/default/puppet 3.2.3-1 puppet -- "$@" -fi - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff -Nru puppet-3.7.2/debian/puppet.service puppet-3.7.2/debian/puppet.service --- puppet-3.7.2/debian/puppet.service 2015-03-10 14:41:11.000000000 +0200 +++ puppet-3.7.2/debian/puppet.service 2015-03-10 19:57:24.000000000 +0200 @@ -3,8 +3,9 @@ [Service] Type=forking +EnvironmentFile=-/etc/default/puppet PIDFile=/run/puppet/agent.pid -ExecStart=/usr/bin/puppet agent +ExecStart=/usr/bin/puppet agent $DAEMON_OPTS [Install] WantedBy=multi-user.target diff -Nru puppet-3.7.2/debian/README.Debian puppet-3.7.2/debian/README.Debian --- puppet-3.7.2/debian/README.Debian 2014-11-13 13:56:19.000000000 +0200 +++ puppet-3.7.2/debian/README.Debian 2015-03-12 11:45:42.000000000 +0200 @@ -10,3 +10,17 @@ changes made to files in /etc via etckeeper before and after its run. -- Stig Sandbeck Mathisen <s...@debian.org>, Mon, 5 Aug 2013 23:36:19 +0200 + +Using stored configs +-------------------- + +Using the master's stored configs functionality with the ActiveRecord backend +requires the ruby-activerecord (and, since Jessie, +ruby-activerecord-deprecated-finders) packages to be installed. Furthermore a +database adapter for the database of choice (e.g. ruby-mysql) must be +installed. + +Note that ActiveRecord-based stored configs are deprecated and will be removed +in Puppet 4 in favor of PuppetDB. + + -- Apollon Oikonomopulos <apoi...@debian.org> Thu, 12 Mar 2015 10:50:47 +0200 diff -Nru puppet-3.7.2/debian/upstream/metadata puppet-3.7.2/debian/upstream/metadata --- puppet-3.7.2/debian/upstream/metadata 1970-01-01 02:00:00.000000000 +0200 +++ puppet-3.7.2/debian/upstream/metadata 2015-03-10 16:11:08.000000000 +0200 @@ -0,0 +1,4 @@ +--- +Bug-Database: https://tickets.puppetlabs.com/browse/PUP +Repository: https://github.com/puppetlabs/puppet.git +Repository-Browse: https://github.com/puppetlabs/puppet