summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-03-26 00:12:17 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-03-28 10:45:34 -0700
commitb859baa04737644e40002f511c5941d002a956e3 (patch)
treef8f4d581c3b0445df836d5e55945f62547239598 /lib/puppet
parent88aeb04a50d8997b5e1e0ed7a5a2239508b174ee (diff)
downloadpuppet-b859baa04737644e40002f511c5941d002a956e3.tar.gz
puppet-b859baa04737644e40002f511c5941d002a956e3.tar.xz
puppet-b859baa04737644e40002f511c5941d002a956e3.zip
MAINT: the API is officially named "string" as of this moment.
Now that we have settled on the final public name for the API, "Puppet::String", mass-rename and mass-edit all the files to follow. Reviewed-By: Randall Hansen <randall@puppetlabs.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/application/config.rb4
-rw-r--r--lib/puppet/application/configurer.rb6
-rw-r--r--lib/puppet/application/indirection_base.rb10
-rw-r--r--lib/puppet/application/string.rb (renamed from lib/puppet/application/interface.rb)18
-rw-r--r--lib/puppet/application/string_base.rb (renamed from lib/puppet/application/interface_base.rb)26
-rw-r--r--lib/puppet/interface/action.rb26
-rw-r--r--lib/puppet/interface/v0.0.1/certificate_request.rb4
-rw-r--r--lib/puppet/interface/v0.0.1/certificate_revocation_list.rb4
-rw-r--r--lib/puppet/interface/v0.0.1/configurer.rb12
-rw-r--r--lib/puppet/interface/v0.0.1/file.rb5
-rw-r--r--lib/puppet/interface/v0.0.1/key.rb4
-rw-r--r--lib/puppet/interface/v0.0.1/node.rb5
-rw-r--r--lib/puppet/interface/v0.0.1/resource.rb4
-rw-r--r--lib/puppet/interface/v0.0.1/resource_type.rb4
-rw-r--r--lib/puppet/interface/v0.0.1/status.rb4
-rw-r--r--lib/puppet/string.rb (renamed from lib/puppet/interface.rb)48
-rw-r--r--lib/puppet/string/action.rb26
-rw-r--r--lib/puppet/string/action_builder.rb (renamed from lib/puppet/interface/action_builder.rb)18
-rw-r--r--lib/puppet/string/action_manager.rb (renamed from lib/puppet/interface/action_manager.rb)8
-rw-r--r--lib/puppet/string/indirector.rb (renamed from lib/puppet/interface/indirector.rb)8
-rw-r--r--lib/puppet/string/string_collection.rb (renamed from lib/puppet/interface/interface_collection.rb)30
-rw-r--r--lib/puppet/string/v0.0.1/catalog.rb (renamed from lib/puppet/interface/v0.0.1/catalog.rb)6
-rw-r--r--lib/puppet/string/v0.0.1/catalog/select.rb (renamed from lib/puppet/interface/v0.0.1/catalog/select.rb)2
-rw-r--r--lib/puppet/string/v0.0.1/certificate.rb (renamed from lib/puppet/interface/v0.0.1/certificate.rb)4
-rw-r--r--lib/puppet/string/v0.0.1/certificate_request.rb4
-rw-r--r--lib/puppet/string/v0.0.1/certificate_revocation_list.rb4
-rw-r--r--lib/puppet/string/v0.0.1/config.rb (renamed from lib/puppet/interface/v0.0.1/config.rb)4
-rw-r--r--lib/puppet/string/v0.0.1/configurer.rb12
-rw-r--r--lib/puppet/string/v0.0.1/facts.rb (renamed from lib/puppet/interface/v0.0.1/facts.rb)4
-rw-r--r--lib/puppet/string/v0.0.1/file.rb5
-rw-r--r--lib/puppet/string/v0.0.1/key.rb4
-rw-r--r--lib/puppet/string/v0.0.1/node.rb5
-rw-r--r--lib/puppet/string/v0.0.1/report.rb (renamed from lib/puppet/interface/v0.0.1/report.rb)4
-rw-r--r--lib/puppet/string/v0.0.1/resource.rb4
-rw-r--r--lib/puppet/string/v0.0.1/resource_type.rb4
-rw-r--r--lib/puppet/string/v0.0.1/status.rb4
36 files changed, 172 insertions, 172 deletions
diff --git a/lib/puppet/application/config.rb b/lib/puppet/application/config.rb
index 90c5f53c4..f6559277b 100644
--- a/lib/puppet/application/config.rb
+++ b/lib/puppet/application/config.rb
@@ -1,4 +1,4 @@
-require 'puppet/application/interface_base'
+require 'puppet/application/string_base'
-class Puppet::Application::Config < Puppet::Application::InterfaceBase
+class Puppet::Application::Config < Puppet::Application::StringBase
end
diff --git a/lib/puppet/application/configurer.rb b/lib/puppet/application/configurer.rb
index 5c9af37d7..b440098ee 100644
--- a/lib/puppet/application/configurer.rb
+++ b/lib/puppet/application/configurer.rb
@@ -1,5 +1,5 @@
require 'puppet/application'
-require 'puppet/interface'
+require 'puppet/string'
class Puppet::Application::Configurer < Puppet::Application
should_parse_config
@@ -17,7 +17,7 @@ class Puppet::Application::Configurer < Puppet::Application
end
def run_command
- report = Puppet::Interface[:configurer, '0.0.1'].synchronize(Puppet[:certname])
- Puppet::Interface[:report, '0.0.1'].submit(report)
+ report = Puppet::String[:configurer, '0.0.1'].synchronize(Puppet[:certname])
+ Puppet::String[:report, '0.0.1'].submit(report)
end
end
diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb
index 7d1c851cf..da61f408d 100644
--- a/lib/puppet/application/indirection_base.rb
+++ b/lib/puppet/application/indirection_base.rb
@@ -1,6 +1,6 @@
-require 'puppet/application/interface_base'
+require 'puppet/application/string_base'
-class Puppet::Application::IndirectionBase < Puppet::Application::InterfaceBase
+class Puppet::Application::IndirectionBase < Puppet::Application::StringBase
option("--terminus TERMINUS") do |arg|
@terminus = arg
end
@@ -10,10 +10,10 @@ class Puppet::Application::IndirectionBase < Puppet::Application::InterfaceBase
def setup
super
- if interface.respond_to?(:indirection)
- raise "Could not find data type #{type} for application #{self.class.name}" unless interface.indirection
+ if string.respond_to?(:indirection)
+ raise "Could not find data type #{type} for application #{self.class.name}" unless string.indirection
- interface.set_terminus(terminus) if terminus
+ string.set_terminus(terminus) if terminus
end
end
end
diff --git a/lib/puppet/application/interface.rb b/lib/puppet/application/string.rb
index f447dc30d..aa369e669 100644
--- a/lib/puppet/application/interface.rb
+++ b/lib/puppet/application/string.rb
@@ -1,7 +1,7 @@
require 'puppet/application'
-require 'puppet/interface'
+require 'puppet/string'
-class Puppet::Application::Interface < Puppet::Application
+class Puppet::Application::String < Puppet::Application
should_parse_config
run_mode :agent
@@ -18,7 +18,7 @@ class Puppet::Application::Interface < Puppet::Application
if arguments.empty?
arguments = %w{terminuses actions}
end
- interfaces.each do |name|
+ strings.each do |name|
str = "#{name}:\n"
if arguments.include?("terminuses")
begin
@@ -68,12 +68,12 @@ class Puppet::Application::Interface < Puppet::Application
end
unless respond_to?(verb)
- raise "Command '#{verb}' not found for 'interface'"
+ raise "Command '#{verb}' not found for 'string'"
end
end
- def interfaces
- Puppet::Interface.interfaces
+ def strings
+ Puppet::String.strings
end
def terminus_classes(indirection)
@@ -81,9 +81,9 @@ class Puppet::Application::Interface < Puppet::Application
end
def actions(indirection)
- return [] unless interface = Puppet::Interface[indirection, '0.0.1']
- interface.load_actions
- return interface.actions.sort { |a,b| a.to_s <=> b.to_s }
+ return [] unless string = Puppet::String[indirection, '0.0.1']
+ string.load_actions
+ return string.actions.sort { |a,b| a.to_s <=> b.to_s }
end
def load_applications
diff --git a/lib/puppet/application/interface_base.rb b/lib/puppet/application/string_base.rb
index 841f3ca12..5b701597d 100644
--- a/lib/puppet/application/interface_base.rb
+++ b/lib/puppet/application/string_base.rb
@@ -1,14 +1,14 @@
require 'puppet/application'
-require 'puppet/interface'
+require 'puppet/string'
-class Puppet::Application::InterfaceBase < Puppet::Application
+class Puppet::Application::StringBase < Puppet::Application
should_parse_config
run_mode :agent
def preinit
super
trap(:INT) do
- $stderr.puts "Cancelling Interface"
+ $stderr.puts "Cancelling String"
exit(0)
end
end
@@ -32,7 +32,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application
end
- attr_accessor :interface, :type, :verb, :arguments, :format
+ attr_accessor :string, :type, :verb, :arguments, :format
attr_writer :exit_code
# This allows you to set the exit code if you don't want to just exit
@@ -43,7 +43,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application
def main
# Call the method associated with the provided action (e.g., 'find').
- if result = interface.send(verb, *arguments)
+ if result = string.send(verb, *arguments)
puts render(result)
end
exit(exit_code)
@@ -72,25 +72,25 @@ class Puppet::Application::InterfaceBase < Puppet::Application
@type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym
# TODO: These should be configurable versions.
- unless Puppet::Interface.interface?(@type, :latest)
- raise "Could not find any version of interface '#{@type}'"
+ unless Puppet::String.string?(@type, :latest)
+ raise "Could not find any version of string '#{@type}'"
end
- @interface = Puppet::Interface[@type, :latest]
- @format ||= @interface.default_format
+ @string = Puppet::String[@type, :latest]
+ @format ||= @string.default_format
- # We copy all of the app options to the interface.
+ # We copy all of the app options to the string.
# This allows each action to read in the options.
- @interface.options = options
+ @string.options = options
validate
end
def validate
unless verb
- raise "You must specify #{interface.actions.join(", ")} as a verb; 'save' probably does not work right now"
+ raise "You must specify #{string.actions.join(", ")} as a verb; 'save' probably does not work right now"
end
- unless interface.action?(verb)
+ unless string.action?(verb)
raise "Command '#{verb}' not found for #{type}"
end
end
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
deleted file mode 100644
index 1a5730d1b..000000000
--- a/lib/puppet/interface/action.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require 'puppet/interface'
-
-class Puppet::Interface::Action
- attr_reader :name
-
- def initialize(interface, name, attrs = {})
- name = name.to_s
- raise "'#{name}' is an invalid action name" unless name =~ /^[a-z]\w*$/
-
- @interface = interface
- @name = name
- attrs.each do |k,v| send("#{k}=", v) end
- end
-
- def invoke(*args, &block)
- @interface.method(name).call(*args,&block)
- end
-
- def invoke=(block)
- if @interface.is_a?(Class)
- @interface.define_method(@name, &block)
- else
- @interface.meta_def(@name, &block)
- end
- end
-end
diff --git a/lib/puppet/interface/v0.0.1/certificate_request.rb b/lib/puppet/interface/v0.0.1/certificate_request.rb
deleted file mode 100644
index e5ed1b51e..000000000
--- a/lib/puppet/interface/v0.0.1/certificate_request.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:certificate_request, '0.0.1') do
-end
diff --git a/lib/puppet/interface/v0.0.1/certificate_revocation_list.rb b/lib/puppet/interface/v0.0.1/certificate_revocation_list.rb
deleted file mode 100644
index f6d8a3d6d..000000000
--- a/lib/puppet/interface/v0.0.1/certificate_revocation_list.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:certificate_revocation_list, '0.0.1') do
-end
diff --git a/lib/puppet/interface/v0.0.1/configurer.rb b/lib/puppet/interface/v0.0.1/configurer.rb
deleted file mode 100644
index 38536b684..000000000
--- a/lib/puppet/interface/v0.0.1/configurer.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'puppet/interface'
-
-Puppet::Interface.define(:configurer, '0.0.1') do
- action(:synchronize) do
- invoke do |certname|
- facts = Puppet::Interface[:facts, '0.0.1'].find(certname)
- catalog = Puppet::Interface[:catalog, '0.0.1'].download(certname, facts)
- report = Puppet::Interface[:catalog, '0.0.1'].apply(catalog)
- report
- end
- end
-end
diff --git a/lib/puppet/interface/v0.0.1/file.rb b/lib/puppet/interface/v0.0.1/file.rb
deleted file mode 100644
index 91904e8e0..000000000
--- a/lib/puppet/interface/v0.0.1/file.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:file, '0.0.1') do
- set_indirection_name :file_bucket_file
-end
diff --git a/lib/puppet/interface/v0.0.1/key.rb b/lib/puppet/interface/v0.0.1/key.rb
deleted file mode 100644
index fbc9b67b1..000000000
--- a/lib/puppet/interface/v0.0.1/key.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:key, '0.0.1') do
-end
diff --git a/lib/puppet/interface/v0.0.1/node.rb b/lib/puppet/interface/v0.0.1/node.rb
deleted file mode 100644
index 4ecec1478..000000000
--- a/lib/puppet/interface/v0.0.1/node.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:node, '0.0.1') do
- set_default_format :yaml
-end
diff --git a/lib/puppet/interface/v0.0.1/resource.rb b/lib/puppet/interface/v0.0.1/resource.rb
deleted file mode 100644
index 1a6f3b69d..000000000
--- a/lib/puppet/interface/v0.0.1/resource.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:resource, '0.0.1') do
-end
diff --git a/lib/puppet/interface/v0.0.1/resource_type.rb b/lib/puppet/interface/v0.0.1/resource_type.rb
deleted file mode 100644
index 6f5547c4d..000000000
--- a/lib/puppet/interface/v0.0.1/resource_type.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:resource_type, '0.0.1') do
-end
diff --git a/lib/puppet/interface/v0.0.1/status.rb b/lib/puppet/interface/v0.0.1/status.rb
deleted file mode 100644
index 7f4b56a2b..000000000
--- a/lib/puppet/interface/v0.0.1/status.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/interface/indirector'
-
-Puppet::Interface::Indirector.define(:status, '0.0.1') do
-end
diff --git a/lib/puppet/interface.rb b/lib/puppet/string.rb
index a667c6b75..b5f7b9048 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/string.rb
@@ -1,12 +1,12 @@
require 'puppet'
require 'puppet/util/autoload'
-class Puppet::Interface
- require 'puppet/interface/action_manager'
- require 'puppet/interface/interface_collection'
+class Puppet::String
+ require 'puppet/string/action_manager'
+ require 'puppet/string/string_collection'
- include Puppet::Interface::ActionManager
- extend Puppet::Interface::ActionManager
+ include Puppet::String::ActionManager
+ extend Puppet::String::ActionManager
include Puppet::Util
@@ -15,33 +15,33 @@ class Puppet::Interface
# list of directories to search.
# Can't we utilize an external autoloader, or simply use the $LOAD_PATH? -pvb
def autoloader
- @autoloader ||= Puppet::Util::Autoload.new(:application, "puppet/interface")
+ @autoloader ||= Puppet::Util::Autoload.new(:application, "puppet/string")
end
- def interfaces
- Puppet::Interface::InterfaceCollection.interfaces
+ def strings
+ Puppet::String::StringCollection.strings
end
- def interface?(name, version)
- Puppet::Interface::InterfaceCollection.interface?(name, version)
+ def string?(name, version)
+ Puppet::String::StringCollection.string?(name, version)
end
def register(instance)
- Puppet::Interface::InterfaceCollection.register(instance)
+ Puppet::String::StringCollection.register(instance)
end
def define(name, version, &block)
- if interface?(name, version)
- interface = Puppet::Interface::InterfaceCollection[name, version]
+ if string?(name, version)
+ string = Puppet::String::StringCollection[name, version]
else
- interface = self.new(name, version)
- Puppet::Interface::InterfaceCollection.register(interface)
- interface.load_actions
+ string = self.new(name, version)
+ Puppet::String::StringCollection.register(string)
+ string.load_actions
end
- interface.instance_eval(&block) if block_given?
+ string.instance_eval(&block) if block_given?
- return interface
+ return string
end
alias :[] :define
@@ -57,11 +57,11 @@ class Puppet::Interface
attr_reader :name
def initialize(name, version, &block)
- unless Puppet::Interface::InterfaceCollection.validate_version(version)
- raise ArgumentError, "Cannot create interface with invalid version number '#{version}'!"
+ unless Puppet::String::StringCollection.validate_version(version)
+ raise ArgumentError, "Cannot create string with invalid version number '#{version}'!"
end
- @name = Puppet::Interface::InterfaceCollection.underscorize(name)
+ @name = Puppet::String::StringCollection.underscorize(name)
@version = version
@default_format = :pson
@@ -70,10 +70,10 @@ class Puppet::Interface
# Try to find actions defined in other files.
def load_actions
- path = "puppet/interface/v#{version}/#{name}"
+ path = "puppet/string/v#{version}/#{name}"
loaded = []
- Puppet::Interface.autoloader.search_directories.each do |dir|
+ Puppet::String.autoloader.search_directories.each do |dir|
fdir = ::File.join(dir, path)
next unless FileTest.directory?(fdir)
@@ -93,6 +93,6 @@ class Puppet::Interface
end
def to_s
- "Puppet::Interface[#{name.inspect}, #{version.inspect}]"
+ "Puppet::String[#{name.inspect}, #{version.inspect}]"
end
end
diff --git a/lib/puppet/string/action.rb b/lib/puppet/string/action.rb
new file mode 100644
index 000000000..4db9e97e2
--- /dev/null
+++ b/lib/puppet/string/action.rb
@@ -0,0 +1,26 @@
+require 'puppet/string'
+
+class Puppet::String::Action
+ attr_reader :name
+
+ def initialize(string, name, attrs = {})
+ name = name.to_s
+ raise "'#{name}' is an invalid action name" unless name =~ /^[a-z]\w*$/
+
+ @string = string
+ @name = name
+ attrs.each do |k,v| send("#{k}=", v) end
+ end
+
+ def invoke(*args, &block)
+ @string.method(name).call(*args,&block)
+ end
+
+ def invoke=(block)
+ if @string.is_a?(Class)
+ @string.define_method(@name, &block)
+ else
+ @string.meta_def(@name, &block)
+ end
+ end
+end
diff --git a/lib/puppet/interface/action_builder.rb b/lib/puppet/string/action_builder.rb
index e389ea3ea..b3db51104 100644
--- a/lib/puppet/interface/action_builder.rb
+++ b/lib/puppet/string/action_builder.rb
@@ -1,24 +1,24 @@
-require 'puppet/interface'
-require 'puppet/interface/action'
+require 'puppet/string'
+require 'puppet/string/action'
-class Puppet::Interface::ActionBuilder
+class Puppet::String::ActionBuilder
attr_reader :action
- def self.build(interface, name, &block)
+ def self.build(string, name, &block)
name = name.to_s
raise "Action '#{name}' must specify a block" unless block
- builder = new(interface, name, &block)
+ builder = new(string, name, &block)
builder.action
end
- def initialize(interface, name, &block)
- @interface = interface
- @action = Puppet::Interface::Action.new(interface, name)
+ def initialize(string, name, &block)
+ @string = string
+ @action = Puppet::String::Action.new(string, name)
instance_eval(&block)
end
# Ideally the method we're defining here would be added to the action, and a
- # method on the interface would defer to it, but we can't get scope correct,
+ # method on the string would defer to it, but we can't get scope correct,
# so we stick with this. --daniel 2011-03-24
def invoke(&block)
raise "Invoke called on an ActionBuilder with no corresponding Action" unless @action
diff --git a/lib/puppet/interface/action_manager.rb b/lib/puppet/string/action_manager.rb
index 8b2944bb1..c29dbf454 100644
--- a/lib/puppet/interface/action_manager.rb
+++ b/lib/puppet/string/action_manager.rb
@@ -1,6 +1,6 @@
-require 'puppet/interface/action_builder'
+require 'puppet/string/action_builder'
-module Puppet::Interface::ActionManager
+module Puppet::String::ActionManager
# Declare that this app can take a specific action, and provide
# the code to do so.
def action(name, &block)
@@ -9,7 +9,7 @@ module Puppet::Interface::ActionManager
raise "Action #{name} already defined for #{self}" if action?(name)
- action = Puppet::Interface::ActionBuilder.build(self, name, &block)
+ action = Puppet::String::ActionBuilder.build(self, name, &block)
@actions[name] = action
end
@@ -20,7 +20,7 @@ module Puppet::Interface::ActionManager
@actions ||= {}
name = name.to_s.downcase.to_sym
raise "Action #{name} already defined for #{self}" if action?(name)
- @actions[name] = Puppet::Interface::Action.new(self, name, :invoke => block)
+ @actions[name] = Puppet::String::Action.new(self, name, :invoke => block)
end
def actions
diff --git a/lib/puppet/interface/indirector.rb b/lib/puppet/string/indirector.rb
index 485af4779..15984e39e 100644
--- a/lib/puppet/interface/indirector.rb
+++ b/lib/puppet/string/indirector.rb
@@ -1,7 +1,7 @@
require 'puppet'
-require 'puppet/interface'
+require 'puppet/string'
-class Puppet::Interface::Indirector < Puppet::Interface
+class Puppet::String::Indirector < Puppet::String
def self.indirections
Puppet::Indirector::Indirection.instances.collect { |t| t.to_s }.sort
end
@@ -44,12 +44,12 @@ class Puppet::Interface::Indirector < Puppet::Interface
end
# Here's your opportunity to override the indirection name. By default
- # it will be the same name as the interface.
+ # it will be the same name as the string.
def set_indirection_name(name)
@indirection_name = name
end
- # Return an indirection associated with an interface, if one exists
+ # Return an indirection associated with an string, if one exists
# One usually does.
def indirection
unless @indirection
diff --git a/lib/puppet/interface/interface_collection.rb b/lib/puppet/string/string_collection.rb
index 92e2933fe..e9cba7f55 100644
--- a/lib/puppet/interface/interface_collection.rb
+++ b/lib/puppet/string/string_collection.rb
@@ -1,17 +1,17 @@
-require 'puppet/interface'
+require 'puppet/string'
-module Puppet::Interface::InterfaceCollection
+module Puppet::String::StringCollection
SEMVER_VERSION = /^(\d+)\.(\d+)\.(\d+)([A-Za-z][0-9A-Za-z-]*|)$/
- @interfaces = Hash.new { |hash, key| hash[key] = {} }
+ @strings = Hash.new { |hash, key| hash[key] = {} }
- def self.interfaces
+ def self.strings
unless @loaded
@loaded = true
$LOAD_PATH.each do |dir|
next unless FileTest.directory?(dir)
Dir.chdir(dir) do
- Dir.glob("puppet/interface/v*/*.rb").collect { |f| f.sub(/\.rb/, '') }.each do |file|
+ Dir.glob("puppet/string/v*/*.rb").collect { |f| f.sub(/\.rb/, '') }.each do |file|
iname = file.sub(/\.rb/, '')
begin
require iname
@@ -23,14 +23,14 @@ module Puppet::Interface::InterfaceCollection
end
end
end
- return @interfaces.keys
+ return @strings.keys
end
def self.versions(name)
versions = []
$LOAD_PATH.each do |dir|
next unless FileTest.directory?(dir)
- v_dir = File.join dir, %w[puppet interface v*]
+ v_dir = File.join dir, %w[puppet string v*]
Dir.glob(File.join v_dir, "#{name}{.rb,/*.rb}").each do |f|
v = f.sub(%r[.*/v([^/]+?)/#{name}(?:(?:/[^/]+)?.rb)$], '\1')
if validate_version(v)
@@ -66,31 +66,31 @@ module Puppet::Interface::InterfaceCollection
def self.[](name, version)
version = versions(name).last if version == :latest
unless version.nil?
- @interfaces[underscorize(name)][version] if interface?(name, version)
+ @strings[underscorize(name)][version] if string?(name, version)
end
end
- def self.interface?(name, version)
+ def self.string?(name, version)
version = versions(name).last if version == :latest
return false if version.nil?
name = underscorize(name)
- unless @interfaces.has_key?(name) && @interfaces[name].has_key?(version)
- require "puppet/interface/v#{version}/#{name}"
+ unless @strings.has_key?(name) && @strings[name].has_key?(version)
+ require "puppet/string/v#{version}/#{name}"
end
- return @interfaces.has_key?(name) && @interfaces[name].has_key?(version)
+ return @strings.has_key?(name) && @strings[name].has_key?(version)
rescue LoadError
return false
end
- def self.register(interface)
- @interfaces[underscorize(interface.name)][interface.version] = interface
+ def self.register(string)
+ @strings[underscorize(string.name)][string.version] = string
end
def self.underscorize(name)
unless name.to_s =~ /^[-_a-z]+$/i then
- raise ArgumentError, "#{name.inspect} (#{name.class}) is not a valid interface name"
+ raise ArgumentError, "#{name.inspect} (#{name.class}) is not a valid string name"
end
name.to_s.downcase.split(/[-_]/).join('_').to_sym
diff --git a/lib/puppet/interface/v0.0.1/catalog.rb b/lib/puppet/string/v0.0.1/catalog.rb
index 7d61528bc..0ddd83176 100644
--- a/lib/puppet/interface/v0.0.1/catalog.rb
+++ b/lib/puppet/string/v0.0.1/catalog.rb
@@ -1,6 +1,6 @@
-require 'puppet/interface/indirector'
+require 'puppet/string/indirector'
-Puppet::Interface::Indirector.define(:catalog, '0.0.1') do
+Puppet::String::Indirector.define(:catalog, '0.0.1') do
action(:apply) do
invoke do |catalog|
report = Puppet::Transaction::Report.new("apply")
@@ -28,7 +28,7 @@ Puppet::Interface::Indirector.define(:catalog, '0.0.1') do
facts_to_upload = {:facts_format => :b64_zlib_yaml, :facts => CGI.escape(facts.render(:b64_zlib_yaml))}
catalog = nil
retrieval_duration = thinmark do
- catalog = Puppet::Interface[:catalog, '0.0.1'].find(certname, facts_to_upload)
+ catalog = Puppet::String[:catalog, '0.0.1'].find(certname, facts_to_upload)
end
catalog = catalog.to_ral
catalog.finalize
diff --git a/lib/puppet/interface/v0.0.1/catalog/select.rb b/lib/puppet/string/v0.0.1/catalog/select.rb
index 35f1a1e0b..52c77d3ce 100644
--- a/lib/puppet/interface/v0.0.1/catalog/select.rb
+++ b/lib/puppet/string/v0.0.1/catalog/select.rb
@@ -1,5 +1,5 @@
# Select and show a list of resources of a given type.
-Puppet::Interface.define(:catalog, '0.0.1') do
+Puppet::String.define(:catalog, '0.0.1') do
action :select do
invoke do |host,type|
catalog = Puppet::Resource::Catalog.indirection.find(host)
diff --git a/lib/puppet/interface/v0.0.1/certificate.rb b/lib/puppet/string/v0.0.1/certificate.rb
index 2615e3d86..7b2e5f397 100644
--- a/lib/puppet/interface/v0.0.1/certificate.rb
+++ b/lib/puppet/string/v0.0.1/certificate.rb
@@ -1,7 +1,7 @@
-require 'puppet/interface/indirector'
+require 'puppet/string/indirector'
require 'puppet/ssl/host'
-Puppet::Interface::Indirector.define(:certificate, '0.0.1') do
+Puppet::String::Indirector.define(:certificate, '0.0.1') do
action :generate do
invoke do |name|
diff --git a/lib/puppet/string/v0.0.1/certificate_request.rb b/lib/puppet/string/v0.0.1/certificate_request.rb
new file mode 100644
index 000000000..218b40b98
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/certificate_request.rb
@@ -0,0 +1,4 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:certificate_request, '0.0.1') do
+end
diff --git a/lib/puppet/string/v0.0.1/certificate_revocation_list.rb b/lib/puppet/string/v0.0.1/certificate_revocation_list.rb
new file mode 100644
index 000000000..9731b4f2d
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/certificate_revocation_list.rb
@@ -0,0 +1,4 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:certificate_revocation_list, '0.0.1') do
+end
diff --git a/lib/puppet/interface/v0.0.1/config.rb b/lib/puppet/string/v0.0.1/config.rb
index 7b74ce542..ae1a408cf 100644
--- a/lib/puppet/interface/v0.0.1/config.rb
+++ b/lib/puppet/string/v0.0.1/config.rb
@@ -1,6 +1,6 @@
-require 'puppet/interface'
+require 'puppet/string'
-Puppet::Interface.define(:config, '0.0.1') do
+Puppet::String.define(:config, '0.0.1') do
action(:print) do
invoke do |*args|
Puppet.settings[:configprint] = args.join(",")
diff --git a/lib/puppet/string/v0.0.1/configurer.rb b/lib/puppet/string/v0.0.1/configurer.rb
new file mode 100644
index 000000000..a6ea74b6a
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/configurer.rb
@@ -0,0 +1,12 @@
+require 'puppet/string'
+
+Puppet::String.define(:configurer, '0.0.1') do
+ action(:synchronize) do
+ invoke do |certname|
+ facts = Puppet::String[:facts, '0.0.1'].find(certname)
+ catalog = Puppet::String[:catalog, '0.0.1'].download(certname, facts)
+ report = Puppet::String[:catalog, '0.0.1'].apply(catalog)
+ report
+ end
+ end
+end
diff --git a/lib/puppet/interface/v0.0.1/facts.rb b/lib/puppet/string/v0.0.1/facts.rb
index c4bbad845..73acb0df6 100644
--- a/lib/puppet/interface/v0.0.1/facts.rb
+++ b/lib/puppet/string/v0.0.1/facts.rb
@@ -1,7 +1,7 @@
-require 'puppet/interface/indirector'
+require 'puppet/string/indirector'
require 'puppet/node/facts'
-Puppet::Interface::Indirector.define(:facts, '0.0.1') do
+Puppet::String::Indirector.define(:facts, '0.0.1') do
set_default_format :yaml
# Upload our facts to the server
diff --git a/lib/puppet/string/v0.0.1/file.rb b/lib/puppet/string/v0.0.1/file.rb
new file mode 100644
index 000000000..cc5737f28
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/file.rb
@@ -0,0 +1,5 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:file, '0.0.1') do
+ set_indirection_name :file_bucket_file
+end
diff --git a/lib/puppet/string/v0.0.1/key.rb b/lib/puppet/string/v0.0.1/key.rb
new file mode 100644
index 000000000..95aceade5
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/key.rb
@@ -0,0 +1,4 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:key, '0.0.1') do
+end
diff --git a/lib/puppet/string/v0.0.1/node.rb b/lib/puppet/string/v0.0.1/node.rb
new file mode 100644
index 000000000..bc31a2cf3
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/node.rb
@@ -0,0 +1,5 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:node, '0.0.1') do
+ set_default_format :yaml
+end
diff --git a/lib/puppet/interface/v0.0.1/report.rb b/lib/puppet/string/v0.0.1/report.rb
index bacb46e70..55a008533 100644
--- a/lib/puppet/interface/v0.0.1/report.rb
+++ b/lib/puppet/string/v0.0.1/report.rb
@@ -1,6 +1,6 @@
-require 'puppet/interface/indirector'
+require 'puppet/string/indirector'
-Puppet::Interface::Indirector.define(:report, '0.0.1') do
+Puppet::String::Indirector.define(:report, '0.0.1') do
action(:submit) do
invoke do |report|
begin
diff --git a/lib/puppet/string/v0.0.1/resource.rb b/lib/puppet/string/v0.0.1/resource.rb
new file mode 100644
index 000000000..9838be0fa
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/resource.rb
@@ -0,0 +1,4 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:resource, '0.0.1') do
+end
diff --git a/lib/puppet/string/v0.0.1/resource_type.rb b/lib/puppet/string/v0.0.1/resource_type.rb
new file mode 100644
index 000000000..8ca31ea6c
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/resource_type.rb
@@ -0,0 +1,4 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:resource_type, '0.0.1') do
+end
diff --git a/lib/puppet/string/v0.0.1/status.rb b/lib/puppet/string/v0.0.1/status.rb
new file mode 100644
index 000000000..41de2bb99
--- /dev/null
+++ b/lib/puppet/string/v0.0.1/status.rb
@@ -0,0 +1,4 @@
+require 'puppet/string/indirector'
+
+Puppet::String::Indirector.define(:status, '0.0.1') do
+end