diff options
author | Pieter van de Bruggen <pieter@puppetlabs.com> | 2011-03-22 13:19:25 -0700 |
---|---|---|
committer | Pieter van de Bruggen <pieter@puppetlabs.com> | 2011-03-22 14:05:47 -0700 |
commit | a58bf959ec49c033e0498916a09e77e303c5792e (patch) | |
tree | 5f0a049580cc9d2a7fe568c3fd9c1cef312ac841 /lib/puppet/interface | |
parent | 45613e0f192778cd16f945d5d1eb109e6c8dee2d (diff) | |
download | puppet-a58bf959ec49c033e0498916a09e77e303c5792e.tar.gz puppet-a58bf959ec49c033e0498916a09e77e303c5792e.tar.xz puppet-a58bf959ec49c033e0498916a09e77e303c5792e.zip |
(#6786) Change interface storage and access.
Ruby's namespace mechanism introduced a number of problems, including
incorrect name resolution for common and simple cases. Given that,
we've refactored back to class-level data structures with accessor
methods available.
The current method names are unlikely to be the final UI.
Reviewed-By: Daniel Pittman
Diffstat (limited to 'lib/puppet/interface')
-rw-r--r-- | lib/puppet/interface/catalog.rb | 2 | ||||
-rw-r--r-- | lib/puppet/interface/catalog/select.rb | 12 | ||||
-rw-r--r-- | lib/puppet/interface/configurer.rb | 9 |
3 files changed, 11 insertions, 12 deletions
diff --git a/lib/puppet/interface/catalog.rb b/lib/puppet/interface/catalog.rb index f99d0881a..34a1d8119 100644 --- a/lib/puppet/interface/catalog.rb +++ b/lib/puppet/interface/catalog.rb @@ -25,7 +25,7 @@ Puppet::Interface::Indirector.new(:catalog) 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.find(certname, facts_to_upload) + catalog = Puppet::Interface.interface(:catalog).find(certname, facts_to_upload) end catalog = catalog.to_ral catalog.finalize diff --git a/lib/puppet/interface/catalog/select.rb b/lib/puppet/interface/catalog/select.rb index 4bb49315c..082d93c34 100644 --- a/lib/puppet/interface/catalog/select.rb +++ b/lib/puppet/interface/catalog/select.rb @@ -1,8 +1,10 @@ # Select and show a list of resources of a given type. -Puppet::Interface::Catalog.action :select do |*args| - host = args.shift - type = args.shift - catalog = Puppet::Resource::Catalog.indirection.find(host) +Puppet::Interface.interface(:catalog) do + action :select do |*args| + host = args.shift + type = args.shift + catalog = Puppet::Resource::Catalog.indirection.find(host) - catalog.resources.reject { |res| res.type != type }.each { |res| puts res } + catalog.resources.reject { |res| res.type != type }.each { |res| puts res } + end end diff --git a/lib/puppet/interface/configurer.rb b/lib/puppet/interface/configurer.rb index 42e950fa3..c1a28b2e7 100644 --- a/lib/puppet/interface/configurer.rb +++ b/lib/puppet/interface/configurer.rb @@ -2,12 +2,9 @@ require 'puppet/interface' Puppet::Interface.new(:configurer) do action(:synchronize) do |certname| - facts = Puppet::Interface::Facts.find(certname) - - catalog = Puppet::Interface::Catalog.download(certname, facts) - - report = Puppet::Interface::Catalog.apply(catalog) - + facts = Puppet::Interface.interface(:facts).find(certname) + catalog = Puppet::Interface.interface(:catalog).download(certname, facts) + report = Puppet::Interface.interface(:catalog).apply(catalog) report end end |