summaryrefslogtreecommitdiff
path: root/lib/chef/knife/cookbook_site_list.rb
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-05-05 14:29:07 +0100
committerThom May <thom@chef.io>2016-05-05 14:57:34 +0100
commit232f78be0d348e6b07b12f9efbca55f1a66cbb3d (patch)
treec1a1cccfe2a5470f576abc53c675bea7cc3dde67 /lib/chef/knife/cookbook_site_list.rb
parent0f5e73eebbb509750a380ccddfaf112ba415dd4a (diff)
downloadchef-232f78be0d348e6b07b12f9efbca55f1a66cbb3d.tar.gz
Deprecate knife-supermarket gemtm/include_knife_supermarket
Include all knife supermarket sub commands here, and allow all knife cookbook site commands to have a configurable supermarket URL. Signed-off-by: Thom May <thom@may.lt>
Diffstat (limited to 'lib/chef/knife/cookbook_site_list.rb')
-rw-r--r--lib/chef/knife/cookbook_site_list.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/knife/cookbook_site_list.rb b/lib/chef/knife/cookbook_site_list.rb
index abe48bf340..3bdef8abe5 100644
--- a/lib/chef/knife/cookbook_site_list.rb
+++ b/lib/chef/knife/cookbook_site_list.rb
@@ -30,6 +30,13 @@ class Chef
:long => "--with-uri",
:description => "Show corresponding URIs"
+ option :supermarket_site,
+ :short => "-m SUPERMARKET_SITE",
+ :long => "--supermarket-site SUPERMARKET_SITE",
+ :description => "Supermarket Site",
+ :default => "https://supermarket.chef.io",
+ :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+
def run
if config[:with_uri]
cookbooks = Hash.new
@@ -41,7 +48,7 @@ class Chef
end
def get_cookbook_list(items = 10, start = 0, cookbook_collection = {})
- cookbooks_url = "https://supermarket.chef.io/api/v1/cookbooks?items=#{items}&start=#{start}"
+ cookbooks_url = "#{config[:supermarket_site]}/api/v1/cookbooks?items=#{items}&start=#{start}"
cr = noauth_rest.get(cookbooks_url)
cr["items"].each do |cookbook|
cookbook_collection[cookbook["cookbook_name"]] = cookbook