In grid mode, add SuppressConsoleCommands flag to [GridService] so that we can stop misleading grid service only console commands from registering.

We need to do this because the simulator initializes and internal copy of the GridService in grid mode for internal purposes
bullet-2.82
Justin Clark-Casey (justincc) 2014-07-18 22:57:04 +01:00
parent a26d1ffc66
commit 6048dfcd71
3 changed files with 23 additions and 18 deletions

View File

@ -94,15 +94,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
private void InitialiseService(IConfigSource source) private void InitialiseService(IConfigSource source)
{ {
IConfig assetConfig = source.Configs["GridService"]; IConfig config = source.Configs["GridService"];
if (assetConfig == null) if (config == null)
{ {
m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini"); m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini");
return; return;
} }
string serviceDll = assetConfig.GetString("LocalServiceModule", string serviceDll = config.GetString("LocalServiceModule", String.Empty);
String.Empty);
if (serviceDll == String.Empty) if (serviceDll == String.Empty)
{ {

View File

@ -64,6 +64,9 @@ namespace OpenSim.Services.GridService
m_config = config; m_config = config;
IConfig gridConfig = config.Configs["GridService"]; IConfig gridConfig = config.Configs["GridService"];
bool suppressConsoleCommands = false;
if (gridConfig != null) if (gridConfig != null)
{ {
m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
@ -77,13 +80,17 @@ namespace OpenSim.Services.GridService
} }
m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch);
// This service is also used locally by a simulator running in grid mode. This switches prevents
// inappropriate console commands from being registered
suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands);
} }
if (m_RootInstance == null) if (m_RootInstance == null)
{ {
m_RootInstance = this; m_RootInstance = this;
if (MainConsole.Instance != null) if (!suppressConsoleCommands && MainConsole.Instance != null)
{ {
MainConsole.Instance.Commands.AddCommand("Regions", true, MainConsole.Instance.Commands.AddCommand("Regions", true,
"deregister region id", "deregister region id",
@ -92,17 +99,12 @@ namespace OpenSim.Services.GridService
String.Empty, String.Empty,
HandleDeregisterRegion); HandleDeregisterRegion);
// A messy way of stopping this command being added if we are in standalone (since the simulator MainConsole.Instance.Commands.AddCommand("Regions", true,
// has an identically named command "show regions",
// "show regions",
// XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. "Show details on all regions",
if (!MainConsole.Instance.Commands.HasCommand("show regions")) String.Empty,
MainConsole.Instance.Commands.AddCommand("Regions", true, HandleShowRegions);
"show regions",
"show regions",
"Show details on all regions",
String.Empty,
HandleShowRegions);
MainConsole.Instance.Commands.AddCommand("Regions", true, MainConsole.Instance.Commands.AddCommand("Regions", true,
"show region name", "show region name",
@ -132,6 +134,7 @@ namespace OpenSim.Services.GridService
String.Empty, String.Empty,
HandleSetFlags); HandleSetFlags);
} }
m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); m_HypergridLinker = new HypergridLinker(m_config, this, m_Database);
} }
} }

View File

@ -55,9 +55,12 @@
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
; for the LocalGridServicesConnector which is used by the Remote one ; for the LocalGridServicesConnector which is used by the Remote one
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
NetworkConnector = "OpenSim.Services.Connectors.dll:GridServicesConnector" NetworkConnector = "OpenSim.Services.Connectors.dll:GridServicesConnector"
; Because LocalGridServicesConnector starts this service, in grid mode we need to suppress
; the inappropriate console commands that it registers.
SuppressConsoleCommands = true
[LibraryService] [LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
LibraryName = "OpenSim Library" LibraryName = "OpenSim Library"