mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-04 17:47:00 +03:00
Merge remote-tracking branch 'origin/bug-1495'
This commit is contained in:
commit
4d9609a79f
@ -18,8 +18,6 @@ require 'yaml'
|
||||
require 'json'
|
||||
|
||||
class SunstonePlugins
|
||||
USER_PLUGIN_POLICY = false # or true to enable them by default
|
||||
|
||||
attr_reader :plugins_conf
|
||||
|
||||
def initialize
|
||||
@ -37,26 +35,18 @@ class SunstonePlugins
|
||||
@installed_plugins = Array.new
|
||||
|
||||
# read user plugins
|
||||
modified = false
|
||||
Dir[base_path+'user-plugins/*.js'].each do |p_path|
|
||||
m = p_path.match(/^#{base_path}(.*)$/)
|
||||
if m and plugin = m[1]
|
||||
@installed_plugins << plugin
|
||||
if !plugins.include? plugin
|
||||
@plugins_conf << {plugin=>{:ALL => USER_PLUGIN_POLICY,
|
||||
:user => nil,
|
||||
:group => nil}}
|
||||
modified = true
|
||||
end
|
||||
if m && m[1]
|
||||
@installed_plugins << m[1]
|
||||
end
|
||||
end
|
||||
write_conf if modified
|
||||
|
||||
# read base plugins
|
||||
Dir[base_path+'plugins/*.js'].each do |p_path|
|
||||
m = p_path.match(/^#{base_path}(.*)$/)
|
||||
if m and plugin = m[1]
|
||||
@installed_plugins << plugin
|
||||
if m && m[1]
|
||||
@installed_plugins << m[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -99,12 +89,6 @@ class SunstonePlugins
|
||||
auth_plugins
|
||||
end
|
||||
|
||||
def write_conf
|
||||
File.open(PLUGIN_CONFIGURATION_FILE,'w') do |f|
|
||||
f.write(@plugins_conf.to_yaml)
|
||||
end
|
||||
end
|
||||
|
||||
def to_json
|
||||
@plugins_conf.to_json
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user