chef-server-api 0.9.12 → 0.9.14.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -11,42 +11,8 @@ rescue LoadError
11
11
  end
12
12
 
13
13
  GEM_NAME = "chef-server-api"
14
- AUTHOR = "Opscode"
15
- EMAIL = "chef@opscode.com"
16
- HOMEPAGE = "http://wiki.opscode.com/display/chef"
17
- SUMMARY = "A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure."
18
14
 
19
- spec = Gem::Specification.new do |s|
20
- s.name = GEM_NAME
21
- s.version = ChefServerApi::VERSION
22
- s.platform = Gem::Platform::RUBY
23
- s.has_rdoc = true
24
- s.extra_rdoc_files = ["README.rdoc", "LICENSE", "config.ru", "development.ru" ]
25
- s.summary = SUMMARY
26
- s.description = s.summary
27
- s.author = AUTHOR
28
- s.email = EMAIL
29
- s.homepage = HOMEPAGE
30
-
31
- s.add_dependency "merb-core", "~> 1.1.0"
32
- s.add_dependency "merb-assets", "~> 1.1.0"
33
- s.add_dependency "merb-helpers", "~> 1.1.0"
34
- s.add_dependency "merb-param-protection", "~> 1.1.0"
35
-
36
- s.add_dependency "mixlib-authentication", '>= 1.1.3'
37
-
38
- s.add_dependency "json", ">= 1.4.4", "<= 1.4.6"
39
-
40
- s.add_dependency "uuidtools", "~> 2.1.1"
41
-
42
- s.add_dependency "thin"
43
-
44
- s.bindir = "bin"
45
- s.executables = %w( chef-server )
46
-
47
- s.require_path = 'lib'
48
- s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{config,lib,spec,app,public,stubs}/**/*")
49
- end
15
+ spec = eval(File.read("chef-server-api.gemspec"))
50
16
 
51
17
  Rake::GemPackageTask.new(spec) do |pkg|
52
18
  pkg.gem_spec = spec
@@ -22,6 +22,7 @@
22
22
  require "chef/mixin/checksum"
23
23
  require "chef/cookbook_loader"
24
24
  require "mixlib/authentication/signatureverification"
25
+ require "chef/json"
25
26
 
26
27
  class Application < Merb::Controller
27
28
 
@@ -102,11 +103,11 @@ class Application < Merb::Controller
102
103
  def access_denied
103
104
  raise Unauthorized, "You must authenticate first!"
104
105
  end
105
-
106
+
106
107
  def get_available_recipes
107
108
  all_cookbooks_list = Chef::CookbookVersion.cdb_list(true)
108
109
  available_recipes = all_cookbooks_list.sort{ |a,b| a.name.to_s <=> b.name.to_s }.inject([]) do |result, element|
109
- element.recipes.sort.each do |r|
110
+ element.recipes.sort.each do |r|
110
111
  if r =~ /^(.+)::default$/
111
112
  result << $1
112
113
  else
@@ -118,5 +119,14 @@ class Application < Merb::Controller
118
119
  available_recipes
119
120
  end
120
121
 
122
+ # Use Chef's JSON conversion library for sending JSON instead of the
123
+ # default Merb, which calls obj.to_json. Fixes CHEF-1292/PL-538.
124
+ override! :display
125
+ def display(obj)
126
+ super(obj, nil, {:max_nesting => Chef::JSON::JSON_MAX_NESTING})
127
+ #super.display(Chef::JSON.to_json(obj))
128
+ #Chef::JSON.to_json(obj)
129
+ end
130
+
121
131
  end
122
132
 
@@ -117,4 +117,4 @@ module ChefServerApi
117
117
 
118
118
  end
119
119
 
120
- end
120
+ end
data/config/router.rb CHANGED
@@ -102,4 +102,37 @@ Merb::Router.prepare do
102
102
 
103
103
  match('/').to(:controller => 'main', :action =>'index').name(:top)
104
104
 
105
+ # Need to monkey patch Merb so that it inflates JSON input with a higher
106
+ # recursion depth allowed (the default is 19). See CHEF-1292/PL-538.
107
+ module Merb
108
+ class Request
109
+ # ==== Returns
110
+ # Hash:: Parameters from body if this is a JSON request.
111
+ #
112
+ # ==== Notes
113
+ # If the JSON object parses as a Hash, it will be merged with the
114
+ # parameters hash. If it parses to anything else (such as an Array, or
115
+ # if it inflates to an Object) it will be accessible via the inflated_object
116
+ # parameter.
117
+ #
118
+ # :api: private
119
+ def json_params
120
+ @json_params ||= begin
121
+ if Merb::Const::JSON_MIME_TYPE_REGEXP.match(content_type)
122
+ begin
123
+ # Call Chef's JSON utility instead of the default in Merb,
124
+ # JSON.parse.
125
+ jobj = Chef::JSON.from_json(raw_post)
126
+ jobj = jobj.to_mash if jobj.is_a?(Hash)
127
+ rescue JSON::ParserError
128
+ jobj = Mash.new
129
+ end
130
+ jobj.is_a?(Hash) ? jobj : { :inflated_object => jobj }
131
+ end
132
+ end
133
+ end
134
+
135
+ end
136
+ end
137
+
105
138
  end
@@ -1,3 +1,3 @@
1
1
  module ChefServerApi
2
- VERSION = '0.9.12'
3
- end
2
+ VERSION = '0.9.14.beta.1'
3
+ end
@@ -277,4 +277,4 @@ ul.list li .item .avatar {
277
277
  -webkit-border-bottom-left-radius: 4px;
278
278
  -moz-border-radius-bottomright: 4px;
279
279
  -webkit-border-bottom-right-radius: 4px;
280
- }
280
+ }
@@ -264,4 +264,4 @@ ul.list li .item .avatar {
264
264
  -webkit-border-bottom-left-radius: 4px;
265
265
  -moz-border-radius-bottomright: 4px;
266
266
  -webkit-border-bottom-right-radius: 4px;
267
- }
267
+ }
@@ -295,4 +295,4 @@ ul.list li .item .avatar {
295
295
  -webkit-border-bottom-left-radius: 4px;
296
296
  -moz-border-radius-bottomright: 4px;
297
297
  -webkit-border-bottom-right-radius: 4px;
298
- }
298
+ }
@@ -260,4 +260,4 @@ ul.list li .item .avatar {
260
260
  -webkit-border-bottom-left-radius: 4px;
261
261
  -moz-border-radius-bottomright: 4px;
262
262
  -webkit-border-bottom-right-radius: 4px;
263
- }
263
+ }
@@ -141,4 +141,4 @@ describe ChefServerApi::SandboxFile do
141
141
 
142
142
  end
143
143
 
144
- end
144
+ end
metadata CHANGED
@@ -1,12 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-server-api
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 62196289
5
+ prerelease: true
5
6
  segments:
6
7
  - 0
7
8
  - 9
8
- - 12
9
- version: 0.9.12
9
+ - 14
10
+ - beta
11
+ - 1
12
+ version: 0.9.14.beta.1
10
13
  platform: ruby
11
14
  authors:
12
15
  - Opscode
@@ -14,91 +17,99 @@ autorequire:
14
17
  bindir: bin
15
18
  cert_chain: []
16
19
 
17
- date: 2010-10-22 00:00:00 -07:00
20
+ date: 2011-02-09 00:00:00 -08:00
18
21
  default_executable:
19
22
  dependencies:
20
23
  - !ruby/object:Gem::Dependency
24
+ type: :runtime
21
25
  name: merb-core
22
- requirement: &id001 !ruby/object:Gem::Requirement
26
+ prerelease: false
27
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
28
  none: false
24
29
  requirements:
25
30
  - - ~>
26
31
  - !ruby/object:Gem::Version
32
+ hash: 19
27
33
  segments:
28
34
  - 1
29
35
  - 1
30
36
  - 0
31
37
  version: 1.1.0
32
- type: :runtime
33
- prerelease: false
34
- version_requirements: *id001
38
+ requirement: *id001
35
39
  - !ruby/object:Gem::Dependency
40
+ type: :runtime
36
41
  name: merb-assets
37
- requirement: &id002 !ruby/object:Gem::Requirement
42
+ prerelease: false
43
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
44
  none: false
39
45
  requirements:
40
46
  - - ~>
41
47
  - !ruby/object:Gem::Version
48
+ hash: 19
42
49
  segments:
43
50
  - 1
44
51
  - 1
45
52
  - 0
46
53
  version: 1.1.0
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: *id002
54
+ requirement: *id002
50
55
  - !ruby/object:Gem::Dependency
56
+ type: :runtime
51
57
  name: merb-helpers
52
- requirement: &id003 !ruby/object:Gem::Requirement
58
+ prerelease: false
59
+ version_requirements: &id003 !ruby/object:Gem::Requirement
53
60
  none: false
54
61
  requirements:
55
62
  - - ~>
56
63
  - !ruby/object:Gem::Version
64
+ hash: 19
57
65
  segments:
58
66
  - 1
59
67
  - 1
60
68
  - 0
61
69
  version: 1.1.0
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: *id003
70
+ requirement: *id003
65
71
  - !ruby/object:Gem::Dependency
72
+ type: :runtime
66
73
  name: merb-param-protection
67
- requirement: &id004 !ruby/object:Gem::Requirement
74
+ prerelease: false
75
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
76
  none: false
69
77
  requirements:
70
78
  - - ~>
71
79
  - !ruby/object:Gem::Version
80
+ hash: 19
72
81
  segments:
73
82
  - 1
74
83
  - 1
75
84
  - 0
76
85
  version: 1.1.0
77
- type: :runtime
78
- prerelease: false
79
- version_requirements: *id004
86
+ requirement: *id004
80
87
  - !ruby/object:Gem::Dependency
88
+ type: :runtime
81
89
  name: mixlib-authentication
82
- requirement: &id005 !ruby/object:Gem::Requirement
90
+ prerelease: false
91
+ version_requirements: &id005 !ruby/object:Gem::Requirement
83
92
  none: false
84
93
  requirements:
85
94
  - - ">="
86
95
  - !ruby/object:Gem::Version
96
+ hash: 21
87
97
  segments:
88
98
  - 1
89
99
  - 1
90
100
  - 3
91
101
  version: 1.1.3
92
- type: :runtime
93
- prerelease: false
94
- version_requirements: *id005
102
+ requirement: *id005
95
103
  - !ruby/object:Gem::Dependency
104
+ type: :runtime
96
105
  name: json
97
- requirement: &id006 !ruby/object:Gem::Requirement
106
+ prerelease: false
107
+ version_requirements: &id006 !ruby/object:Gem::Requirement
98
108
  none: false
99
109
  requirements:
100
110
  - - ">="
101
111
  - !ruby/object:Gem::Version
112
+ hash: 15
102
113
  segments:
103
114
  - 1
104
115
  - 4
@@ -106,42 +117,43 @@ dependencies:
106
117
  version: 1.4.4
107
118
  - - <=
108
119
  - !ruby/object:Gem::Version
120
+ hash: 11
109
121
  segments:
110
122
  - 1
111
123
  - 4
112
124
  - 6
113
125
  version: 1.4.6
114
- type: :runtime
115
- prerelease: false
116
- version_requirements: *id006
126
+ requirement: *id006
117
127
  - !ruby/object:Gem::Dependency
128
+ type: :runtime
118
129
  name: uuidtools
119
- requirement: &id007 !ruby/object:Gem::Requirement
130
+ prerelease: false
131
+ version_requirements: &id007 !ruby/object:Gem::Requirement
120
132
  none: false
121
133
  requirements:
122
134
  - - ~>
123
135
  - !ruby/object:Gem::Version
136
+ hash: 9
124
137
  segments:
125
138
  - 2
126
139
  - 1
127
140
  - 1
128
141
  version: 2.1.1
129
- type: :runtime
130
- prerelease: false
131
- version_requirements: *id007
142
+ requirement: *id007
132
143
  - !ruby/object:Gem::Dependency
144
+ type: :runtime
133
145
  name: thin
134
- requirement: &id008 !ruby/object:Gem::Requirement
146
+ prerelease: false
147
+ version_requirements: &id008 !ruby/object:Gem::Requirement
135
148
  none: false
136
149
  requirements:
137
150
  - - ">="
138
151
  - !ruby/object:Gem::Version
152
+ hash: 3
139
153
  segments:
140
154
  - 0
141
155
  version: "0"
142
- type: :runtime
143
- prerelease: false
144
- version_requirements: *id008
156
+ requirement: *id008
145
157
  description: A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
146
158
  email: chef@opscode.com
147
159
  executables:
@@ -157,49 +169,49 @@ files:
157
169
  - LICENSE
158
170
  - README.rdoc
159
171
  - Rakefile
160
- - config/environments/development.rb
161
172
  - config/init.rb
162
- - config/rack.rb
163
173
  - config/router.rb
174
+ - config/rack.rb
175
+ - config/environments/development.rb
164
176
  - lib/chef-server-api/version.rb
165
177
  - lib/chef-server-api.rb
166
- - spec/spec.opts
167
- - spec/spec_helper.rb
168
178
  - spec/unit/sandbox_file_spec.rb
179
+ - spec/spec_helper.rb
180
+ - spec/spec.opts
181
+ - app/views/layout/chef_server_api.html.haml
182
+ - app/views/main/index.html.haml
183
+ - app/views/exceptions/not_found.html.erb
184
+ - app/views/exceptions/bad_request.json.erb
185
+ - app/views/exceptions/internal_server_error.html.erb
186
+ - app/views/exceptions/standard_error.html.erb
187
+ - app/views/exceptions/not_acceptable.html.haml
188
+ - app/controllers/search.rb
189
+ - app/controllers/exceptions.rb
190
+ - app/controllers/nodes.rb
169
191
  - app/controllers/application.rb
170
- - app/controllers/clients.rb
171
- - app/controllers/cookbooks.rb
172
- - app/controllers/data_bags.rb
173
192
  - app/controllers/data_item.rb
174
- - app/controllers/exceptions.rb
175
193
  - app/controllers/main.rb
176
- - app/controllers/nodes.rb
177
194
  - app/controllers/roles.rb
178
- - app/controllers/sandboxes.rb
179
- - app/controllers/search.rb
180
195
  - app/controllers/users.rb
196
+ - app/controllers/clients.rb
197
+ - app/controllers/sandboxes.rb
198
+ - app/controllers/data_bags.rb
199
+ - app/controllers/cookbooks.rb
181
200
  - app/helpers/tarball_helper.rb
182
201
  - app/models/sandbox_file.rb
183
- - app/views/exceptions/bad_request.json.erb
184
- - app/views/exceptions/internal_server_error.html.erb
185
- - app/views/exceptions/not_acceptable.html.haml
186
- - app/views/exceptions/not_found.html.erb
187
- - app/views/exceptions/standard_error.html.erb
188
- - app/views/layout/chef_server_api.html.haml
189
- - app/views/main/index.html.haml
190
202
  - public/images/avatar.png
191
203
  - public/images/indicator.gif
192
204
  - public/images/merb.jpg
193
205
  - public/stylesheets/base.css
194
206
  - public/stylesheets/chef.css
195
- - public/stylesheets/themes/bec/style.css
196
- - public/stylesheets/themes/bec-green/style.css
197
- - public/stylesheets/themes/blue/style.css
198
207
  - public/stylesheets/themes/default/style.css
199
- - public/stylesheets/themes/djime-cerulean/style.css
200
208
  - public/stylesheets/themes/kathleene/style.css
201
- - public/stylesheets/themes/orange/style.css
209
+ - public/stylesheets/themes/djime-cerulean/style.css
210
+ - public/stylesheets/themes/blue/style.css
211
+ - public/stylesheets/themes/bec-green/style.css
202
212
  - public/stylesheets/themes/reidb-greenish/style.css
213
+ - public/stylesheets/themes/orange/style.css
214
+ - public/stylesheets/themes/bec/style.css
203
215
  - bin/chef-server
204
216
  - config.ru
205
217
  - development.ru
@@ -217,17 +229,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
229
  requirements:
218
230
  - - ">="
219
231
  - !ruby/object:Gem::Version
232
+ hash: 3
220
233
  segments:
221
234
  - 0
222
235
  version: "0"
223
236
  required_rubygems_version: !ruby/object:Gem::Requirement
224
237
  none: false
225
238
  requirements:
226
- - - ">="
239
+ - - ">"
227
240
  - !ruby/object:Gem::Version
241
+ hash: 25
228
242
  segments:
229
- - 0
230
- version: "0"
243
+ - 1
244
+ - 3
245
+ - 1
246
+ version: 1.3.1
231
247
  requirements: []
232
248
 
233
249
  rubyforge_project: