* 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))
{
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;
}
@ -166,22 +168,40 @@ namespace OpenSim.Grid.UserServer
LLUUID userID = new LLUUID();
try
{
userID =
m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
} catch (Exception ex)
userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
}
catch (Exception ex)
{
m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
}
try
{
RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
userID.UUID);
}
catch (Exception ex)
bool created
= SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
"POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
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;
break;
}

View File

@ -310,14 +310,15 @@ namespace OpenSim.Grid.UserServer
= SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
"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)
{
m_log.InfoFormat(
"[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 =
SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
"POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
@ -340,6 +341,7 @@ namespace OpenSim.Grid.UserServer
LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
// 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();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
else