Adds an explicit error message for invalid YAML configuration file (#9748).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8112 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
fd32f7446d
commit
24317f617e
@ -79,7 +79,13 @@ module Redmine
|
|||||||
private
|
private
|
||||||
|
|
||||||
def load_from_yaml(filename, env)
|
def load_from_yaml(filename, env)
|
||||||
|
yaml = nil
|
||||||
|
begin
|
||||||
yaml = YAML::load_file(filename)
|
yaml = YAML::load_file(filename)
|
||||||
|
rescue ArgumentError
|
||||||
|
$stderr.puts "Your Redmine configuration file located at #{filename} is not a valid YAML file and could not be loaded."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
conf = {}
|
conf = {}
|
||||||
if yaml.is_a?(Hash)
|
if yaml.is_a?(Hash)
|
||||||
if yaml['default']
|
if yaml['default']
|
||||||
@ -89,7 +95,7 @@ module Redmine
|
|||||||
conf.merge!(yaml[env])
|
conf.merge!(yaml[env])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
$stderr.puts "#{filename} is not a valid Redmine configuration file"
|
$stderr.puts "Your Redmine configuration file located at #{filename} is not a valid Redmine configuration file."
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
conf
|
conf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user