diff options
author | Luke Kanies <luke@madstop.com> | 2008-08-20 12:57:26 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-08-20 12:57:26 -0500 |
commit | c8190421a351ed327361a5daca82441be39ce834 (patch) | |
tree | 5eae8eafafacafa817c5e890e03d1a9bcf17358d /lib/puppet | |
parent | 78bc32d0153dd98fadae99dcd71d26fc97210d3c (diff) | |
download | puppet-c8190421a351ed327361a5daca82441be39ce834.tar.gz puppet-c8190421a351ed327361a5daca82441be39ce834.tar.xz puppet-c8190421a351ed327361a5daca82441be39ce834.zip |
Fixing the String format (fixes #1522).
The string format no longer provides any support methods,
which means that I had to create to_multiple_s and from_multiple_s
methods on the SSL classes. I created them in the base class
and tested them just in the cert class.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/network/format.rb | 4 | ||||
-rw-r--r-- | lib/puppet/network/formats.rb | 18 | ||||
-rw-r--r-- | lib/puppet/ssl/base.rb | 11 |
3 files changed, 16 insertions, 17 deletions
diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/format.rb index a4515e39f..5f259fa49 100644 --- a/lib/puppet/network/format.rb +++ b/lib/puppet/network/format.rb @@ -61,6 +61,10 @@ class Puppet::Network::Format klass.instance_methods.include?(render_method) end + def to_s + "Puppet::Network::Format[%s]" % name + end + private attr_reader :intern_method, :render_method, :intern_multiple_method, :render_multiple_method diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb index e11748ce6..8e4c59fb3 100644 --- a/lib/puppet/network/formats.rb +++ b/lib/puppet/network/formats.rb @@ -53,20 +53,4 @@ Puppet::Network::FormatHandler.create(:marshal, :mime => "text/marshal") do end end -Puppet::Network::FormatHandler.create(:s, :mime => "text/plain") do - # For now, use the YAML separator. - SEPARATOR = "\n---\n" - - def intern_multiple(klass, text) - text.split(SEPARATOR).collect { |inst| intern(klass, inst) } - end - - def render_multiple(instances) - instances.collect { |inst| render(inst) }.join(SEPARATOR) - end - - # Everything's supported - def supported?(klass) - true - end -end +Puppet::Network::FormatHandler.create(:s, :mime => "text/plain") diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb index 08efb314b..a005bfaf0 100644 --- a/lib/puppet/ssl/base.rb +++ b/lib/puppet/ssl/base.rb @@ -2,6 +2,17 @@ require 'puppet/ssl' # The base class for wrapping SSL instances. class Puppet::SSL::Base + # For now, use the YAML separator. + SEPARATOR = "\n---\n" + + def self.from_multiple_s(text) + text.split(SEPARATOR).collect { |inst| from_s(inst) } + end + + def self.to_multiple_s(instances) + instances.collect { |inst| inst.to_s }.join(SEPARATOR) + end + def self.wraps(klass) @wrapped_class = klass end |