Give a warning about an unreadable db config file.
git-svn-id: file:///home/svn/framework3/trunk@13982 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
3972fb1788
commit
39ecc19546
|
@ -175,11 +175,14 @@ class Driver < Msf::Ui::Driver
|
|||
dbfile = opts['DatabaseYAML']
|
||||
dbfile ||= ENV["MSF_DATABASE_CONFIG"]
|
||||
dbfile ||= File.join(Msf::Config.get_config_root, "database.yml")
|
||||
if (dbfile and File.readable? dbfile)
|
||||
dbinfo = YAML.load(File.read(dbfile))
|
||||
dbenv = opts['DatabaseEnv'] || "production"
|
||||
db = dbinfo[dbenv]
|
||||
|
||||
if (dbfile and File.exists? dbfile)
|
||||
if File.readable?(dbfile)
|
||||
dbinfo = YAML.load(File.read(dbfile))
|
||||
dbenv = opts['DatabaseEnv'] || "production"
|
||||
db = dbinfo[dbenv]
|
||||
else
|
||||
print_error("Warning, #{dbfile} is not readable. Try running as root or chmod.")
|
||||
end
|
||||
if not db
|
||||
print_error("No database definition for environment #{dbenv}")
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue