foreman_packages 0.0.26 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -73,7 +73,7 @@ class ForemanPackages::SypackagesController < ApplicationController
|
|
73
73
|
# DELETE /sypackages/1.json
|
74
74
|
def destroy
|
75
75
|
@sypackage = ForemanPackages::Sypackage.find(params[:id])
|
76
|
-
|
76
|
+
#@sypackage.destroy
|
77
77
|
|
78
78
|
respond_to do |format|
|
79
79
|
format.html { redirect_to sypackages_url }
|
@@ -2,16 +2,16 @@ class ForemanPackages::Sypackage < ActiveRecord::Base
|
|
2
2
|
require "fileutils"
|
3
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
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
mount_uploader :filename, ForemanPackages::AttachmentUploader
|
6
|
+
after_create :create_dir
|
7
|
+
after_update :create_dir
|
8
|
+
after_update :change_dir
|
9
9
|
#after_destory :destory_dir
|
10
10
|
def create_dir
|
11
11
|
#目前用 "/home/stdtnt/app/"代替 "/etc/puppet/environments/production/modules/packages"
|
12
12
|
#该处需要注意权限问题,当前用户是否具有该目录的操作权限
|
13
13
|
root_dir_name = "/etc/puppet/environments/production/modules/packages/"
|
14
|
-
self.destory_dir #默认删除该目录,然后重新创建
|
14
|
+
#self.destory_dir #默认删除该目录,然后重新创建
|
15
15
|
dir_exist_status = File.exist?(root_dir_name) #判断该目录是否存在
|
16
16
|
if !dir_exist_status
|
17
17
|
#创建目录结构
|
@@ -65,15 +65,5 @@ class ForemanPackages::Sypackage < ActiveRecord::Base
|
|
65
65
|
def change_dir
|
66
66
|
upload_dir = "/home/stdtnt/workspaces/foreman/public/uploads/sypackage/filename/" + self.id.to_s
|
67
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
|
75
|
-
|
76
|
-
# puts ">>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..>>>>>>>>>>>>>>>>..."
|
77
|
-
# end
|
78
68
|
end
|
79
|
-
end
|
69
|
+
end
|