Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-12 Thread bertagaz
Hi,

  = the best way to help get this fixed is probably to test the
  proposed patches and to report back here :)

 By the way, we're running a production puppetmaster with the patches and 
 everything (db creation, stored configs and exported resource 
 collection) works fine. I'll commit the patch to the repository.

I've just build the puppet* packages from Jessie with the last patch from this
thread, then installed it as well as the ruby dependencies on our (Jessie)
puppetmaster.

So far it seems to work correctly (which was not the case with the first
proposed patch). The exported resources seem to be collected and deployed, e.g
the puppet-sshkeys module which uses storeconfig works now and correctly deploy
its fancy stuffs.

So I think we're in the good direction to solve this issue. Still I'd prefer to
wait for Intrigeri to review my tests before adopting this patch. If any other
can test it, please do so.

 By the way, I wonder if puppetmaster-common should Recommend (or at 
 least Suggest) ruby-activerecord and 
 ruby-activerecord-deprecated-finders. If not, we should at least add a 
 notice in README.Debian about what is needed to enable stored configs.

Yes, I believe it should Suggest them, and *also* deserve some explanations in
the README. There's no dependencies between
ruby-activerecord-deprecated-finders and ruby-activerecord, so we should make
it clear one has to install the former for the storeconfig option to work.

Also I'm not sure the patch should remove the deprecation warnings.

Thanks for your work on that!

bert.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-12 Thread intrigeri
bertagaz wrote (11 Mar 2015 11:17:48 GMT) :
 I've just build the puppet* packages from Jessie with the last patch from this
 thread,

Great news that you confirm it works!

 If any other can test it, please do so.

I believe it would be more beneficial to test the patch that was
attached to the (accepted) unblock request: #780223. I suspect Apollon
will upload to sid shortly, so it'll get easier to test things.

Cheers,
-- 
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-09 Thread Apollon Oikonomopoulos
Hi all,

On 22:16 Sun 08 Mar , intrigeri wrote:
 = the best way to help get this fixed is probably to test the
 proposed patches and to report back here :)

By the way, we're running a production puppetmaster with the patches and 
everything (db creation, stored configs and exported resource 
collection) works fine. I'll commit the patch to the repository.

Cheers,
Apollon


signature.asc
Description: Digital signature


Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-09 Thread Apollon Oikonomopoulos
Control: severity -1 serious

Also, since all major Puppet setups I know of use AR-based stored 
configs and exported resources, I think this is a major regression from 
wheezy and warrants a severity: serious.

Regards,
Apollon


signature.asc
Description: Digital signature


Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-08 Thread intrigeri
Hi Gabriel,

Gabriel Filion wrote (08 Mar 2015 20:14:01 GMT) :
 We really do need to find a solution to this issue before jessie is
 released (or in the worst case, at first point release).

A patch series has been proposed (thanks Apollon!):

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774643#90
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774643#122

= the best way to help get this fixed is probably to test the
proposed patches and to report back here :)

Cheers,
-- 
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-08 Thread Gabriel Filion
Hey there,

Sorry if I'm jumping in late, but I'd like to weigh in the importance of
storedconfigs. Even though it's an optional feature, the biggest
majority of users need to use it in order to have a functional setup.

For comparison, releasing without it would be like releasing apache
without one of the crucial modules, like mod_rewrite.

We really do need to find a solution to this issue before jessie is
released (or in the worst case, at first point release).

-- 
Gabriel Filion



signature.asc
Description: OpenPGP digital signature


Bug#774643: [DRE-maint] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-03 Thread Apollon Oikonomopoulos
Hi,

On Mon, 2 Mar 2015 17:18:18 +0100 Christian Hofstaedtler z...@debian.org 
wrote:
 IMO, nothing of value has been lost, and the only thing that should
 probably be done is a NEWS/RelNotes entry (which likely is required
 anyway, I seriously doubt upgrading inplace from 2.7 to 3.7 does
 yield anything working at all).

For anyone following the best practices suggested upstream during the 
2.x cycle, the 2.7 manifests should mostly work.  They certainly did for 
us (approx 100 modules, some of them rather complicated) with just a 
couple of deprecation warnings that we fixed early on. As for stored 
configs, the schema and code has not changed at all, so there is no 
reason for it not to work. My tests sofar have shown that it works as it 
should, with the - known - limitation that structured facts are not 
supported.

Personally, I wouldn't want an upgrade to Jessie force me to install an 
external dependency like PuppetDB. Furthermore, we have a custom set of 
tools developed around the stored configs database that would need 
porting to PuppetDB as well. Since upstream still provides AR-based 
stored configs in 3.7 (even though it may be marked as deprecated), my 
view is we should support it if we can. Then for Puppet 4/5/whatever we 
definitely need to provide a PuppetDB package.

Regards,
Apollon


signature.asc
Description: Digital signature


Bug#774643: [Pkg-puppet-devel] Bug#774643: [DRE-maint] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-03 Thread Stig Sandbeck Mathisen
Apollon Oikonomopoulos apoi...@debian.org writes:

 Then for Puppet 4/5/whatever we definitely need to provide a PuppetDB
 package.

To package puppetdb while following the Debian packaging policy,
experience with packaging clojure or java apps for Debian with leiningen
and maven would be a big bonus. The learning curve is scary steep.

-- 
Stig Sandbeck Mathisen


signature.asc
Description: PGP signature


Bug#774643: [DRE-maint] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-03 Thread Apollon Oikonomopoulos
Just a small update to the patch, to fix database creation.  
lib/puppet/rails/database/schema.rb contains a lot of:

  add_index blah, :integer = true

statements. The :integer = true option to add_index method is not documented
anywhere, not even in the earliest versions of ActiveRecord. Up to Rails 4.0[1]
it was ignored, but now it causes the application to break:

stderr: Unknown key: :integer. Valid keys are: :unique, :order, :name,
:where, :length, :internal, :using, :algorithm, :type

It looks like we can safely remove these options altogether, as they
were never valid in the first place. See interdiff at [2].

Regards,
Apollon

[1] 
https://github.com/rails/rails/commit/8fc52706c376be03f644e847d1dd357fc88ead6f

[2] interdiff:
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

From 56aa472b0f7eeafbf4d5f9994c31494bcc21293f Mon Sep 17 00:00:00 2001
From: Apollon Oikonomopoulos apoi...@debian.org
Date: Sat, 28 Feb 2015 11:56:44 +0200
Subject: [PATCH] Storeconfigs compatibility with ActiveRecord 4
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' 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   |  1 +
 lib/puppet/rails/fact_value.rb  |  1 +
 lib/puppet/rails/param_value.rb |  4 ++--
 lib/puppet/rails/resource_tag.rb|  4 ++--
 6 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index 

Bug#774643: [DRE-maint] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-02 Thread Giuseppe Lavagetto
On Mon, Mar 2, 2015 at 6:09 PM, micah mi...@debian.org wrote:
 Christian Hofstaedtler z...@debian.org writes:

[CUT]

 The thing is, one really does not want to use Puppet with
 storedconfigs with activerecord (it's unbearably slow).

 I disagree, I want to use Puppet with storedconfigs and activerecord. In
 fact, I'm using it now, and have been doing so for over eight
 years. Puppet has come a long way since the early days, but if you knew
 how slow it was back then, you would think that storedconfigs with
 activerecord was blazing fast now.


I agree 100% with this. But I think this is beyond the point.

 IMO, nothing of value has been lost, and the only thing that should
 probably be done is a NEWS/RelNotes entry (which likely is required
 anyway, I seriously doubt upgrading inplace from 2.7 to 3.7 does
 yield anything working at all).

 That is why we are adopting our manifests for the newer requirements, it
 is a bit painful to do so, but it would be much more painful if our
 choice was to either not upgrade to jessie, or install a non-debian
 provided puppetdb.


Exactly. The point is: we're not dropping support for AR
storedconfigs, we're breaking external resources support.

if puppetdb was available in Debian no one would complain about
dropping support for AR. No one wants AR based storedconfigs because
we love them, but because we need to be able to support external
resources on a debian system without installing 3rd party software. I
don't think this is acceptable in any way.

Giuseppe


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: [DRE-maint] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-02 Thread Christian Hofstaedtler
* intrigeri intrig...@debian.org [150209 16:03]:
 tl;dr for Debian Ruby Extras maintainers: in Jessie, Puppet's
 storeconfig feature can either use activerecord (deprecated, only
 works with activerecord 3.x, broken with activerecord 4.x) or PuppetDB
 (not packaged in Debian yet). So, currently we have a serious
 regression on the Wheezy-Jessie upgrade path.

The thing is, one really does not want to use Puppet with
storedconfigs with activerecord (it's unbearably slow).

IMO, nothing of value has been lost, and the only thing that should
probably be done is a NEWS/RelNotes entry (which likely is required
anyway, I seriously doubt upgrading inplace from 2.7 to 3.7 does
yield anything working at all).

-- 
 ,''`.  Christian Hofstaedtler z...@debian.org
: :' :  Debian Developer
`. `'   7D1A CFFA D9E0 806C 9C4C  D392 5C13 D6DB 9305 2E03
  `-



pgpGw_4b6Mjn9.pgp
Description: PGP signature


Bug#774643: [DRE-maint] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-02 Thread intrigeri
Hi,

Christian Hofstaedtler wrote (02 Mar 2015 16:18:18 GMT) :
 The thing is, one really does not want to use Puppet with
 storedconfigs with activerecord (it's unbearably slow).

Thanks for sharing your opinion on this topic.

Let me share my experience and preferences. I've been using
storedconfigs with activerecord for years, and so far I can live with
the slowness. I'd love to use puppetdb instead, but so far it's not
part of Debian. As far as Jessie is concerned, I very much prefer to
go on living with that slowness, than having to install puppetdb from
a non-Debian APT repository.

Now, it can very well be that I'm part of a tiny minority of Puppet
users on Debian, and that it's not worth the risk to patch Puppet and
reintroduce the missing feature at this stage of the release process.

Cheers,
-- 
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: [DRE-maint] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-02 Thread micah
Christian Hofstaedtler z...@debian.org writes:

 * intrigeri intrig...@debian.org [150209 16:03]:
 tl;dr for Debian Ruby Extras maintainers: in Jessie, Puppet's
 storeconfig feature can either use activerecord (deprecated, only
 works with activerecord 3.x, broken with activerecord 4.x) or PuppetDB
 (not packaged in Debian yet). So, currently we have a serious
 regression on the Wheezy-Jessie upgrade path.

 The thing is, one really does not want to use Puppet with
 storedconfigs with activerecord (it's unbearably slow).

I disagree, I want to use Puppet with storedconfigs and activerecord. In
fact, I'm using it now, and have been doing so for over eight
years. Puppet has come a long way since the early days, but if you knew
how slow it was back then, you would think that storedconfigs with
activerecord was blazing fast now.

While I am interested in switching to puppetdb and getting even moar
speed, the fact that it is not possible to install puppetdb in debian
right now (and the challenges in getting it packaged are not trivial) is
pretty significant because it breaks everybody's puppet setup until that
is available, and it doesn't look like it will be available for Jessie.

 IMO, nothing of value has been lost, and the only thing that should
 probably be done is a NEWS/RelNotes entry (which likely is required
 anyway, I seriously doubt upgrading inplace from 2.7 to 3.7 does
 yield anything working at all).

That is why we are adopting our manifests for the newer requirements, it
is a bit painful to do so, but it would be much more painful if our
choice was to either not upgrade to jessie, or install a non-debian
provided puppetdb.

micah


signature.asc
Description: PGP signature


Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-03-01 Thread Apollon Oikonomopoulos
On 12:10 Sat 28 Feb , Apollon Oikonomopoulos wrote:
 Note that you have to install ruby-activerecord-deprecated-finders.

By the way, I wonder if puppetmaster-common should Recommend (or at 
least Suggest) ruby-activerecord and 
ruby-activerecord-deprecated-finders. If not, we should at least add a 
notice in README.Debian about what is needed to enable stored configs.

Cheers,
Apollon


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-28 Thread Apollon Oikonomopoulos
Hi,

It should be possible to make Puppet work with ActiveRecord 4.x. I've 
managed to get it to a point where it doesn't throw exceptions, but I 
have to verify that's it's actually doing what it should do.

In short, what's been needed sofar is:

 - verify_active_connections! must be replaced with 
   clear_active_connections!

 - all calls to ActiveRecord::Base.connection must use class methods and 
   not instance methods

 - installing ruby-activerecord-deprecated-finders makes find(:all) work 
   again but throws a ton of deprecation warnings. I'd prefer 
   forward-porting all queries to the rails 4 API.

I hope I'll be able to post a full patch later today.

Cheers,
Apollon


signature.asc
Description: Digital signature


Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-28 Thread intrigeri
Hi,

Apollon Oikonomopoulos wrote (28 Feb 2015 08:29:14 GMT) :
  - installing ruby-activerecord-deprecated-finders makes find(:all) work 
again but throws a ton of deprecation warnings. I'd prefer 
forward-porting all queries to the rails 4 API.

I agree it would be nicer from a programming PoV. However, let's just
keep in mind that the smaller the patch is, the most chances it has to
be accepted into Jessie by the release team :)

 I hope I'll be able to post a full patch later today.

Thanks a lot for working on this! \o/

Cheers,
-- 
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-28 Thread Apollon Oikonomopoulos
Control: tags -1 patch

The attached patch works for me. I did a test using
`puppet master --compile` for a given host and cross-checked the entries 
with those on my real puppet master and everything seems to be working 
fine. Also, exported resources are now being collected.

If anyone can, please give it a try :) Note that you have to install 
ruby-activerecord-deprecated-finders.

Cheers,
Apollon
From 70597df8cc7560236cff59b2835ff0341021a227 Mon Sep 17 00:00:00 2001
From: Apollon Oikonomopoulos apoi...@debian.org
Date: Sat, 28 Feb 2015 11:56:44 +0200
Subject: [PATCH] Storeconfigs compatibility with ActiveRecord 4
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' 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.
---
 lib/puppet/rails.rb  | 5 -
 lib/puppet/rails/fact_name.rb| 1 +
 lib/puppet/rails/fact_value.rb   | 1 +
 lib/puppet/rails/param_value.rb  | 4 ++--
 lib/puppet/rails/resource_tag.rb | 4 ++--
 5 files changed, 10 insertions(+), 5 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/fact_name.rb b/lib/puppet/rails/fact_name.rb
index 073bbcb..e5e1cff 100644
--- a/lib/puppet/rails/fact_name.rb
+++ b/lib/puppet/rails/fact_name.rb
@@ -1,4 +1,5 @@
 require 'active_record'
+require 'active_record/deprecated_finders'
 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..3d69d59 100644
--- a/lib/puppet/rails/fact_value.rb
+++ b/lib/puppet/rails/fact_value.rb
@@ -1,4 +1,5 @@
 require 'active_record'
+require 'active_record/deprecated_finders'
 
 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
+++ 

Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-27 Thread intrigeri
Hi,

intrigeri wrote (09 Feb 2015 15:02:36 GMT) :
 Adding the previous maintainers of ruby-activerecord-3.2 into the
 loop, in case they have an idea. E.g. would it be an option to
 reintroduce the 'verify_active_connections!' method from 3.2 into
 Jessie's ActiveRecord::Base:Class? (I guess not, but if it is, then it
 would possibly be the easiest way forward.)

I gave this option a try, and failed. Here's what I see in the journal:

  puppet-master[25887]: ActiveRecord-based storeconfigs and inventory are 
deprecated. See http://links.puppetlabs.com/activerecord-deprecation
  puppet-master[25887]: (at 
/usr/lib/ruby/vendor_ruby/puppet/indirector/facts/active_record.rb:13:in 
`initialize')
  puppet-master[25887]: Cached facts for jenkins.lizard failed: wrong number of 
arguments (2 for 1)
  puppet-master[25887]: Could not retrieve facts for jenkins.lizard: Couldn't 
find all Puppet::Rails::FactValues with 'id': (all, {:include=:fact_name}) 
[WHERE fact_values.host_id = ?] (found 0 results, but was looking for 2)

My Ruby skills are poor, and the affected area (connection pool
handling) has seen quite some refactoring since 3.x so it was a bit
ambitious for me to try. Perhaps someone who knows Ruby or the Rails
codebase better would easily success where I failed :)

I'm attaching the patches I've added to debian/patches/, and the
resulting debian/patches/series, in case someone wants to try and
avoid starting from scratch. Any taker?

Cheers,
--
intrigeri

From: intrigeri intrig...@debian.org
Date: Fri, 27 Feb 2015 12:18:56 +
Subject: Revert removes verify_active_connections!

This reverts commit 9d1f1b1ea9e5d637984fda4f276db77ffd1dbdcb.
---
 .../connection_adapters/abstract/connection_pool.rb   | 19 +++
 activerecord/lib/active_record/connection_handling.rb |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index b459b94..19318c6 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -332,6 +332,20 @@ module ActiveRecord
 end
   end
 
+  # Verify active connections and remove and disconnect connections
+  # associated with stale threads.
+  def verify_active_connections! #:nodoc:
+synchronize do
+  @connections.each do |connection|
+connection.verify!
+  end
+end
+  end
+
+  def clear_stale_cached_connections! # :nodoc:
+  end
+  deprecate :clear_stale_cached_connections!
+
   # Check-out a database connection from the pool, indicating that you want
   # to use it. You should call #checkin when you no longer need this.
   #
@@ -532,6 +546,11 @@ module ActiveRecord
 connection_pool_list.each(:disconnect!)
   end
 
+  # Verify active connections.
+  def verify_active_connections! #:nodoc:
+connection_pools.each_value {|pool| pool.verify_active_connections! }
+  end
+
   # Locate the connection of the nearest super class. This can be an
   # active or defined connection: if it is the latter, it will be
   # opened and set as the active connection for the class it was defined
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb
index 8f51590..c00ea57 100644
--- a/activerecord/lib/active_record/connection_handling.rb
+++ b/activerecord/lib/active_record/connection_handling.rb
@@ -127,6 +127,6 @@ module ActiveRecord
 end
 
 delegate :clear_active_connections!, :clear_reloadable_connections!,
-  :clear_all_connections!, :to = :connection_handler
+  :clear_all_connections!, :verify_active_connections!, :to = :connection_handler
   end
 end
From: Jonathan Rochkind jonat...@dnil.net
Date: Mon, 12 Mar 2012 11:14:22 -0400
Subject: deprecated clear_stale_active_connections! can call #reap instead of
 no-op'ing, #reap does the same thing

---
 .../lib/active_record/connection_adapters/abstract/connection_pool.rb  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index 19318c6..ccec637 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -343,8 +343,9 @@ module ActiveRecord
   end
 
   def clear_stale_cached_connections! # :nodoc:
+reap
   end
-  deprecate :clear_stale_cached_connections!
+  deprecate :clear_stale_cached_connections! = Please use #reap instead
 
   # Check-out a database connection from the pool, indicating that you want
   

Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-27 Thread intrigeri
Hi,

intrigeri wrote (09 Feb 2015 15:11:38 GMT) :
 Another lead might be to reintroduce ruby-activerecord-3.x into
 Jessie(!). Apparently it also involves getting a compatibility patch
 back into ruby-arel, that was removed in the 5.0.1.20140414130214-1
 upload. Before I test this: is there any upstream security support for
 activerecord 3.x these days?

The way I understand upstream's maintenance [1] and security [2]
policies, and how things went in the past: 3.x currently gets fixes
for Severe security issues only, but once Rails 5.x is out (Fall,
2015) this will stop.

So, I'm afraid this (admittedly crazy) option must be discarded
for Jessie.

[1] http://guides.rubyonrails.org/maintenance_policy.html
[2] http://rubyonrails.org/security/

Cheers,
--
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: [Pkg-puppet-devel] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-27 Thread intrigeri
Hi,

Russ Allbery wrote (10 Feb 2015 02:59:15 GMT) :
 intrigeri intrig...@debian.org writes:
 This sounds RC to me. [...]

 Well, it's RC in the sense that it's a pretty serious regression, but it's
 an optional feature in Puppet and it's entirely possible to use Puppet
 without using storedconfig at all.  (I do both at home and at work.)  So
 in that sense I wouldn't remove Puppet from the jessie release even if
 this functionality were broken, so it falls short of RC in that sense.

Sure, I totally agree. Sorry to have side-tracked and started
discussing bug severity. I'm now trying to refocus on trying to find
a solution :)

 But it's definitely something that we should fix if possible, since it's a
 feature a lot of people use and it would be embarassing for it to not be
 available.

Definitely. It would be quite sad to force lots of people to install
the activerecord 3.x gems, or puppetdb from the PuppetLabs APT repo
(assuming it's compatible with Debian's Puppet packages), or something
like that, just to avoid regressions when upgrading to Jessie.

Cheers,
--
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-09 Thread intrigeri
intrigeri wrote (09 Feb 2015 15:02:36 GMT) :
 E.g. would it be an option to
 reintroduce the 'verify_active_connections!' method from 3.2 into
 Jessie's ActiveRecord::Base:Class? (I guess not, but if it is, then it
 would possibly be the easiest way forward.)

Another lead might be to reintroduce ruby-activerecord-3.x into
Jessie(!). Apparently it also involves getting a compatibility patch
back into ruby-arel, that was removed in the 5.0.1.20140414130214-1
upload. Before I test this: is there any upstream security support for
activerecord 3.x these days?

This option sounds crazy, and I doubt the release team will appreciate
this option, but OTOH we don't want to release with a broken Puppet,
and I'm not sure the other options are any better :(

Other ideas?

Cheers,
--
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-09 Thread intrigeri
Hi,

tl;dr for Debian Ruby Extras maintainers: in Jessie, Puppet's
storeconfig feature can either use activerecord (deprecated, only
works with activerecord 3.x, broken with activerecord 4.x) or PuppetDB
(not packaged in Debian yet). So, currently we have a serious
regression on the Wheezy-Jessie upgrade path.

David Mohr wrote (03 Feb 2015 02:18:51 GMT) :
 I asked about this at puppetlabs:
 http://ask.puppetlabs.com/question/15610/current-activerecords-breaks-puppet-with-storeconfigs/

For the record, what's been replied there is that Puppet 3.7 needs
activerecord 3.x (found in Wheezy) for storeconfig to work without
puppetdb, while Jessie has activerecord 4.1.8, and
ruby-activerecord-3.2 has been removed from unstable in May, 2014.

This sounds RC to me.

Adding the previous maintainers of ruby-activerecord-3.2 into the
loop, in case they have an idea. E.g. would it be an option to
reintroduce the 'verify_active_connections!' method from 3.2 into
Jessie's ActiveRecord::Base:Class? (I guess not, but if it is, then it
would possibly be the easiest way forward.)

Cheers,
--
intrigeri


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: [Pkg-puppet-devel] Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-09 Thread Russ Allbery
intrigeri intrig...@debian.org writes:

 For the record, what's been replied there is that Puppet 3.7 needs
 activerecord 3.x (found in Wheezy) for storeconfig to work without
 puppetdb, while Jessie has activerecord 4.1.8, and ruby-activerecord-3.2
 has been removed from unstable in May, 2014.

 This sounds RC to me.

 Adding the previous maintainers of ruby-activerecord-3.2 into the loop,
 in case they have an idea. E.g. would it be an option to reintroduce the
 'verify_active_connections!' method from 3.2 into Jessie's
 ActiveRecord::Base:Class? (I guess not, but if it is, then it would
 possibly be the easiest way forward.)

Well, it's RC in the sense that it's a pretty serious regression, but it's
an optional feature in Puppet and it's entirely possible to use Puppet
without using storedconfig at all.  (I do both at home and at work.)  So
in that sense I wouldn't remove Puppet from the jessie release even if
this functionality were broken, so it falls short of RC in that sense.

But it's definitely something that we should fix if possible, since it's a
feature a lot of people use and it would be embarassing for it to not be
available.

-- 
Russ Allbery (r...@debian.org)   http://www.eyrie.org/~eagle/


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-06 Thread David Mohr

On 2015-02-02 20:11, micah wrote:

David Mohr b...@da.mcbf.net writes:

Is noone using puppet in jessie with storeconfigs? That seems really 
odd

to me...


Unfortunately, all my puppet recipes are on nothing newer than wheezy
right now, and need some serious tending to before they can get to 
using

the newer version so I haven't had the ability to test this out :o


It doesn't matter what kind of recipe you have. I tried it with a dummy 
catalog and a random exec {} -- it will fail as soon as you set

storeconfigs = true
in puppet.conf

So it's fairly easy to reproduce. Btw the only suggestion I have 
received from ask.puppetlabs.com is to downgrade the package :-(


~David


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-02 Thread David Mohr
I'm also struggling to understand what the issue is. I need 
storedconfigs, but puppetdb is not packaged, and it seems that the 
version of activerecord in jessie is too new for puppet, because 
according to 
http://apidock.com/rails/ActiveRecord/Base/verify_active_connections!/class 
that method isn't available anymore. However, google doesn't return much 
at all about this problem.


I asked about this at puppetlabs: 
http://ask.puppetlabs.com/question/15610/current-activerecords-breaks-puppet-with-storeconfigs/ 
(link currently awaiting moderation).


Let's see if someone offers some insight!

Is noone using puppet in jessie with storeconfigs? That seems really odd 
to me...


Thanks,
~David


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#774643: verify_active_connections is not present in ruby-activerecord 4.1.8

2015-02-02 Thread micah
David Mohr b...@da.mcbf.net writes:

 Is noone using puppet in jessie with storeconfigs? That seems really odd 
 to me...

Unfortunately, all my puppet recipes are on nothing newer than wheezy
right now, and need some serious tending to before they can get to using
the newer version so I haven't had the ability to test this out :o


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org