foreman_packages 0.0.19 → 0.0.21
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/app/controllers/foreman_packages/packages_controller.rb +64 -66
- data/app/helpers/foreman_packages/packages_helper.rb +1 -1
- data/app/models/foreman_packages/package.rb +65 -67
- data/app/views/foreman_packages/{packages → sypackages}/_form.html.erb +6 -6
- data/app/views/foreman_packages/sypackages/_list.html.erb +69 -0
- data/app/views/foreman_packages/{packages → sypackages}/edit.html.erb +0 -0
- data/app/views/foreman_packages/sypackages/index.html.erb +5 -0
- data/app/views/foreman_packages/{packages → sypackages}/new.html.erb +0 -0
- data/app/views/foreman_packages/sypackages/show.html.erb +77 -0
- data/app/views/foreman_packages/sypackages/upload.html.erb +4 -0
- data/config/routes.rb +1 -1
- data/db/migrate/{20150921011936_create_foreman_packages_packages.rb → 20150921011935_create_sypackages.rb} +4 -6
- data/db/migrate/20150921023709_add_filename_to_sypackage.rb +5 -0
- data/db/migrate/20150921050518_add_file_cache_to_sypackage.rb +5 -0
- data/lib/foreman_packages/engine.rb +9 -9
- data/lib/foreman_packages/version.rb +1 -1
- metadata +12 -10
- data/app/views/foreman_packages/packages/_list.html.erb +0 -69
- data/app/views/foreman_packages/packages/index.html.erb +0 -5
- data/app/views/foreman_packages/packages/show.html.erb +0 -77
- data/app/views/foreman_packages/packages/upload.html.erb +0 -4
@@ -1,85 +1,83 @@
|
|
1
|
+
class ForemanPackages::SypackagesController < ApplicationController
|
2
|
+
# GET /sypackages
|
3
|
+
# GET /sypackages.json
|
4
|
+
def index
|
5
|
+
@sypackages = ForemanPackages::Sypackage.all.paginate(:page => params[:page])
|
1
6
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
def index
|
6
|
-
@foreman_packages_packages = ForemanPackages::Package.all.paginate(:page => params[:page])
|
7
|
-
|
8
|
-
respond_to do |format|
|
9
|
-
format.html # index.html.erb
|
10
|
-
format.json { render json: @foreman_packages_packages }
|
11
|
-
end
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @sypackages }
|
12
10
|
end
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
# GET /sypackages/1
|
14
|
+
# GET /sypackages/1.json
|
15
|
+
def show
|
16
|
+
@sypackage = ForemanPackages::Sypackage.find(params[:id])
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @sypackage }
|
23
21
|
end
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
# GET /sypackages/new
|
25
|
+
# GET /sypackages/new.json
|
26
|
+
def new
|
27
|
+
@sypackage = ForemanPackages::Sypackage.new
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @sypackage }
|
34
32
|
end
|
33
|
+
end
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
# GET /sypackages/1/edit
|
36
|
+
def edit
|
37
|
+
@sypackage = ForemanPackages::Sypackage.find(params[:id])
|
38
|
+
end
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
40
|
+
# POST /sypackages
|
41
|
+
# POST /sypackages.json
|
42
|
+
def create
|
43
|
+
@sypackage = ForemanPackages::Sypackage.new(params[:sypackage])
|
44
|
+
@sypackage.filename = params[:sypackage][:filename].original_filename
|
45
|
+
respond_to do |format|
|
46
|
+
if @sypackage.save
|
47
|
+
format.html { redirect_to @sypackage, notice: 'ForemanPackages::Sypackage was successfully created.' }
|
48
|
+
format.json { render json: @sypackage, status: :created, location: @sypackage }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @sypackage.errors, status: :unprocessable_entity }
|
54
52
|
end
|
55
53
|
end
|
54
|
+
end
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
56
|
+
# PUT /sypackages/1
|
57
|
+
# PUT /sypackages/1.json
|
58
|
+
def update
|
59
|
+
@sypackage = ForemanPackages::Sypackage.find(params[:id])
|
60
|
+
@sypackage.filename = params[:sypackage][:filename].original_filename
|
61
|
+
respond_to do |format|
|
62
|
+
if @sypackage.update_attributes(params[:sypackage])
|
63
|
+
format.html { redirect_to @sypackage, notice: 'Sypackage was successfully updated.' }
|
64
|
+
format.json { head :no_content }
|
65
|
+
else
|
66
|
+
format.html { render action: "edit" }
|
67
|
+
format.json { render json: @sypackage.errors, status: :unprocessable_entity }
|
70
68
|
end
|
71
69
|
end
|
70
|
+
end
|
72
71
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
72
|
+
# DELETE /sypackages/1
|
73
|
+
# DELETE /sypackages/1.json
|
74
|
+
def destroy
|
75
|
+
@sypackage = ForemanPackages::Sypackage.find(params[:id])
|
76
|
+
@sypackage.destroy
|
78
77
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to sypackages_url }
|
80
|
+
format.json { head :no_content }
|
83
81
|
end
|
84
82
|
end
|
85
|
-
|
83
|
+
end
|
@@ -1,81 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
attr_accessible :packagename, :ensure, :file_path, :file_ensure, :file_source, :file_mode, :file_onwer, :file_group, :file_notify, :file_require, :service_name, :service_ensure, :service_enable, :service_hasstatus, :service_hasrestart, :filename, :file_cache
|
1
|
+
class ForemanPackages::Sypackage < ActiveRecord::Base
|
2
|
+
require "fileutils"
|
3
|
+
attr_accessible :name, :ensure, :file_path, :file_ensure, :file_source, :file_mode, :file_onwer, :file_group, :file_notify, :file_require, :service_name, :service_ensure, :service_enable, :service_hasstatus, :service_hasrestart, :filename, :file_cache
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
5
|
+
mount_uploader :filename, AttachmentUploader
|
6
|
+
after_create :create_dir
|
7
|
+
after_update :create_dir
|
8
|
+
after_update :change_dir
|
9
|
+
#after_destory :destory_dir
|
10
|
+
def create_dir
|
11
|
+
#目前用 "/home/stdtnt/app/"代替 "/etc/puppet/environments/production/modules/packages"
|
12
|
+
#该处需要注意权限问题,当前用户是否具有该目录的操作权限
|
13
|
+
root_dir_name = "/etc/puppet/environments/production/modules/packages/"
|
14
|
+
self.destory_dir #默认删除该目录,然后重新创建
|
15
|
+
dir_exist_status = File.exist?(root_dir_name) #判断该目录是否存在
|
16
|
+
if !dir_exist_status
|
17
|
+
#创建目录结构
|
18
|
+
Dir::mkdir(root_dir_name)
|
19
|
+
Dir::mkdir(root_dir_name + "files")
|
20
|
+
Dir::mkdir(root_dir_name + "manifests")
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
#生成files下welcome.conf文件
|
23
|
+
files_welcome_File = File.new(root_dir_name + "files/welcome.conf", "w+")
|
24
|
+
files_welcome_File.close
|
25
|
+
#生成manifests下init.pp文件
|
26
|
+
main_init_File = File.new(root_dir_name +"manifests/init.pp", "w+")
|
27
|
+
if main_init_File
|
28
|
+
main_init_File.syswrite(self.create_content)
|
29
|
+
else
|
30
|
+
puts "Unable to open file!"
|
31
|
+
end
|
32
|
+
main_init_File.close
|
33
|
+
end
|
35
34
|
|
36
|
-
|
35
|
+
#self.change_dir
|
37
36
|
|
38
|
-
|
37
|
+
end
|
39
38
|
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
def destory_dir
|
41
|
+
#目前用 "/home/stdtnt/app/"代替 "/etc/puppet/environments/production/modules/users"
|
42
|
+
#该处需要注意权限问题,当前用户是否具有该目录的操作权限
|
43
|
+
root_dir_name = "/etc/puppet/environments/production/modules/packages"
|
44
|
+
#判断该目录是否存在
|
45
|
+
dir_exist_status = File.exist?(root_dir_name )
|
46
|
+
if dir_exist_status
|
47
|
+
#使用fileUtils.rm_r 删除该文件夹及其以下所有内容
|
48
|
+
FileUtils.rm_r root_dir_name
|
49
|
+
end
|
50
|
+
end
|
52
51
|
|
53
|
-
|
54
|
-
|
52
|
+
def create_content
|
53
|
+
user_content = "class packages {" + "\n" + "\s\s" + "package{'" + self.name + "':" + "\n\s\s\s\s" + "ensure => '" + self.ensure + "'," + "\n\s\s" +"}" + "\n"
|
55
54
|
|
56
55
|
|
57
|
-
|
56
|
+
file_content = "\s\s" + "file{'"+ self.file_path + "':" + "\n\s\s\s\s" + "ensure => '" + self.file_ensure + "'," + "\n\s\s\s\s" + "source => '" + self.file_source + "mode => '" + self.file_mode + "'," + "\n\s\s\s\s" + "onwer => '" + self.file_onwer + "group => '" + self.file_group + "'," + "\n\s\s\s\s" + "notify=> Service['" + self.file_notify + "']," + "\n\s\s\s\s" + "require=> Package['" + self.file_require + "']," + "\n\s\s" +"}" + "\n\s\s"
|
58
57
|
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
service_content = "\s\s" + "service{'"+ self.service_name + "':" + "\n\s\s\s\s" + "ensure => '" + self.service_ensure + "'," + "\n\s\s\s\s" + "enable => '" + self.service_enable + "hasstatus => '" + self.service_hasstatus + "'," + "\n\s\s\s\s" + "hasrestart => '" + self.service_hasrestart + "," + "\n\s\s" +"}" + "\n\s\s"
|
60
|
+
rs = user_content + file_content + service_content + "\n" + "}"
|
61
|
+
return rs
|
62
|
+
end
|
64
63
|
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
65
|
+
def change_dir
|
66
|
+
upload_dir = "/home/stdtnt/workspaces/foreman/public/uploads/sypackage/filename/" + self.id.to_s
|
67
|
+
root_file_dir_name = "/home/stdtnt/app/packages/files/"
|
68
|
+
# FileUtils.cd(upload_dir, :verbose => true)
|
69
|
+
# FileUtils.cp_r Dir.glob('*.*'), "/home/stdtnt/app/packages/files/", :noop => true, :verbose => true
|
70
|
+
# list=Dir.entries(upload_dir)
|
71
|
+
# list.each_index do |x|
|
72
|
+
# puts ">>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..."
|
73
|
+
# puts "#{list[x]}"
|
74
|
+
# FileUtils.cp_r upload_dir ,root_file_dir_name, :noop => true, :verbose => true
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
76
|
+
# puts ">>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..."
|
77
|
+
# end
|
78
|
+
end
|
79
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
<%= javascript '
|
1
|
+
<%= javascript 'sypackages', 'sypackage_edit', 'sypackage_edit_interfaces', 'class_edit', 'compute_resource', 'lookup_keys'%>
|
2
2
|
|
3
|
-
<%= form_for @
|
4
|
-
<%= base_errors_for @
|
3
|
+
<%= form_for @sypackage, :html => {:data => {:id => @sypackage.try(:id), :submit => 'progress_bar'}} do |f| %>
|
4
|
+
<%= base_errors_for @sypackage %>
|
5
5
|
<div class="row clearfix">
|
6
6
|
<div class="row">
|
7
7
|
<div class="form-group col-md-6">
|
8
8
|
<label>name</label>
|
9
|
-
<%= f.text_field :
|
9
|
+
<%= f.text_field :name, :size => "col-md-6", placeholder: "填写用户名", class: "form-control" %>
|
10
10
|
</div>
|
11
11
|
<div class="form-group col-md-6">
|
12
|
-
<label for="
|
12
|
+
<label for="sypackage_ensure">ensure</label> <br />
|
13
13
|
<%= f.select :ensure, [['Please select an ensure', nil], 'present', 'absent', 'role'], placeholder: "ensure", control_label: 'ensure', class: "form-control"%>
|
14
14
|
</div>
|
15
15
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
|
104
104
|
<div class="actions">
|
105
105
|
<%= f.submit "提交", class: "btn btn-success" %>
|
106
|
-
<%= link_to '返回',
|
106
|
+
<%= link_to '返回', sypackages_path, class: "btn btn-primary" %>
|
107
107
|
</div>
|
108
108
|
<% end %>
|
109
109
|
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<%= javascript "jquery.cookie" %>
|
2
|
+
<% title header ||= "" %>
|
3
|
+
<table class="table table-bordered table-striped table-condensed" >
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th class=''>name</th>
|
7
|
+
<th class="hidden-xs">ensure</th>
|
8
|
+
<th class="hidden-xs">file_path</th>
|
9
|
+
<th class="hidden-tablet hidden-xs">file_ensure</th>
|
10
|
+
<th class="hidden-tablet hidden-xs">file_source</th>
|
11
|
+
<th class="hidden-tablet hidden-xs">file_mode</th>
|
12
|
+
<th class="hidden-tablet hidden-xs">file_onwer</th>
|
13
|
+
<th class="hidden-tablet hidden-xs">file_group</th>
|
14
|
+
<th class="hidden-tablet hidden-xs">file_notify</th>
|
15
|
+
<th class="hidden-tablet hidden-xs">file_require</th>
|
16
|
+
|
17
|
+
<th class="hidden-tablet hidden-xs">service_name</th>
|
18
|
+
<th class="hidden-tablet hidden-xs">service_ensure</th>
|
19
|
+
<th class="hidden-tablet hidden-xs">service_enable</th>
|
20
|
+
<th class="hidden-tablet hidden-xs">service_hasstatus</th>
|
21
|
+
<th class="hidden-tablet hidden-xs">service_hasrestart</th>
|
22
|
+
<th>操作</th>
|
23
|
+
</tr>
|
24
|
+
</thead>
|
25
|
+
<tbody>
|
26
|
+
<% sypackages.each do |sypackage| %>
|
27
|
+
<tr>
|
28
|
+
<td class=''><%= sypackage.name %></td>
|
29
|
+
<td class="hidden-xs"><%= sypackage.ensure %></td>
|
30
|
+
<td class="hidden-xs"><%= sypackage.file_path %></td>
|
31
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.file_ensure %></td>
|
32
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.file_source %></td>
|
33
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.file_mode %></td>
|
34
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.file_onwer %></td>
|
35
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.file_group %></td>
|
36
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.file_notify %></td>
|
37
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.file_require %></td>
|
38
|
+
|
39
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.service_name %></td>
|
40
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.service_ensure %></td>
|
41
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.service_enable %></td>
|
42
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.service_hasstatus %></td>
|
43
|
+
<td class="hidden-tablet hidden-xs"><%= sypackage.service_hasrestart %></td>
|
44
|
+
<td>
|
45
|
+
<%= link_to '查看', sypackage %>
|
46
|
+
<%= link_to '编辑', edit_sypackage_path(sypackage) %>
|
47
|
+
<%= link_to '删除', sypackage, method: :delete, data: { confirm: 'Are you sure?' } %>
|
48
|
+
</td>
|
49
|
+
</tr>
|
50
|
+
<% end %>
|
51
|
+
</tbody>
|
52
|
+
</table>
|
53
|
+
<div id="confirmation-modal" class="modal fade">
|
54
|
+
<div class="modal-dialog">
|
55
|
+
<div class="modal-content">
|
56
|
+
<div class="modal-header">
|
57
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
58
|
+
<h4 class="modal-title"><%= _('Please Confirm') %></h4>
|
59
|
+
</div>
|
60
|
+
<div class="modal-body">
|
61
|
+
</div>
|
62
|
+
<div class="modal-footer">
|
63
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
|
64
|
+
<button type="button" class="btn btn-primary" onclick="submit_modal_form()"><%= _('Submit') %></button>
|
65
|
+
</div>
|
66
|
+
</div><!-- /.modal-content -->
|
67
|
+
</div><!-- /.modal-dialog -->
|
68
|
+
</div><!-- /.modal -->
|
69
|
+
<%= will_paginate_with_info sypackages, :more => " - "+_("<b class='select_count'>0</b> selected") %>
|
File without changes
|
File without changes
|
@@ -0,0 +1,77 @@
|
|
1
|
+
|
2
|
+
<div class="container">
|
3
|
+
<div class="row">
|
4
|
+
<h1 class="clearfix">
|
5
|
+
<%#= @sypackage.name %>
|
6
|
+
<%= link_to '返回', sypackages_path, class: "btn btn-primary pull-right mr1" %>
|
7
|
+
<%= link_to '编辑', edit_sypackage_path(@sypackage), class: "btn btn-warning pull-right mr1" %>
|
8
|
+
</h1>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="row col-md-12">
|
12
|
+
<table class="table table-striped table-bordered">
|
13
|
+
<thead></thead>
|
14
|
+
<tbody>
|
15
|
+
<tr>
|
16
|
+
<td><strong>name</strong></td>
|
17
|
+
<td><strong>ensure</strong></td>
|
18
|
+
<td><strong>file_path</strong></td>
|
19
|
+
<td><strong>file_ensure</strong></td>
|
20
|
+
</tr>
|
21
|
+
<tr>
|
22
|
+
<td><%= @sypackage.name %></td>
|
23
|
+
<td><%= @sypackage.ensure %></td>
|
24
|
+
<td><%= @sypackage.file_path %></td>
|
25
|
+
<td><%= @sypackage.file_ensure %></td>
|
26
|
+
</tr>
|
27
|
+
|
28
|
+
<tr>
|
29
|
+
<td><strong>file_source</strong></td>
|
30
|
+
<td><strong>file_mode</strong></td>
|
31
|
+
<td><strong>file_onwer</strong></td>
|
32
|
+
<td><strong>file_group</strong></td>
|
33
|
+
</tr>
|
34
|
+
<tr>
|
35
|
+
<td><%= @sypackage.file_source %></td>
|
36
|
+
<td><%= @sypackage.file_mode %></td>
|
37
|
+
<td><%= @sypackage.file_onwer %></td>
|
38
|
+
<td><%= @sypackage.file_group %></td>
|
39
|
+
</tr>
|
40
|
+
|
41
|
+
<tr>
|
42
|
+
<td><strong>file_notify</strong></td>
|
43
|
+
<td><strong>file_require</strong></td>
|
44
|
+
<td><strong>service_name</strong></td>
|
45
|
+
<td><strong>service_ensure</strong></td>
|
46
|
+
</tr>
|
47
|
+
<tr>
|
48
|
+
<td><%= @sypackage.file_notify %></td>
|
49
|
+
<td><%= @sypackage.file_require %></td>
|
50
|
+
<td><%= @sypackage.service_name %></td>
|
51
|
+
<td><%= @sypackage.service_ensure %></td>
|
52
|
+
</tr>
|
53
|
+
|
54
|
+
<tr>
|
55
|
+
<td><strong>service_enable</strong></td>
|
56
|
+
<td><strong>service_hasstatus</strong></td>
|
57
|
+
<td><strong>service_hasrestart</strong></td>
|
58
|
+
<td><strong>created_at</strong></td>
|
59
|
+
</tr>
|
60
|
+
<tr>
|
61
|
+
<td><%= @sypackage.service_enable %></td>
|
62
|
+
<td><%= @sypackage.service_hasstatus %></td>
|
63
|
+
<td><%= @sypackage.service_hasrestart %></td>
|
64
|
+
<td><%= @sypackage.created_at %></td>
|
65
|
+
</tr>
|
66
|
+
</tbody>
|
67
|
+
</table>
|
68
|
+
</div>
|
69
|
+
<div class="row col-md-12">
|
70
|
+
<table class="table table-striped table-bordered">
|
71
|
+
<thead></thead>
|
72
|
+
<tbody>
|
73
|
+
<%= @sypackage.filename %>
|
74
|
+
</tbody>
|
75
|
+
</table>
|
76
|
+
</div>
|
77
|
+
</div>
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
|
3
3
|
namespace :foreman_packages do
|
4
|
-
resources :
|
4
|
+
resources :sypackages #do
|
5
5
|
# match 'index', to: 'foreman_packages/packages#index'
|
6
6
|
# match 'show', to: 'foreman_packages/packages#show'
|
7
7
|
# match 'new', to: 'foreman_packages/packages#new'
|
@@ -1,7 +1,7 @@
|
|
1
|
-
class
|
1
|
+
class CreateSypackages < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
4
|
-
t.string :
|
3
|
+
create_table :sypackages do |t|
|
4
|
+
t.string :name
|
5
5
|
t.string :ensure
|
6
6
|
t.string :file_path
|
7
7
|
t.string :file_ensure
|
@@ -16,9 +16,7 @@ class CreateForemanPackagesPackages < ActiveRecord::Migration
|
|
16
16
|
t.string :service_enable
|
17
17
|
t.string :service_hasstatus
|
18
18
|
t.string :service_hasrestart
|
19
|
-
t.string :filename
|
20
|
-
t.string :file_cache
|
21
19
|
t.timestamps
|
22
20
|
end
|
23
21
|
end
|
24
|
-
end
|
22
|
+
end
|
@@ -20,13 +20,13 @@ module ForemanPackages
|
|
20
20
|
|
21
21
|
# Add permissions
|
22
22
|
security_block :foreman_packages do
|
23
|
-
permission :view_foreman_packages, :'foreman_packages/
|
24
|
-
permission :view_foreman_packages, :'foreman_packages/
|
25
|
-
permission :view_foreman_packages, :'foreman_packages/
|
26
|
-
permission :view_foreman_packages, :'foreman_packages/
|
27
|
-
permission :view_foreman_packages, :'foreman_packages/
|
28
|
-
permission :view_foreman_packages, :'foreman_packages/
|
29
|
-
permission :view_foreman_packages, :'foreman_packages/
|
23
|
+
permission :view_foreman_packages, :'foreman_packages/sypackages' => [:index]
|
24
|
+
permission :view_foreman_packages, :'foreman_packages/sypackages' => [:show]
|
25
|
+
permission :view_foreman_packages, :'foreman_packages/sypackages' => [:new]
|
26
|
+
permission :view_foreman_packages, :'foreman_packages/sypackages' => [:edit]
|
27
|
+
permission :view_foreman_packages, :'foreman_packages/sypackages' => [:create]
|
28
|
+
permission :view_foreman_packages, :'foreman_packages/sypackages' => [:update]
|
29
|
+
permission :view_foreman_packages, :'foreman_packages/sypackages' => [:destroy]
|
30
30
|
end
|
31
31
|
|
32
32
|
# Add a new role called 'Discovery' if it doesn't exist
|
@@ -34,8 +34,8 @@ module ForemanPackages
|
|
34
34
|
|
35
35
|
# add menu entry
|
36
36
|
sub_menu :top_menu, :forema_package_menu, :caption=> N_('PackageManage'), :after=> :forema_user_menu do
|
37
|
-
menu :top_menu, :level1, :caption=>N_('Package List'), :url_hash => { :controller => 'foreman_packages/
|
38
|
-
menu :top_menu, :level2, :caption=>N_('New Package'), :url_hash => { :controller => 'foreman_packages/
|
37
|
+
menu :top_menu, :level1, :caption=>N_('Package List'), :url_hash => { :controller => 'foreman_packages/sypackages', :action => :index }, :resource_type => ForemanPackages::Package.name
|
38
|
+
menu :top_menu, :level2, :caption=>N_('New Package'), :url_hash => { :controller => 'foreman_packages/sypackages', :action => :new }, :resource_type => ForemanPackages::Package.name
|
39
39
|
# menu :top_menu, :level2, :url_hash => {:controller=> :example, :action=>:index}
|
40
40
|
# menu :top_menu, :level3, :url_hash => {:controller=> :example, :action=>:index}
|
41
41
|
# sub_menu :top_menu, :inner_level, :caption=> N_('Inner level') do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_packages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|
@@ -59,19 +59,21 @@ files:
|
|
59
59
|
- app/views/dashboard/_foreman_packages_widget.html.erb
|
60
60
|
- app/views/foreman_packages/layouts/layouts/new_layout.html.erb
|
61
61
|
- app/views/foreman_packages/layouts/new_layout.html.erb
|
62
|
-
- app/views/foreman_packages/
|
63
|
-
- app/views/foreman_packages/
|
64
|
-
- app/views/foreman_packages/
|
65
|
-
- app/views/foreman_packages/
|
66
|
-
- app/views/foreman_packages/
|
67
|
-
- app/views/foreman_packages/
|
68
|
-
- app/views/foreman_packages/
|
62
|
+
- app/views/foreman_packages/sypackages/new.html.erb
|
63
|
+
- app/views/foreman_packages/sypackages/show.html.erb
|
64
|
+
- app/views/foreman_packages/sypackages/index.html.erb
|
65
|
+
- app/views/foreman_packages/sypackages/_form.html.erb
|
66
|
+
- app/views/foreman_packages/sypackages/edit.html.erb
|
67
|
+
- app/views/foreman_packages/sypackages/_list.html.erb
|
68
|
+
- app/views/foreman_packages/sypackages/upload.html.erb
|
69
69
|
- app/views/foreman_packages/hosts/new_action.html.erb
|
70
70
|
- app/views/foreman_packages/hosts/hosts/new_action.html.erb
|
71
71
|
- app/controllers/foreman_packages/hosts_controller.rb
|
72
72
|
- app/controllers/foreman_packages/packages_controller.rb
|
73
73
|
- config/routes.rb
|
74
|
-
- db/migrate/
|
74
|
+
- db/migrate/20150921011935_create_sypackages.rb
|
75
|
+
- db/migrate/20150921050518_add_file_cache_to_sypackage.rb
|
76
|
+
- db/migrate/20150921023709_add_filename_to_sypackage.rb
|
75
77
|
- lib/foreman_packages/engine.rb
|
76
78
|
- lib/foreman_packages/version.rb
|
77
79
|
- lib/foreman_packages.rb
|
@@ -1,69 +0,0 @@
|
|
1
|
-
<%= javascript "jquery.cookie" %>
|
2
|
-
<% title header ||= "" %>
|
3
|
-
<table class="table table-bordered table-striped table-condensed" >
|
4
|
-
<thead>
|
5
|
-
<tr>
|
6
|
-
<th class=''>name</th>
|
7
|
-
<th class="hidden-xs">ensure</th>
|
8
|
-
<th class="hidden-xs">file_path</th>
|
9
|
-
<th class="hidden-tablet hidden-xs">file_ensure</th>
|
10
|
-
<th class="hidden-tablet hidden-xs">file_source</th>
|
11
|
-
<th class="hidden-tablet hidden-xs">file_mode</th>
|
12
|
-
<th class="hidden-tablet hidden-xs">file_onwer</th>
|
13
|
-
<th class="hidden-tablet hidden-xs">file_group</th>
|
14
|
-
<th class="hidden-tablet hidden-xs">file_notify</th>
|
15
|
-
<th class="hidden-tablet hidden-xs">file_require</th>
|
16
|
-
|
17
|
-
<th class="hidden-tablet hidden-xs">service_name</th>
|
18
|
-
<th class="hidden-tablet hidden-xs">service_ensure</th>
|
19
|
-
<th class="hidden-tablet hidden-xs">service_enable</th>
|
20
|
-
<th class="hidden-tablet hidden-xs">service_hasstatus</th>
|
21
|
-
<th class="hidden-tablet hidden-xs">service_hasrestart</th>
|
22
|
-
<th>操作</th>
|
23
|
-
</tr>
|
24
|
-
</thead>
|
25
|
-
<tbody>
|
26
|
-
<% foreman_packages_packages.each do |foreman_packages_package| %>
|
27
|
-
<tr>
|
28
|
-
<td class=''><%= foreman_packages_package.foreman_packages_packagename %></td>
|
29
|
-
<td class="hidden-xs"><%= foreman_packages_package.ensure %></td>
|
30
|
-
<td class="hidden-xs"><%= foreman_packages_package.file_path %></td>
|
31
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.file_ensure %></td>
|
32
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.file_source %></td>
|
33
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.file_mode %></td>
|
34
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.file_onwer %></td>
|
35
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.file_group %></td>
|
36
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.file_notify %></td>
|
37
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.file_require %></td>
|
38
|
-
|
39
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.service_name %></td>
|
40
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.service_ensure %></td>
|
41
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.service_enable %></td>
|
42
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.service_hasstatus %></td>
|
43
|
-
<td class="hidden-tablet hidden-xs"><%= foreman_packages_package.service_hasrestart %></td>
|
44
|
-
<td>
|
45
|
-
<%= link_to '查看', foreman_packages_package %>
|
46
|
-
<%= link_to '编辑', edit_foreman_packages_package_path(foreman_packages_package) %>
|
47
|
-
<%= link_to '删除', foreman_packages_package, method: :delete, data: { confirm: 'Are you sure?' } %>
|
48
|
-
</td>
|
49
|
-
</tr>
|
50
|
-
<% end %>
|
51
|
-
</tbody>
|
52
|
-
</table>
|
53
|
-
<div id="confirmation-modal" class="modal fade">
|
54
|
-
<div class="modal-dialog">
|
55
|
-
<div class="modal-content">
|
56
|
-
<div class="modal-header">
|
57
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
58
|
-
<h4 class="modal-title"><%= _('Please Confirm') %></h4>
|
59
|
-
</div>
|
60
|
-
<div class="modal-body">
|
61
|
-
</div>
|
62
|
-
<div class="modal-footer">
|
63
|
-
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
|
64
|
-
<button type="button" class="btn btn-primary" onclick="submit_modal_form()"><%= _('Submit') %></button>
|
65
|
-
</div>
|
66
|
-
</div><!-- /.modal-content -->
|
67
|
-
</div><!-- /.modal-dialog -->
|
68
|
-
</div><!-- /.modal -->
|
69
|
-
<%= will_paginate_with_info foreman_packages_packages, :more => " - "+_("<b class='select_count'>0</b> selected") %>
|
@@ -1,77 +0,0 @@
|
|
1
|
-
|
2
|
-
<div class="container">
|
3
|
-
<div class="row">
|
4
|
-
<h1 class="clearfix">
|
5
|
-
<%#= @foreman_packages_package.name %>
|
6
|
-
<%= link_to '返回', foreman_packages_packages_path, class: "btn btn-primary pull-right mr1" %>
|
7
|
-
<%= link_to '编辑', edit_foreman_packages_package_path(@foreman_packages_package), class: "btn btn-warning pull-right mr1" %>
|
8
|
-
</h1>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div class="row col-md-12">
|
12
|
-
<table class="table table-striped table-bordered">
|
13
|
-
<thead></thead>
|
14
|
-
<tbody>
|
15
|
-
<tr>
|
16
|
-
<td><strong>name</strong></td>
|
17
|
-
<td><strong>ensure</strong></td>
|
18
|
-
<td><strong>file_path</strong></td>
|
19
|
-
<td><strong>file_ensure</strong></td>
|
20
|
-
</tr>
|
21
|
-
<tr>
|
22
|
-
<td><%= @foreman_packages_package.packagename %></td>
|
23
|
-
<td><%= @foreman_packages_package.ensure %></td>
|
24
|
-
<td><%= @foreman_packages_package.file_path %></td>
|
25
|
-
<td><%= @foreman_packages_package.file_ensure %></td>
|
26
|
-
</tr>
|
27
|
-
|
28
|
-
<tr>
|
29
|
-
<td><strong>file_source</strong></td>
|
30
|
-
<td><strong>file_mode</strong></td>
|
31
|
-
<td><strong>file_onwer</strong></td>
|
32
|
-
<td><strong>file_group</strong></td>
|
33
|
-
</tr>
|
34
|
-
<tr>
|
35
|
-
<td><%= @foreman_packages_package.file_source %></td>
|
36
|
-
<td><%= @foreman_packages_package.file_mode %></td>
|
37
|
-
<td><%= @foreman_packages_package.file_onwer %></td>
|
38
|
-
<td><%= @foreman_packages_package.file_group %></td>
|
39
|
-
</tr>
|
40
|
-
|
41
|
-
<tr>
|
42
|
-
<td><strong>file_notify</strong></td>
|
43
|
-
<td><strong>file_require</strong></td>
|
44
|
-
<td><strong>service_name</strong></td>
|
45
|
-
<td><strong>service_ensure</strong></td>
|
46
|
-
</tr>
|
47
|
-
<tr>
|
48
|
-
<td><%= @foreman_packages_package.file_notify %></td>
|
49
|
-
<td><%= @foreman_packages_package.file_require %></td>
|
50
|
-
<td><%= @foreman_packages_package.service_name %></td>
|
51
|
-
<td><%= @foreman_packages_package.service_ensure %></td>
|
52
|
-
</tr>
|
53
|
-
|
54
|
-
<tr>
|
55
|
-
<td><strong>service_enable</strong></td>
|
56
|
-
<td><strong>service_hasstatus</strong></td>
|
57
|
-
<td><strong>service_hasrestart</strong></td>
|
58
|
-
<td><strong>created_at</strong></td>
|
59
|
-
</tr>
|
60
|
-
<tr>
|
61
|
-
<td><%= @foreman_packages_package.service_enable %></td>
|
62
|
-
<td><%= @foreman_packages_package.service_hasstatus %></td>
|
63
|
-
<td><%= @foreman_packages_package.service_hasrestart %></td>
|
64
|
-
<td><%= @foreman_packages_package.created_at %></td>
|
65
|
-
</tr>
|
66
|
-
</tbody>
|
67
|
-
</table>
|
68
|
-
</div>
|
69
|
-
<div class="row col-md-12">
|
70
|
-
<table class="table table-striped table-bordered">
|
71
|
-
<thead></thead>
|
72
|
-
<tbody>
|
73
|
-
<%= @foreman_packages_package.filename %>
|
74
|
-
</tbody>
|
75
|
-
</table>
|
76
|
-
</div>
|
77
|
-
</div>
|