Make errors reported by OpenSim when it halts because it can't find certain config sections or files a bit more user friendly.

iar_mods
Justin Clark-Casey (justincc) 2012-01-24 22:35:55 +00:00
parent 8e0eaa980f
commit 2d0412d366
3 changed files with 12 additions and 20 deletions

View File

@ -107,15 +107,13 @@ namespace OpenSim
} }
else else
{ {
m_log.ErrorFormat("Master ini file {0} not found", masterFilePath); m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath));
Environment.Exit(1); Environment.Exit(1);
} }
} }
} }
string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");
string iniFileName =
startupConfig.GetString("inifile", "OpenSim.ini");
if (IsUri(iniFileName)) if (IsUri(iniFileName))
{ {
@ -131,8 +129,7 @@ namespace OpenSim
if (!File.Exists(Application.iniFilePath)) if (!File.Exists(Application.iniFilePath))
{ {
iniFileName = "OpenSim.xml"; iniFileName = "OpenSim.xml";
Application.iniFilePath = Path.GetFullPath( Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName));
Path.Combine(Util.configDir(), iniFileName));
} }
if (File.Exists(Application.iniFilePath)) if (File.Exists(Application.iniFilePath))
@ -142,15 +139,12 @@ namespace OpenSim
} }
} }
string iniDirName = string iniDirName = startupConfig.GetString("inidirectory", "config");
startupConfig.GetString("inidirectory", "config"); string iniDirPath = Path.Combine(Util.configDir(), iniDirName);
string iniDirPath =
Path.Combine(Util.configDir(), iniDirName);
if (Directory.Exists(iniDirPath)) if (Directory.Exists(iniDirPath))
{ {
m_log.InfoFormat("Searching folder {0} for config ini files", m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath);
iniDirPath);
string[] fileEntries = Directory.GetFiles(iniDirName); string[] fileEntries = Directory.GetFiles(iniDirName);
foreach (string filePath in fileEntries) foreach (string filePath in fileEntries)
@ -172,7 +166,6 @@ namespace OpenSim
if (sources.Count == 0) if (sources.Count == 0)
{ {
m_log.FatalFormat("[CONFIG]: Could not load any configuration"); m_log.FatalFormat("[CONFIG]: Could not load any configuration");
m_log.FatalFormat("[CONFIG]: Did you copy the OpenSimDefaults.ini.example file to OpenSimDefaults.ini?");
Environment.Exit(1); Environment.Exit(1);
} }

View File

@ -202,16 +202,16 @@ namespace OpenSim
// Load the simulation data service // Load the simulation data service
IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
if (simDataConfig == null) if (simDataConfig == null)
throw new Exception("Configuration file is missing the [SimulationDataStore] section"); throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
string module = simDataConfig.GetString("LocalServiceModule", String.Empty); string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
if (String.IsNullOrEmpty(module)) if (String.IsNullOrEmpty(module))
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section"); throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section.");
m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source }); m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
// Load the estate data service // Load the estate data service
IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
if (estateDataConfig == null) if (estateDataConfig == null)
throw new Exception("Configuration file is missing the [EstateDataStore] section"); throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
module = estateDataConfig.GetString("LocalServiceModule", String.Empty); module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
if (String.IsNullOrEmpty(module)) if (String.IsNullOrEmpty(module))
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");

View File

@ -126,11 +126,10 @@ namespace OpenSim.Server.Base
m_Config = new IniConfigSource(iniFile); m_Config = new IniConfigSource(iniFile);
} }
} }
catch (Exception) catch (Exception e)
{ {
System.Console.WriteLine("Error reading from config source {0}", System.Console.WriteLine("Error reading from config source. {0}", e.Message);
iniFile); Environment.Exit(1);
Thread.CurrentThread.Abort();
} }
// Merge the configuration from the command line into the // Merge the configuration from the command line into the