chef-server-webui 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +201 -0
- data/README.rdoc +135 -0
- data/Rakefile +62 -0
- data/app/controllers/application.rb +281 -0
- data/app/controllers/clients.rb +120 -0
- data/app/controllers/cookbook_attributes.rb +41 -0
- data/app/controllers/cookbook_definitions.rb +41 -0
- data/app/controllers/cookbook_files.rb +39 -0
- data/app/controllers/cookbook_libraries.rb +41 -0
- data/app/controllers/cookbook_recipes.rb +40 -0
- data/app/controllers/cookbook_templates.rb +57 -0
- data/app/controllers/cookbooks.rb +78 -0
- data/app/controllers/databag_items.rb +102 -0
- data/app/controllers/databags.rb +83 -0
- data/app/controllers/exceptions.rb +19 -0
- data/app/controllers/main.rb +7 -0
- data/app/controllers/nodes.rb +138 -0
- data/app/controllers/openid_consumer.rb +154 -0
- data/app/controllers/roles.rb +144 -0
- data/app/controllers/search.rb +62 -0
- data/app/controllers/search_entries.rb +64 -0
- data/app/controllers/status.rb +39 -0
- data/app/controllers/users.rb +186 -0
- data/app/helpers/application_helper.rb +171 -0
- data/app/helpers/cookbook_attributes_helper.rb +7 -0
- data/app/helpers/cookbook_definitions_helper.rb +8 -0
- data/app/helpers/cookbook_files_helper.rb +8 -0
- data/app/helpers/cookbook_libraries_helper.rb +7 -0
- data/app/helpers/cookbook_recipes_helper.rb +8 -0
- data/app/helpers/cookbook_templates_helper.rb +8 -0
- data/app/helpers/exceptions_helper.rb +6 -0
- data/app/helpers/global_helpers.rb +35 -0
- data/app/helpers/nodes_helper.rb +41 -0
- data/app/helpers/openid_consumer_helper.rb +8 -0
- data/app/helpers/openid_register_helper.rb +8 -0
- data/app/helpers/openid_server_helper.rb +6 -0
- data/app/helpers/openid_server_helpers.rb +29 -0
- data/app/helpers/roles_helper.rb +5 -0
- data/app/helpers/search_entries_helper.rb +8 -0
- data/app/helpers/search_helper.rb +38 -0
- data/app/helpers/status_helper.rb +26 -0
- data/app/views/clients/_form.html.haml +22 -0
- data/app/views/clients/_navigation.html.haml +9 -0
- data/app/views/clients/edit.html.haml +6 -0
- data/app/views/clients/index.html.haml +21 -0
- data/app/views/clients/new.html.haml +6 -0
- data/app/views/clients/show.html.haml +20 -0
- data/app/views/cookbooks/index.html.haml +10 -0
- data/app/views/cookbooks/show.html.haml +40 -0
- data/app/views/databag_items/_form.html.haml +14 -0
- data/app/views/databag_items/_navigation.html.haml +9 -0
- data/app/views/databag_items/edit.html.haml +6 -0
- data/app/views/databag_items/index.html.haml +0 -0
- data/app/views/databag_items/new.html.haml +6 -0
- data/app/views/databag_items/show.html.haml +9 -0
- data/app/views/databags/_form.html.haml +12 -0
- data/app/views/databags/_item_navigation.html.haml +8 -0
- data/app/views/databags/_navigation.html.haml +9 -0
- data/app/views/databags/edit.html.haml +6 -0
- data/app/views/databags/index.html.haml +19 -0
- data/app/views/databags/new.html.haml +6 -0
- data/app/views/databags/show.html.haml +19 -0
- data/app/views/exceptions/bad_request.json.erb +1 -0
- data/app/views/exceptions/internal_server_error.html.erb +216 -0
- data/app/views/exceptions/not_acceptable.html.erb +63 -0
- data/app/views/exceptions/not_found.html.erb +47 -0
- data/app/views/exceptions/standard_error.html.erb +217 -0
- data/app/views/layout/_jsonedit.html.haml +82 -0
- data/app/views/layout/chef_server_webui.html.haml +56 -0
- data/app/views/layout/login.html.haml +36 -0
- data/app/views/main/index.html.erb +1 -0
- data/app/views/nodes/_action.html.haml +13 -0
- data/app/views/nodes/_form.html.haml +53 -0
- data/app/views/nodes/_navigation.html.haml +9 -0
- data/app/views/nodes/_resource.html.haml +22 -0
- data/app/views/nodes/edit.html.haml +7 -0
- data/app/views/nodes/index.html.haml +25 -0
- data/app/views/nodes/new.html.haml +6 -0
- data/app/views/nodes/show.html.haml +60 -0
- data/app/views/openid_consumer/index.html.haml +28 -0
- data/app/views/openid_consumer/start.html.haml +4 -0
- data/app/views/openid_login/index.html.haml +5 -0
- data/app/views/openid_register/index.html.haml +19 -0
- data/app/views/openid_register/show.html.haml +7 -0
- data/app/views/roles/_form.html.haml +53 -0
- data/app/views/roles/_navigation.html.haml +9 -0
- data/app/views/roles/edit.html.haml +6 -0
- data/app/views/roles/index.html.haml +21 -0
- data/app/views/roles/new.html.haml +6 -0
- data/app/views/roles/show.html.haml +54 -0
- data/app/views/search/_search_form.html.haml +6 -0
- data/app/views/search/index.html.haml +8 -0
- data/app/views/search/show.html.haml +13 -0
- data/app/views/search_entries/index.html.haml +8 -0
- data/app/views/search_entries/show.html.haml +7 -0
- data/app/views/status/index.html.haml +90 -0
- data/app/views/users/_form.html.haml +39 -0
- data/app/views/users/_navigation.html.haml +9 -0
- data/app/views/users/edit.html.haml +6 -0
- data/app/views/users/index.html.haml +20 -0
- data/app/views/users/login.html.haml +16 -0
- data/app/views/users/new.html.haml +27 -0
- data/app/views/users/show.html.haml +13 -0
- data/app/views/users/start.html.haml +4 -0
- data/config.ru +84 -0
- data/config/init.rb +49 -0
- data/config/router.rb +6 -0
- data/lib/chef-server-webui.rb +155 -0
- data/lib/chef-server-webui/merbtasks.rb +103 -0
- data/lib/chef-server-webui/slicetasks.rb +20 -0
- data/lib/chef-server-webui/spectasks.rb +53 -0
- data/public/facebox/README.txt +4 -0
- data/public/facebox/b.png +0 -0
- data/public/facebox/bl.png +0 -0
- data/public/facebox/br.png +0 -0
- data/public/facebox/closelabel.gif +0 -0
- data/public/facebox/facebox.css +95 -0
- data/public/facebox/facebox.js +319 -0
- data/public/facebox/loading.gif +0 -0
- data/public/facebox/tl.png +0 -0
- data/public/facebox/tr.png +0 -0
- data/public/images/avatar.png +0 -0
- data/public/images/black_big.png +0 -0
- data/public/images/indicator.gif +0 -0
- data/public/images/jsonedit/add2.png +0 -0
- data/public/images/jsonedit/build-button.png +0 -0
- data/public/images/jsonedit/bullet.gif +0 -0
- data/public/images/jsonedit/bullet_orange.png +0 -0
- data/public/images/jsonedit/cross.png +0 -0
- data/public/images/jsonedit/delete.png +0 -0
- data/public/images/jsonedit/deleted.png +0 -0
- data/public/images/jsonedit/json.jpg +0 -0
- data/public/images/jsonedit/label.gif +0 -0
- data/public/images/jsonedit/minus.gif +0 -0
- data/public/images/jsonedit/pixel.gif +0 -0
- data/public/images/jsonedit/plus.gif +0 -0
- data/public/images/jsonedit/saved.png +0 -0
- data/public/images/jsonedit/table_refresh.png +0 -0
- data/public/images/jsonedit/value.gif +0 -0
- data/public/images/merb.jpg +0 -0
- data/public/images/toggle-collapse-dark.png +0 -0
- data/public/images/toggle-collapse-light.png +0 -0
- data/public/images/toggle-collapse.gif +0 -0
- data/public/images/toggle-expand-dark.png +0 -0
- data/public/images/toggle-expand-light.png +0 -0
- data/public/images/toggle-expand.gif +0 -0
- data/public/images/treeBuilderImages/Thumbs.db +0 -0
- data/public/images/treeBuilderImages/doc.gif +0 -0
- data/public/images/treeBuilderImages/docNode.gif +0 -0
- data/public/images/treeBuilderImages/docNodeLast.gif +0 -0
- data/public/images/treeBuilderImages/docNodeLastFirst.gif +0 -0
- data/public/images/treeBuilderImages/folder.gif +0 -0
- data/public/images/treeBuilderImages/folderNode.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeLast.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeLastFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpen.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpenFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpenLast.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpenLastFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderOpen.gif +0 -0
- data/public/images/treeBuilderImages/vertLine.gif +0 -0
- data/public/javascripts/chef.js +160 -0
- data/public/javascripts/jquery-1.3.2.min.js +19 -0
- data/public/javascripts/jquery-ui-1.7.1.custom.min.js +65 -0
- data/public/javascripts/jquery.editinline.js +108 -0
- data/public/javascripts/jquery.jeditable.mini.js +30 -0
- data/public/javascripts/jquery.livequery.js +250 -0
- data/public/javascripts/jquery.localscroll.js +104 -0
- data/public/javascripts/jquery.scrollTo.js +150 -0
- data/public/javascripts/jquery.tools.min.js +17 -0
- data/public/javascripts/jquery.treeTable.min.js +165 -0
- data/public/javascripts/json.js +153 -0
- data/public/javascripts/jsonedit_main.js +675 -0
- data/public/javascripts/yetii-min.js +1 -0
- data/public/stylesheets/base.css +336 -0
- data/public/stylesheets/chef.css +157 -0
- data/public/stylesheets/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
- data/public/stylesheets/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
- data/public/stylesheets/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
- data/public/stylesheets/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_2694e8_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_72a7cf_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_888888_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/stylesheets/jquery-ui-1.7.1.custom.css +404 -0
- data/public/stylesheets/jquery.treeTable.css +43 -0
- data/public/stylesheets/jsonedit_main.css +280 -0
- data/public/stylesheets/themes/bec-green/style.css +290 -0
- data/public/stylesheets/themes/bec/style.css +301 -0
- data/public/stylesheets/themes/blue/style.css +280 -0
- data/public/stylesheets/themes/default/style.css +267 -0
- data/public/stylesheets/themes/djime-cerulean/style.css +298 -0
- data/public/stylesheets/themes/kathleene/style.css +272 -0
- data/public/stylesheets/themes/orange/style.css +263 -0
- data/public/stylesheets/themes/reidb-greenish/style.css +301 -0
- data/stubs/app/controllers/application.rb +2 -0
- data/stubs/app/controllers/main.rb +2 -0
- metadata +399 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Nuo Yan (<nuo@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'chef/api_client'
|
20
|
+
|
21
|
+
class ChefServerWebui::Clients < ChefServerWebui::Application
|
22
|
+
provides :json
|
23
|
+
provides :html
|
24
|
+
before :login_required
|
25
|
+
|
26
|
+
# GET /clients
|
27
|
+
def index
|
28
|
+
@clients_list = begin
|
29
|
+
Chef::ApiClient.list()
|
30
|
+
rescue => e
|
31
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
32
|
+
@_message = {:error => "Could not list clients"}
|
33
|
+
{}
|
34
|
+
end
|
35
|
+
render
|
36
|
+
end
|
37
|
+
|
38
|
+
# GET /clients/:id
|
39
|
+
def show
|
40
|
+
@client = begin
|
41
|
+
@client = Chef::ApiClient.load(params[:id])
|
42
|
+
rescue => e
|
43
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
44
|
+
@_message = { :error => "Could not load client #{params[:id]}"}
|
45
|
+
Chef::ApiClient.new
|
46
|
+
end
|
47
|
+
render
|
48
|
+
end
|
49
|
+
|
50
|
+
# GET /clients/:id/edit
|
51
|
+
def edit
|
52
|
+
@client = begin
|
53
|
+
Chef::ApiClient.load(params[:id])
|
54
|
+
rescue => e
|
55
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
56
|
+
@_message = { :error => "Could not load client #{params[:id]}"}
|
57
|
+
Chef::ApiClient.new
|
58
|
+
end
|
59
|
+
render
|
60
|
+
end
|
61
|
+
|
62
|
+
# GET /clients/new
|
63
|
+
def new
|
64
|
+
@client = Chef::ApiClient.new
|
65
|
+
render
|
66
|
+
end
|
67
|
+
|
68
|
+
# POST /clients
|
69
|
+
def create
|
70
|
+
begin
|
71
|
+
@client = Chef::ApiClient.new
|
72
|
+
@client.name(params[:name])
|
73
|
+
@client.admin(str_to_bool(params[:admin])) if params[:admin]
|
74
|
+
response = @client.create
|
75
|
+
@private_key = OpenSSL::PKey::RSA.new(response["private_key"])
|
76
|
+
@_message = { :notice => "Created Client #{@client.name}. Please copy the following private key as the client's validation key." }
|
77
|
+
@client = Chef::ApiClient.load(params[:name])
|
78
|
+
render :show
|
79
|
+
rescue => e
|
80
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
81
|
+
@_message = { :error => "Could not create client" }
|
82
|
+
render :new
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# PUT /clients/:id
|
87
|
+
def update
|
88
|
+
begin
|
89
|
+
@client = Chef::ApiClient.load(params[:id])
|
90
|
+
if params[:regen_private_key]
|
91
|
+
@client.create_keys
|
92
|
+
@private_key = @client.private_key
|
93
|
+
end
|
94
|
+
params[:admin] ? @client.admin(true) : @client.admin(false)
|
95
|
+
@client.save
|
96
|
+
@_message = @private_key.nil? ? { :notice => "Updated Client" } : { :notice => "Created Client #{@client.name}. Please copy the following private key as the client's validation key." }
|
97
|
+
render :show
|
98
|
+
rescue => e
|
99
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
100
|
+
@_message = { :error => "Could not update client" }
|
101
|
+
render :edit
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# DELETE /clients/:id
|
106
|
+
def destroy
|
107
|
+
begin
|
108
|
+
@client = Chef::ApiClient.load(params[:id])
|
109
|
+
@client.destroy
|
110
|
+
redirect(absolute_slice_url(:clients), {:message => { :notice => "Client #{params[:id]} deleted successfully" }, :permanent => true})
|
111
|
+
rescue => e
|
112
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
113
|
+
@_message = {:error => "Could not delete client #{params[:id]}" }
|
114
|
+
@clients_list = Chef::ApiClient.list()
|
115
|
+
render :index
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef' / 'mixin' / 'checksum'
|
21
|
+
|
22
|
+
class ChefServerWebui::CookbookAttributes < ChefServerWebui::Application
|
23
|
+
|
24
|
+
provides :html
|
25
|
+
|
26
|
+
before :login_required
|
27
|
+
|
28
|
+
include Chef::Mixin::Checksum
|
29
|
+
|
30
|
+
def load_cookbook_attributes()
|
31
|
+
@attribute_files = load_cookbook_segment(params[:cookbook_id], :attributes)
|
32
|
+
end
|
33
|
+
|
34
|
+
def index
|
35
|
+
load_cookbook_attributes()
|
36
|
+
render
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef' / 'mixin' / 'checksum'
|
21
|
+
|
22
|
+
class ChefServerWebui::CookbookDefinitions < ChefServerWebui::Application
|
23
|
+
|
24
|
+
provides :html
|
25
|
+
|
26
|
+
before :login_required
|
27
|
+
|
28
|
+
include Chef::Mixin::Checksum
|
29
|
+
|
30
|
+
def load_cookbook_definitions()
|
31
|
+
@definition_files = load_cookbook_segment(params[:cookbook_id], :definitions)
|
32
|
+
end
|
33
|
+
|
34
|
+
def index
|
35
|
+
load_cookbook_definitions()
|
36
|
+
render
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef' / 'mixin' / 'checksum'
|
21
|
+
require 'chef' / 'cookbook_loader'
|
22
|
+
require 'chef' / 'mixin' / 'find_preferred_file'
|
23
|
+
|
24
|
+
class ChefServerWebui::CookbookFiles < ChefServerWebui::Application
|
25
|
+
|
26
|
+
provides :html
|
27
|
+
before :login_required
|
28
|
+
|
29
|
+
include Chef::Mixin::Checksum
|
30
|
+
include Chef::Mixin::FindPreferredFile
|
31
|
+
|
32
|
+
layout nil
|
33
|
+
|
34
|
+
def index
|
35
|
+
@remote_files = load_cookbook_files(params[:cookbook_id], :remote_file)
|
36
|
+
render
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef' / 'mixin' / 'checksum'
|
21
|
+
require 'chef' / 'cookbook_loader'
|
22
|
+
|
23
|
+
class ChefServerWebui::CookbookLibraries < ChefServerWebui::Application
|
24
|
+
|
25
|
+
provides :html
|
26
|
+
before :login_required
|
27
|
+
|
28
|
+
include Chef::Mixin::Checksum
|
29
|
+
|
30
|
+
def load_cookbook_libs()
|
31
|
+
@lib_files = load_cookbook_segment(params[:cookbook_id], :libraries)
|
32
|
+
end
|
33
|
+
|
34
|
+
def index
|
35
|
+
load_cookbook_libs()
|
36
|
+
render
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef' / 'mixin' / 'checksum'
|
21
|
+
|
22
|
+
class ChefServerWebui::CookbookRecipes < ChefServerWebui::Application
|
23
|
+
|
24
|
+
provides :html
|
25
|
+
before :login_required
|
26
|
+
|
27
|
+
include Chef::Mixin::Checksum
|
28
|
+
|
29
|
+
def load_cookbook_recipes()
|
30
|
+
@recipe_files = load_cookbook_segment(params[:cookbook_id], :recipes)
|
31
|
+
end
|
32
|
+
|
33
|
+
def index
|
34
|
+
load_cookbook_recipes()
|
35
|
+
render
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef' / 'mixin' / 'checksum'
|
21
|
+
require 'chef' / 'cookbook_loader'
|
22
|
+
require 'chef' / 'mixin' / 'find_preferred_file'
|
23
|
+
|
24
|
+
class ChefServerWebui::CookbookTemplates < ChefServerWebui::Application
|
25
|
+
|
26
|
+
provides :html
|
27
|
+
before :login_required
|
28
|
+
|
29
|
+
include Chef::Mixin::Checksum
|
30
|
+
include Chef::Mixin::FindPreferredFile
|
31
|
+
|
32
|
+
# def load_cookbook_templates()
|
33
|
+
# @cl = Chef::CookbookLoader.new
|
34
|
+
# @cookbook = @cl[params[:cookbook_id]]
|
35
|
+
# raise NotFound unless @cookbook
|
36
|
+
#
|
37
|
+
# @templates = Hash.new
|
38
|
+
# @cookbook.template_files.each do |tf|
|
39
|
+
# full = File.expand_path(tf)
|
40
|
+
# name = File.basename(full)
|
41
|
+
# tf =~ /^.+#{params[:cookbook_id]}[\\|\/]templates[\\|\/](.+?)[\\|\/]#{name}/
|
42
|
+
# singlecopy = $1
|
43
|
+
# @templates[full] = {
|
44
|
+
# :name => name,
|
45
|
+
# :singlecopy => singlecopy,
|
46
|
+
# :file => full,
|
47
|
+
# }
|
48
|
+
# end
|
49
|
+
# @templates
|
50
|
+
# end
|
51
|
+
|
52
|
+
def index
|
53
|
+
@templates = load_cookbook_files(params[:cookbook_id], :template)
|
54
|
+
display @templates
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Author:: Nuo Yan (<nuo@opscode.com>)
|
5
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
6
|
+
# License:: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'chef' / 'cookbook_loader'
|
22
|
+
|
23
|
+
class ChefServerWebui::Cookbooks < ChefServerWebui::Application
|
24
|
+
|
25
|
+
provides :html, :json
|
26
|
+
before :login_required
|
27
|
+
|
28
|
+
def index
|
29
|
+
@cl = begin
|
30
|
+
Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("cookbooks")
|
31
|
+
rescue => e
|
32
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
33
|
+
@_message = {:error => $!}
|
34
|
+
{}
|
35
|
+
end
|
36
|
+
render
|
37
|
+
end
|
38
|
+
|
39
|
+
def show
|
40
|
+
begin
|
41
|
+
@cookbook = Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("cookbooks/#{params[:id]}")
|
42
|
+
raise NotFound unless @cookbook
|
43
|
+
display @cookbook
|
44
|
+
rescue => e
|
45
|
+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
|
46
|
+
@_message = {:error => $!}
|
47
|
+
@cl = {}
|
48
|
+
render :index
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def recipe_files
|
53
|
+
# node = params.has_key?('node') ? params[:node] : nil
|
54
|
+
# @recipe_files = load_all_files(:recipes, node)
|
55
|
+
r = Chef::REST.new(Chef::Config[:chef_server_url])
|
56
|
+
@recipe_files = r.get_rest("cookbooks/#{params[:id]}/recipes")
|
57
|
+
display @recipe_files
|
58
|
+
end
|
59
|
+
|
60
|
+
def attribute_files
|
61
|
+
r = Chef::REST.new(Chef::Config[:chef_server_url])
|
62
|
+
@recipe_files = r.get_rest("cookbooks/#{params[:id]}/attributes")
|
63
|
+
display @attribute_files
|
64
|
+
end
|
65
|
+
|
66
|
+
def definition_files
|
67
|
+
r = Chef::REST.new(Chef::Config[:chef_server_url])
|
68
|
+
@recipe_files = r.get_rest("cookbooks/#{params[:id]}/definitions")
|
69
|
+
display @definition_files
|
70
|
+
end
|
71
|
+
|
72
|
+
def library_files
|
73
|
+
r = Chef::REST.new(Chef::Config[:chef_server_url])
|
74
|
+
@recipe_files = r.get_rest("cookbooks/#{params[:id]}/libraries")
|
75
|
+
display @lib_files
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|