chef-server-api 0.8.16 → 0.9.0.a3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,158 +1,2 @@
1
- if defined?(Merb::Plugins)
2
- $:.unshift File.dirname(__FILE__)
3
- $:.unshift File.join(File.dirname(__FILE__), "..", "..", "chef-solr", "lib")
4
- $:.unshift File.join(File.dirname(__FILE__), "..", "..", "chef", "lib")
5
-
6
- dependency 'merb-slices', :immediate => true
7
- dependency 'chef', :immediate=>true unless defined?(Chef)
8
- dependency 'bunny', :immediate=>true
9
- dependency 'uuidtools', :immediate=>true
10
-
11
- require 'chef/role'
12
- require 'chef/data_bag'
13
- require 'chef/data_bag_item'
14
- require 'chef/api_client'
15
- require 'chef/webui_user'
16
- require 'chef/certificate'
17
-
18
- require 'mixlib/authentication'
19
-
20
- require 'chef/data_bag'
21
- require 'chef/data_bag_item'
22
- require 'ohai'
23
- require 'openssl'
24
-
25
- Merb::Plugins.add_rakefiles "chef-server-api/merbtasks", "chef-server-api/slicetasks", "chef-server-api/spectasks"
26
-
27
- # Register the Slice for the current host application
28
- Merb::Slices::register(__FILE__)
29
-
30
- Merb.disable :json
31
-
32
- # Slice configuration - set this in a before_app_loads callback.
33
- # By default a Slice uses its own layout, so you can switch to
34
- # the main application layout or no layout at all if needed.
35
- #
36
- # Configuration options:
37
- # :layout - the layout to use; defaults to :chefserverslice
38
- # :mirror - which path component types to use on copy operations; defaults to all
39
- Merb::Slices::config[:chef_server_api][:layout] ||= :chef_server_api
40
-
41
- # All Slice code is expected to be namespaced inside a module
42
- module ChefServerApi
43
- # Slice metadata
44
- self.description = "ChefServerApi.. serving up some piping hot infrastructure!"
45
- self.version = Chef::VERSION
46
- self.author = "Opscode"
47
-
48
- # Stub classes loaded hook - runs before LoadClasses BootLoader
49
- # right after a slice's classes have been loaded internally.
50
- def self.loaded
51
- Chef::Log.info("Compiling routes... (totally normal to see 'Cannot find resource model')")
52
- end
53
-
54
- # Initialization hook - runs before AfterAppLoads BootLoader
55
- def self.init
56
- end
57
-
58
- # Activation hook - runs after AfterAppLoads BootLoader
59
- def self.activate
60
- Mixlib::Authentication::Log.logger = Ohai::Log.logger = Chef::Log.logger
61
-
62
- unless Merb::Config.environment == "test"
63
- # create the couch design docs for nodes, roles, and databags
64
- Chef::CouchDB.new.create_id_map
65
- Chef::Node.create_design_document
66
- Chef::Role.create_design_document
67
- Chef::DataBag.create_design_document
68
- Chef::ApiClient.create_design_document
69
- Chef::WebUIUser.create_design_document
70
-
71
- # Create the signing key and certificate
72
- Chef::Certificate.generate_signing_ca
73
-
74
- # Generate the validation key
75
- Chef::Certificate.gen_validation_key
76
-
77
- # Generate the Web UI Key
78
- Chef::Certificate.gen_validation_key(Chef::Config[:web_ui_client_name], Chef::Config[:web_ui_key], true)
79
-
80
- Chef::Log.info('Loading roles')
81
- Chef::Role.sync_from_disk_to_couchdb
82
- end
83
- end
84
-
85
- # Deactivation hook - triggered by Merb::Slices.deactivate(Chefserver)
86
- def self.deactivate
87
- end
88
-
89
- # Setup routes inside the host application
90
- #
91
- # @param scope<Merb::Router::Behaviour>
92
- # Routes will be added within this scope (namespace). In fact, any
93
- # router behaviour is a valid namespace, so you can attach
94
- # routes at any level of your router setup.
95
- #
96
- # @note prefix your named routes with :chefserverslice_
97
- # to avoid potential conflicts with global named routes.
98
- def self.setup_router(scope)
99
- # Users
100
- scope.resources :users
101
-
102
- # Nodes
103
- scope.resources :nodes, :id => /[^\/]+/
104
- scope.match('/nodes/:id/cookbooks',
105
- :id => /[^\/]+/,
106
- :method => 'get').
107
- to(:controller => "nodes", :action => "cookbooks")
108
- # Roles
109
- scope.resources :roles
110
-
111
- # Status
112
- scope.match("/status").to(:controller => "status", :action => "index").name(:status)
113
-
114
- # Clients
115
- scope.match("/clients", :method=>"post").to(:controller=>'clients', :action=>'create')
116
- scope.match("/clients", :method=>"get").to(:controller=>'clients', :action=>'index').name(:clients)
117
- scope.match("/clients/:id", :id => /[\w\.-]+/, :method=>"get").to(:controller=>'clients', :action=>'show').name(:client)
118
- scope.match("/clients/:id", :id => /[\w\.-]+/, :method=>"put").to(:controller=>'clients', :action=>'update')
119
- scope.match("/clients/:id", :id => /[\w\.-]+/, :method=>"delete").to(:controller=>'clients', :action=>'destroy')
120
-
121
- # Search
122
- scope.resources :search
123
- scope.match('/search/reindex', :method => 'post').to(:controller => "search", :action => "reindex")
124
-
125
- # Cookbooks
126
- scope.match('/nodes/:id/cookbooks', :method => 'get').to(:controller => "nodes", :action => "cookbooks")
127
-
128
- scope.resources :cookbooks
129
- scope.match("/cookbooks/:cookbook_id/_content", :method => 'get', :cookbook_id => /[\w\.]+/).to(:controller => "cookbooks", :action => "get_tarball")
130
- scope.match("/cookbooks/:cookbook_id/_content", :method => 'put', :cookbook_id => /[\w\.]+/).to(:controller => "cookbooks", :action => "update")
131
- scope.match("/cookbooks/:cookbook_id/:segment", :cookbook_id => /[\w\.]+/).to(:controller => "cookbooks", :action => "show_segment").name(:cookbook_segment)
132
-
133
- # Data
134
- scope.match("/data/:data_bag_id/:id", :method => 'get').to(:controller => "data_item", :action => "show").name("data_bag_item")
135
- scope.match("/data/:data_bag_id", :method => 'post').to(:controller => "data_item", :action => "create").name("create_data_bag_item")
136
- scope.match("/data/:data_bag_id/:id", :method => 'put').to(:controller => "data_item", :action => "update").name("update_data_bag_item")
137
- scope.match("/data/:data_bag_id/:id", :method => 'delete').to(:controller => "data_item", :action => "destroy").name("destroy_data_bag_item")
138
- scope.resources :data
139
-
140
- scope.match('/').to(:controller => 'main', :action =>'index').name(:top)
141
- end
142
- end
143
-
144
-
145
- # Setup the slice layout for ChefServerApi
146
- #
147
- # Use ChefServerApi.push_path and ChefServerApi.push_app_path
148
- # to set paths to chefserver-level and app-level paths. Example:
149
- #
150
- # ChefServerApi.push_path(:application, ChefServerApi.root)
151
- # ChefServerApi.push_app_path(:application, Merb.root / 'slices' / 'chefserverslice')
152
- # ...
153
- #
154
- # Any component path that hasn't been set will default to ChefServerApi.root
155
- #
156
- # Or just call setup_default_structure! to setup a basic Merb MVC structure.
157
- ChefServerApi.setup_default_structure!
158
- end
1
+ CHEF_SERVER_VERSION = "0.8.11"
2
+ CHEF_SERVER_API_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
@@ -0,0 +1,3 @@
1
+ module ChefServerApi
2
+ VERSION = '0.9.0.a3'
3
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-server-api
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
- - 8
8
- - 16
9
- version: 0.8.16
7
+ - 9
8
+ - 0
9
+ - a3
10
+ version: 0.9.0.a3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Opscode
@@ -14,12 +15,11 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-11 00:00:00 -07:00
18
+ date: 2010-06-04 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: merb-core
22
- prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
@@ -27,14 +27,14 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  segments:
29
29
  - 1
30
+ - 1
30
31
  - 0
31
- - 0
32
- version: 1.0.0
32
+ version: 1.1.0
33
33
  type: :runtime
34
+ prerelease: false
34
35
  version_requirements: *id001
35
36
  - !ruby/object:Gem::Dependency
36
37
  name: merb-slices
37
- prerelease: false
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
@@ -42,14 +42,14 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  segments:
44
44
  - 1
45
+ - 1
45
46
  - 0
46
- - 0
47
- version: 1.0.0
47
+ version: 1.1.0
48
48
  type: :runtime
49
+ prerelease: false
49
50
  version_requirements: *id002
50
51
  - !ruby/object:Gem::Dependency
51
52
  name: merb-assets
52
- prerelease: false
53
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
54
  none: false
55
55
  requirements:
@@ -57,14 +57,14 @@ dependencies:
57
57
  - !ruby/object:Gem::Version
58
58
  segments:
59
59
  - 1
60
+ - 1
60
61
  - 0
61
- - 0
62
- version: 1.0.0
62
+ version: 1.1.0
63
63
  type: :runtime
64
+ prerelease: false
64
65
  version_requirements: *id003
65
66
  - !ruby/object:Gem::Dependency
66
67
  name: merb-helpers
67
- prerelease: false
68
68
  requirement: &id004 !ruby/object:Gem::Requirement
69
69
  none: false
70
70
  requirements:
@@ -72,15 +72,30 @@ dependencies:
72
72
  - !ruby/object:Gem::Version
73
73
  segments:
74
74
  - 1
75
+ - 1
75
76
  - 0
76
- - 0
77
- version: 1.0.0
77
+ version: 1.1.0
78
78
  type: :runtime
79
+ prerelease: false
79
80
  version_requirements: *id004
80
81
  - !ruby/object:Gem::Dependency
81
- name: json
82
- prerelease: false
82
+ name: merb-param-protection
83
83
  requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 1
90
+ - 1
91
+ - 0
92
+ version: 1.1.0
93
+ type: :runtime
94
+ prerelease: false
95
+ version_requirements: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ name: json
98
+ requirement: &id006 !ruby/object:Gem::Requirement
84
99
  none: false
85
100
  requirements:
86
101
  - - <=
@@ -91,11 +106,11 @@ dependencies:
91
106
  - 2
92
107
  version: 1.4.2
93
108
  type: :runtime
94
- version_requirements: *id005
109
+ prerelease: false
110
+ version_requirements: *id006
95
111
  - !ruby/object:Gem::Dependency
96
112
  name: uuidtools
97
- prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
113
+ requirement: &id007 !ruby/object:Gem::Requirement
99
114
  none: false
100
115
  requirements:
101
116
  - - ~>
@@ -106,11 +121,11 @@ dependencies:
106
121
  - 1
107
122
  version: 2.1.1
108
123
  type: :runtime
109
- version_requirements: *id006
124
+ prerelease: false
125
+ version_requirements: *id007
110
126
  - !ruby/object:Gem::Dependency
111
127
  name: thin
112
- prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
128
+ requirement: &id008 !ruby/object:Gem::Requirement
114
129
  none: false
115
130
  requirements:
116
131
  - - ">="
@@ -119,11 +134,12 @@ dependencies:
119
134
  - 0
120
135
  version: "0"
121
136
  type: :runtime
122
- version_requirements: *id007
137
+ prerelease: false
138
+ version_requirements: *id008
123
139
  description: A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
124
140
  email: chef@opscode.com
125
- executables: []
126
-
141
+ executables:
142
+ - chef-server
127
143
  extensions: []
128
144
 
129
145
  extra_rdoc_files:
@@ -133,28 +149,24 @@ files:
133
149
  - LICENSE
134
150
  - README.rdoc
135
151
  - Rakefile
152
+ - config/environments/development.rb
136
153
  - config/init.rb
154
+ - config/rack.rb
137
155
  - config/router.rb
138
- - lib/chef-server-api/merbtasks.rb
139
- - lib/chef-server-api/slicetasks.rb
140
- - lib/chef-server-api/spectasks.rb
156
+ - lib/chef-server-api/version.rb
141
157
  - lib/chef-server-api.rb
142
158
  - app/controllers/application.rb
143
159
  - app/controllers/clients.rb
144
160
  - app/controllers/cookbooks.rb
145
- - app/controllers/data.rb
161
+ - app/controllers/data_bags.rb
146
162
  - app/controllers/data_item.rb
147
163
  - app/controllers/exceptions.rb
148
164
  - app/controllers/main.rb
149
165
  - app/controllers/nodes.rb
150
166
  - app/controllers/roles.rb
167
+ - app/controllers/sandboxes.rb
151
168
  - app/controllers/search.rb
152
169
  - app/controllers/users.rb
153
- - app/helpers/application_helper.rb
154
- - app/helpers/exceptions_helper.rb
155
- - app/helpers/global_helpers.rb
156
- - app/helpers/nodes_helper.rb
157
- - app/helpers/roles_helper.rb
158
170
  - app/helpers/tarball_helper.rb
159
171
  - app/views/exceptions/bad_request.json.erb
160
172
  - app/views/exceptions/internal_server_error.html.erb
@@ -176,8 +188,7 @@ files:
176
188
  - public/stylesheets/themes/kathleene/style.css
177
189
  - public/stylesheets/themes/orange/style.css
178
190
  - public/stylesheets/themes/reidb-greenish/style.css
179
- - stubs/app/controllers/application.rb
180
- - stubs/app/controllers/main.rb
191
+ - bin/chef-server
181
192
  has_rdoc: true
182
193
  homepage: http://wiki.opscode.com/display/chef
183
194
  licenses: []
@@ -198,15 +209,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
209
  required_rubygems_version: !ruby/object:Gem::Requirement
199
210
  none: false
200
211
  requirements:
201
- - - ">="
212
+ - - ">"
202
213
  - !ruby/object:Gem::Version
203
214
  segments:
204
- - 0
205
- version: "0"
215
+ - 1
216
+ - 3
217
+ - 1
218
+ version: 1.3.1
206
219
  requirements: []
207
220
 
208
221
  rubyforge_project:
209
- rubygems_version: 1.3.6.1
222
+ rubygems_version: 1.3.7
210
223
  signing_key:
211
224
  specification_version: 3
212
225
  summary: A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
@@ -1,163 +0,0 @@
1
- module Merb
2
- module ChefServerApi
3
- module ApplicationHelper
4
-
5
- # Generate the absolute url for a slice - takes the slice's :path_prefix into account.
6
- #
7
- # @param slice_name<Symbol>
8
- # The name of the slice - in identifier_sym format (underscored).
9
- # @param *args<Array[Symbol,Hash]>
10
- # There are several possibilities regarding arguments:
11
- # - when passing a Hash only, the :default route of the current
12
- # slice will be used
13
- # - when a Symbol is passed, it's used as the route name
14
- # - a Hash with additional params can optionally be passed
15
- #
16
- # @return <String> A uri based on the requested slice.
17
- #
18
- # @example absolute_slice_url(:awesome, :format => 'html')
19
- # @example absolute_slice_url(:forum, :posts, :format => 'xml')
20
- def absolute_slice_url(slice_name, *args)
21
- options = extract_options_from_args!(args) || {}
22
- protocol = options.delete(:protocol) || request.protocol
23
- host = options.delete(:host) || request.host
24
-
25
- protocol + "://" + host + slice_url(slice_name,*args)
26
- end
27
-
28
- # @param *segments<Array[#to_s]> Path segments to append.
29
- #
30
- # @return <String>
31
- # A path relative to the public directory, with added segments.
32
- def image_path(*segments)
33
- public_path_for(:image, *segments)
34
- end
35
-
36
- # @param *segments<Array[#to_s]> Path segments to append.
37
- #
38
- # @return <String>
39
- # A path relative to the public directory, with added segments.
40
- def javascript_path(*segments)
41
- public_path_for(:javascript, *segments)
42
- end
43
-
44
- # @param *segments<Array[#to_s]> Path segments to append.
45
- #
46
- # @return <String>
47
- # A path relative to the public directory, with added segments.
48
- def stylesheet_path(*segments)
49
- public_path_for(:stylesheet, *segments)
50
- end
51
-
52
- # Construct a path relative to the public directory
53
- #
54
- # @param <Symbol> The type of component.
55
- # @param *segments<Array[#to_s]> Path segments to append.
56
- #
57
- # @return <String>
58
- # A path relative to the public directory, with added segments.
59
- def public_path_for(type, *segments)
60
- ::ChefServerApi.public_path_for(type, *segments)
61
- end
62
-
63
- # Construct an app-level path.
64
- #
65
- # @param <Symbol> The type of component.
66
- # @param *segments<Array[#to_s]> Path segments to append.
67
- #
68
- # @return <String>
69
- # A path within the host application, with added segments.
70
- def app_path_for(type, *segments)
71
- ::ChefServerApi.app_path_for(type, *segments)
72
- end
73
-
74
- # Construct a slice-level path.
75
- #
76
- # @param <Symbol> The type of component.
77
- # @param *segments<Array[#to_s]> Path segments to append.
78
- #
79
- # @return <String>
80
- # A path within the slice source (Gem), with added segments.
81
- def slice_path_for(type, *segments)
82
- ::ChefServerApi.slice_path_for(type, *segments)
83
- end
84
-
85
- def build_tree(name, node, default={}, override={})
86
- node = Chef::Mixin::DeepMerge.merge(default, node)
87
- node = Chef::Mixin::DeepMerge.merge(node, override)
88
- html = "<table id='#{name}' class='tree table'>"
89
- html << "<tr><th class='first'>Attribute</th><th class='last'>Value</th></tr>"
90
- count = 0
91
- parent = 0
92
- append_tree(name, html, node, count, parent, override)
93
- html << "</table>"
94
- html
95
- end
96
-
97
- def append_tree(name, html, node, count, parent, override)
98
- node.sort{ |a,b| a[0] <=> b[0] }.each do |key, value|
99
- to_send = Array.new
100
- count += 1
101
- is_parent = false
102
- local_html = ""
103
- local_html << "<tr id='#{name}-#{count}' class='collapsed #{name}"
104
- if parent != 0
105
- local_html << " child-of-#{name}-#{parent}' style='display: none;'>"
106
- else
107
- local_html << "'>"
108
- end
109
- local_html << "<td class='table-key'><span toggle='#{name}-#{count}'/>#{key}</td>"
110
- case value
111
- when Hash
112
- is_parent = true
113
- local_html << "<td></td>"
114
- p = count
115
- to_send << Proc.new { append_tree(name, html, value, count, p, override) }
116
- when Array
117
- is_parent = true
118
- local_html << "<td></td>"
119
- as_hash = {}
120
- value.each_index { |i| as_hash[i] = value[i] }
121
- p = count
122
- to_send << Proc.new { append_tree(name, html, as_hash, count, p, override) }
123
- else
124
- local_html << "<td><div class='json-attr'>#{value}</div></td>"
125
- end
126
- local_html << "</tr>"
127
- local_html.sub!(/class='collapsed/, 'class=\'collapsed parent') if is_parent
128
- local_html.sub!(/<span/, "<span class='expander'") if is_parent
129
- html << local_html
130
- to_send.each { |s| count = s.call }
131
- count += to_send.length
132
- end
133
- count
134
- end
135
-
136
- # Recursively build a tree of lists.
137
- #def build_tree(node)
138
- # list = "<dl>"
139
- # list << "\n<!-- Beginning of Tree -->"
140
- # walk = lambda do |key,value|
141
- # case value
142
- # when Hash, Array
143
- # list << "\n<!-- Beginning of Enumerable obj -->"
144
- # list << "\n<dt>#{key}</dt>"
145
- # list << "<dd>"
146
- # list << "\t<dl>\n"
147
- # value.each(&walk)
148
- # list << "\t</dl>\n"
149
- # list << "</dd>"
150
- # list << "\n<!-- End of Enumerable obj -->"
151
- #
152
- # else
153
- # list << "\n<dt>#{key}</dt>"
154
- # list << "<dd>#{value}</dd>"
155
- # end
156
- # end
157
- # node.sort{ |a,b| a[0] <=> b[0] }.each(&walk)
158
- # list << "</dl>"
159
- #end
160
-
161
- end
162
- end
163
- end