[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#826551: [Pkg-puppet-devel] RFP: puppetdb-termini -- Enable a Puppet master to connect to PuppetDB



micah <micah@riseup.net> writes:

> I agree that it doesn't look hard to add the terminus package, but I was
> hoping we could provide some kind of upgrade path for people to keep
> their storedconfig database, but I can't seem to figure out what is
> going on here.

Ok, I got it working:

1. wget http://downloads.puppetlabs.com/puppetdb/puppetdb-2.3.8.tar.gz
2. verify and uncompress it
3. cp -avp puppetdb-2.3.8/ext/master/lib/puppet/* /usr/lib/ruby/vendor_ruby/puppet/
4. copy active record dbadapter details to [main] section of puppet.conf
5. apply the attached patch[0] to
/usr/lib/ruby/vendor_ruby/puppet/face/storeconfigs.rb
--- storeconfigs.orig.rb	2016-08-24 09:04:48.428728886 +0000
+++ storeconfigs.rb	2016-08-24 09:51:34.658495419 +0000
@@ -35,16 +35,15 @@
         begin
           Puppet::Rails.connect
 
-          # Fetch all nodes, including exported resources and their params
-          nodes = Puppet::Rails::Host.all(:include => {:resources => [:param_values, :puppet_tags]},
-                                          :conditions => {:resources => {:exported => true}})
-
-          catalogs = nodes.map { |node| node_to_catalog_hash(node) }
-
           catalog_dir = File.join(workdir, 'catalogs')
           FileUtils.mkdir(catalog_dir)
-
-          catalogs.each do |catalog|
+         
+          nodes = []
+          # Fetch all nodes, including exported resources and their params
+          Puppet::Rails::Host.find_each(:include => {:resources => [:param_values, :puppet_tags]},
+                                        :conditions => {:resources => {:exported => true}}, batch_size: 1) do |node|
+            catalog = node_to_catalog_hash(node)
+	    nodes << node[:name]
             filename = File.join(catalog_dir, "#{catalog[:data][:name]}.json")
 
             File.open(filename, 'w') do |file|
@@ -52,7 +51,7 @@
             end
           end
 
-          node_names = nodes.map(&:name).sort
+          node_names = nodes.sort
 
           timestamp = Time.now
6. puppet storeconfigs export
7. copy the exported file to the server running puppetdb software and
import the data with:
puppetdb import --infile ./storeconfigs-2017XXXXXX.tar.gz

This wouldn't be too hard to make work in a debian package, so people
can actually upgrade, but we need the termini package first.

micah

0. https://tickets.puppetlabs.com/browse/PDB-165

Reply to: