[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Luke Kanies luke at puppetlabs.com
Tue May 10 08:04:30 UTC 2011


The following commit has been merged in the experimental branch:
commit efca35cbea836fac954fb655d76493f03b36e96f
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Tue Feb 8 16:24:30 2011 -0800

    Finishing migration from puppet repo
    
    The whole system seems to work again, as long as
    you run it against 2.6.next.
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>

diff --git a/lib/puppet/application/data.rb b/lib/puppet/application/data.rb
index cfbf430..8d98d44 100644
--- a/lib/puppet/application/data.rb
+++ b/lib/puppet/application/data.rb
@@ -52,6 +52,8 @@ class Puppet::Application::Data < Puppet::Application
   def setup
     Puppet::Util::Log.newdestination :console
 
+    load_applications # Call this to load all of the apps
+
     @verb, @arguments = command_line.args
     @arguments ||= []
 
@@ -77,8 +79,15 @@ class Puppet::Application::Data < Puppet::Application
   end
 
   def actions(indirection)
-    return [] unless app = Puppet::Application.find(indirection)
-    return app.actions.sort { |a,b| a.to_s <=> b.to_s }
+    return [] unless interface = Puppet::Interface.interface(indirection)
+    interface.load_actions
+    return interface.actions.sort { |a,b| a.to_s <=> b.to_s }
+  end
+
+  def load_applications
+    command_line.available_subcommands.each do |app|
+      command_line.require_application app
+    end
   end
 end
 
diff --git a/lib/puppet/application/data_baseclass.rb b/lib/puppet/application/data_baseclass.rb
index 95142b8..3f498f5 100644
--- a/lib/puppet/application/data_baseclass.rb
+++ b/lib/puppet/application/data_baseclass.rb
@@ -60,6 +60,7 @@ class Puppet::Application::DataBaseclass < Puppet::Application
     @type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym
 
     @interface = Puppet::Interface.interface(@type).new
+    @interface.format = format if format
 
     validate
 
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index 2be3df5..6e132f6 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -47,6 +47,21 @@ class Puppet::Interface
     Kernel::exit(1)
   end
 
+  # Try to find actions defined in other files.
+  def self.load_actions
+    path = "puppet/interface/#{name}"
+
+    autoloader.search_directories.each do |dir|
+      fdir = File.join(dir, path)
+      next unless FileTest.directory?(fdir)
+
+      Dir.glob("#{fdir}/*.rb").each do |file|
+        Puppet.info "Loading actions for '#{name}' from '#{file}'"
+        require file
+      end
+    end
+  end
+
   # Return the interface name.
   def self.name
     @name || self.to_s.sub(/.+::/, '').downcase
@@ -94,7 +109,7 @@ class Puppet::Interface
 
     Puppet::Util::Log.newdestination :console
 
-    load_actions
+    self.class.load_actions
   end
 
   def set_terminus(from)
@@ -114,27 +129,12 @@ class Puppet::Interface
     end
 
     unless result
-      raise "Could not #{verb} #{type} for #{name}"
+      raise "Could not #{method} #{indirection.name} for #{name}"
     end
 
     puts result.render(format.to_sym)
   end
 
-  # Try to find actions defined in other files.
-  def load_actions
-    path = "puppet/interface/#{self.class.name}"
-
-    self.class.autoloader.search_directories.each do |dir|
-      fdir = File.join(dir, path)
-      next unless FileTest.directory?(fdir)
-
-      Dir.glob("#{fdir}/*.rb").each do |file|
-        Puppet.info "Loading actions for '#{self.class.name}' from '#{file}'"
-        require file
-      end
-    end
-  end
-
   def indirections
       Puppet::Indirector::Indirection.instances.collect { |t| t.to_s }.sort
   end
diff --git a/lib/puppet/interface/catalog/select.rb b/lib/puppet/interface/catalog/select.rb
index 6311a4a..4bb4931 100644
--- a/lib/puppet/interface/catalog/select.rb
+++ b/lib/puppet/interface/catalog/select.rb
@@ -1,4 +1,8 @@
 # Select and show a list of resources of a given type.
 Puppet::Interface::Catalog.action :select do |*args|
-  puts "Selecting #{args.inspect}"
+  host = args.shift
+  type = args.shift
+  catalog = Puppet::Resource::Catalog.indirection.find(host)
+
+  catalog.resources.reject { |res| res.type != type }.each { |res| puts res }
 end
diff --git a/lib/puppet/interface/resource.rb b/lib/puppet/interface/resource.rb
new file mode 100644
index 0000000..b9b007d
--- /dev/null
+++ b/lib/puppet/interface/resource.rb
@@ -0,0 +1,4 @@
+require 'puppet/interface'
+
+class Puppet::Interface::Resource < Puppet::Interface
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list