summaryrefslogtreecommitdiff
path: root/lib/chef/knife/cookbook_site_share.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/knife/cookbook_site_share.rb')
-rw-r--r--lib/chef/knife/cookbook_site_share.rb54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index ee73bfc26a..560e0669c1 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -131,33 +131,33 @@ class Chef
end
def do_upload(cookbook_filename, cookbook_category, user_id, user_secret_filename)
- uri = "https://supermarket.chef.io/api/v1/cookbooks"
-
- category_string = Chef::JSONCompat.to_json({ 'category'=>cookbook_category })
-
- http_resp = Chef::CookbookSiteStreamingUploader.post(uri, user_id, user_secret_filename, {
- :tarball => File.open(cookbook_filename),
- :cookbook => category_string
- })
-
- res = Chef::JSONCompat.from_json(http_resp.body)
- if http_resp.code.to_i != 201
- if res['error_messages']
- if res['error_messages'][0] =~ /Version already exists/
- ui.error "The same version of this cookbook already exists on the Opscode Cookbook Site."
- exit(1)
- else
- ui.error "#{res['error_messages'][0]}"
- exit(1)
- end
- else
- ui.error "Unknown error while sharing cookbook"
- ui.error "Server response: #{http_resp.body}"
- exit(1)
- end
- end
- res
- end
+ uri = "https://supermarket.chef.io/api/v1/cookbooks"
+
+ category_string = Chef::JSONCompat.to_json({ 'category'=>cookbook_category })
+
+ http_resp = Chef::CookbookSiteStreamingUploader.post(uri, user_id, user_secret_filename, {
+ :tarball => File.open(cookbook_filename),
+ :cookbook => category_string
+ })
+
+ res = Chef::JSONCompat.from_json(http_resp.body)
+ if http_resp.code.to_i != 201
+ if res['error_messages']
+ if res['error_messages'][0] =~ /Version already exists/
+ ui.error "The same version of this cookbook already exists on the Opscode Cookbook Site."
+ exit(1)
+ else
+ ui.error "#{res['error_messages'][0]}"
+ exit(1)
+ end
+ else
+ ui.error "Unknown error while sharing cookbook"
+ ui.error "Server response: #{http_resp.body}"
+ exit(1)
+ end
+ end
+ res
+ end
end
end