[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:39 UTC 2011
The following commit has been merged in the experimental branch:
commit b3f903af34c0e27dccb1d043d84c35ea68f44830
Author: Luke Kanies <luke at puppetlabs.com>
Date: Wed Feb 16 00:44:44 2011 -0800
Enabling arbitrary interface names
Previously the app, indirection, and interface names
had to match exactly; now they can be arbitrary by
just defining an overriding 'indirection_name' class
method on the interface.
I also renamed the file_bucket_file classes accordingly.
Signed-off-by: Luke Kanies <luke at puppetlabs.com>
diff --git a/lib/puppet/application/data_baseclass.rb b/lib/puppet/application/data_baseclass.rb
index 8da624c..b7393f9 100644
--- a/lib/puppet/application/data_baseclass.rb
+++ b/lib/puppet/application/data_baseclass.rb
@@ -65,7 +65,7 @@ class Puppet::Application::DataBaseclass < Puppet::Application
validate
- raise "Could not find data type #{type} for application #{self.class.name}" unless @indirection = Puppet::Indirector::Indirection.instance(type)
+ raise "Could not find data type #{type} for application #{self.class.name}" unless interface.indirection
@interface.set_terminus(from) if from
end
diff --git a/lib/puppet/application/file.rb b/lib/puppet/application/file.rb
new file mode 100644
index 0000000..2acedda
--- /dev/null
+++ b/lib/puppet/application/file.rb
@@ -0,0 +1,4 @@
+require 'puppet/application/data_baseclass'
+
+class Puppet::Application::File < Puppet::Application::DataBaseclass
+end
diff --git a/lib/puppet/application/file_bucket_file.rb b/lib/puppet/application/file_bucket_file.rb
deleted file mode 100644
index f08a37f..0000000
--- a/lib/puppet/application/file_bucket_file.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/application/data_baseclass'
-
-class Puppet::Application::File_bucket_file < Puppet::Application::DataBaseclass
-end
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index 97e726a..08a26db 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -38,11 +38,17 @@ class Puppet::Interface
end).sort { |a,b| a.to_s <=> b.to_s }
end
+ # Here's your opportunity to override the indirection name. By default
+ # it will be the same name as the interface.
+ def self.indirection_name
+ name.to_sym
+ end
+
# Return an indirection associated with an interface, if one exists
# One usually does.
def self.indirection
unless @indirection
- raise "Could not find data type '#{name}' for interface '#{name}'" unless @indirection = Puppet::Indirector::Indirection.instance(name.to_sym)
+ raise "Could not find data type '#{indirection_name}' for interface '#{name}'" unless @indirection = Puppet::Indirector::Indirection.instance(indirection_name)
end
@indirection
end
@@ -52,6 +58,7 @@ class Puppet::Interface
require "puppet/interface/#{name.to_s.downcase}"
self.const_get(name.to_s.capitalize)
rescue Exception => detail
+ puts detail.backtrace if Puppet[:trace]
$stderr.puts "Unable to find interface '#{name.to_s}': #{detail}."
Kernel::exit(1)
end
@@ -61,7 +68,7 @@ class Puppet::Interface
path = "puppet/interface/#{name}"
autoloader.search_directories.each do |dir|
- fdir = File.join(dir, path)
+ fdir = ::File.join(dir, path)
next unless FileTest.directory?(fdir)
Dir.glob("#{fdir}/*.rb").each do |file|
diff --git a/lib/puppet/interface/file.rb b/lib/puppet/interface/file.rb
new file mode 100644
index 0000000..53c476d
--- /dev/null
+++ b/lib/puppet/interface/file.rb
@@ -0,0 +1,7 @@
+require 'puppet/interface'
+
+class Puppet::Interface::File < Puppet::Interface
+ def self.indirection_name
+ :file_bucket_file
+ end
+end
diff --git a/lib/puppet/interface/file_bucket_file.rb b/lib/puppet/interface/file_bucket_file.rb
deleted file mode 100644
index f34ebc4..0000000
--- a/lib/puppet/interface/file_bucket_file.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/interface'
-
-class Puppet::Interface::File_bucket_file < Puppet::Interface
-end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list