Please review pull request #627: (#13642) Move search notice message opened by (kelseyhightower)

Description:

Currently the PMT search action assumes the searcher implementation will
connect to the HTTP server defined by
Puppet.settings[:module_repository] when searching for modules on the
Forge. The server defined by Puppet.settings[:module_repository] is then
used in a message printed on the console: Searching #{server} …. This
is a little too close to the implementation and the notice has been
moved closer to where the search is actually taking place.

  • Opened: Thu Apr 05 13:03:05 UTC 2012
  • Based on: puppetlabs:2.7.x (d88f3e7c387eff270101604f2fec2e086f88ebdd)
  • Requested merge: kelseyhightower:ticket/2.7.x/13642_move_search_notice (6819cf3480d892091faa01f768b1888f17830155)

Diff follows:

diff --git a/lib/puppet/face/module/search.rb b/lib/puppet/face/module/search.rb
index 0c48808..169f640 100644
--- a/lib/puppet/face/module/search.rb
+++ b/lib/puppet/face/module/search.rb
@@ -21,8 +21,6 @@
     arguments "<search_term>"
 
     when_invoked do |term, options|
-      server = Puppet.settings[:module_repository].sub(/^(?!https?:\/\/)/, 'http://')
-      Puppet.notice "Searching #{server} ..."
       Puppet::Module::Tool::Applications::Searcher.run(term, options)
     end
 
diff --git a/lib/puppet/forge.rb b/lib/puppet/forge.rb
index 8eeb991..722f03b 100644
--- a/lib/puppet/forge.rb
+++ b/lib/puppet/forge.rb
@@ -26,6 +26,8 @@ module Puppet::Forge
   # ]
   #
   def self.search(term)
+    server = Puppet.settings[:module_repository].sub(/^(?!https?:\/\/)/, 'http://')
+    Puppet.notice "Searching #{server} ..."
     request = Net::HTTP::Get.new("/modules.json?q=#{URI.escape(term)}")
     response = repository.make_http_request(request)
 

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to