* Change user inventory create from explicit 'create user' command on the console from sync to async

* Catch more error conditions and provide more messages when things go wrong
0.6.0-stable
Justin Clarke Casey 2008-04-20 19:07:42 +00:00
parent e755727a0f
commit dcaf457bb8
2 changed files with 34 additions and 11 deletions

View File

@ -157,7 +157,9 @@ namespace OpenSim.Grid.UserServer
if (null != m_userManager.GetUserProfile(tempfirstname, templastname)) if (null != m_userManager.GetUserProfile(tempfirstname, templastname))
{ {
m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname); m_log.ErrorFormat(
"[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
break; break;
} }
@ -166,22 +168,40 @@ namespace OpenSim.Grid.UserServer
LLUUID userID = new LLUUID(); LLUUID userID = new LLUUID();
try try
{ {
userID = userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); }
} catch (Exception ex) catch (Exception ex)
{ {
m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString()); m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
} }
try try
{ {
RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", bool created
userID.UUID); = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
} "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
catch (Exception ex)
if (!created)
{ {
m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", ex.ToString()); throw new Exception(
String.Format(
"The inventory creation request for user {0} did not succeed."
+ " Please contact your inventory service provider for more information.",
userID));
} }
}
catch (System.Net.WebException e)
{
m_log.ErrorFormat(
"[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
}
catch (Exception e)
{
m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
}
m_lastCreatedUser = userID; m_lastCreatedUser = userID;
break; break;
} }

View File

@ -310,14 +310,15 @@ namespace OpenSim.Grid.UserServer
= SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
"POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
// In theory, the user will only ever be missing a root folder in situations where a grid
// which didn't previously run a grid wide inventory server is being transitioned to one
// which does.
if (null == folders || folders.Count == 0) if (null == folders || folders.Count == 0)
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID); "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID);
// Although the create user function creates a new agent inventory along with a new user profile, some
// tools are creating the user profile directly in the database without creating the inventory. At
// this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
// exist.
bool created = bool created =
SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
"POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID); "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
@ -340,6 +341,7 @@ namespace OpenSim.Grid.UserServer
LLUUID rootID = LLUUID.Zero; LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList(); ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash; Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders) foreach (InventoryFolderBase InvFolder in folders)
{ {
// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name); // m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
@ -356,6 +358,7 @@ namespace OpenSim.Grid.UserServer
TempHash["folder_id"] = InvFolder.ID.ToString(); TempHash["folder_id"] = InvFolder.ID.ToString();
AgentInventoryArray.Add(TempHash); AgentInventoryArray.Add(TempHash);
} }
return new InventoryData(AgentInventoryArray, rootID); return new InventoryData(AgentInventoryArray, rootID);
} }
else else