Lync User Provisioning retry added

This commit is contained in:
robvde 2014-04-22 17:09:35 +04:00
parent 8f51befe02
commit f38530fd66
3 changed files with 27 additions and 11 deletions

View file

@ -274,7 +274,7 @@ namespace WebsitePanel.Providers.HostedSolution
command = new Command("Update-CsUserDatabase"); command = new Command("Update-CsUserDatabase");
ExecuteShellCommand(runspace, command, false); ExecuteShellCommand(runspace, command, false);
int trySleep = 5000; int tryMaxCount = 10; bool PlanSet = false; int trySleep = 2000; int tryMaxCount = 10; bool PlanSet = false;
for (int tryCount = 0; (tryCount < tryMaxCount) && (!PlanSet); tryCount++ ) for (int tryCount = 0; (tryCount < tryMaxCount) && (!PlanSet); tryCount++ )
{ {
try try
@ -285,10 +285,6 @@ namespace WebsitePanel.Providers.HostedSolution
if (!PlanSet) System.Threading.Thread.Sleep(trySleep); if (!PlanSet) System.Threading.Thread.Sleep(trySleep);
} }
command = new Command("Update-CsAddressBook");
ExecuteShellCommand(runspace, command, false);
command = new Command("Update-CsUserDatabase");
ExecuteShellCommand(runspace, command, false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -474,7 +470,7 @@ namespace WebsitePanel.Providers.HostedSolution
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId); HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn); HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn);
bool bCloseRunSpace = false; bool bCloseRunSpace = false;
bool bResult = false; bool ret = true;
try try
{ {
@ -533,7 +529,7 @@ namespace WebsitePanel.Providers.HostedSolution
command = new Command("Update-CsUserDatabase"); command = new Command("Update-CsUserDatabase");
ExecuteShellCommand(runspace, command, false); ExecuteShellCommand(runspace, command, false);
bResult = true; ret = false;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -550,7 +546,7 @@ namespace WebsitePanel.Providers.HostedSolution
HostedSolutionLog.LogEnd("SetLyncUserPlanInternal"); HostedSolutionLog.LogEnd("SetLyncUserPlanInternal");
return bResult; return ret;
} }
/// <summary> Deletes user.</summary> /// <summary> Deletes user.</summary>

View file

@ -509,8 +509,16 @@ namespace WebsitePanel.Providers.HostedSolution
} }
user.CommitChanges(); user.CommitChanges();
//set-plan int trySleep = 2000; int tryMaxCount = 10; bool PlanSet = false;
SetLyncUserPlanInternal(organizationId, userUpn, plan, runSpace); for (int tryCount = 0; (tryCount < tryMaxCount) && (!PlanSet); tryCount++)
{
try
{
PlanSet = SetLyncUserPlanInternal(organizationId, userUpn, plan, runSpace);
}
catch { }
if (!PlanSet) System.Threading.Thread.Sleep(trySleep);
}
//initiate addressbook generation //initiate addressbook generation
cmd = new Command("Update-CsAddressBook"); cmd = new Command("Update-CsAddressBook");
@ -519,6 +527,9 @@ namespace WebsitePanel.Providers.HostedSolution
//initiate user database replication //initiate user database replication
cmd = new Command("Update-CsUserDatabase"); cmd = new Command("Update-CsUserDatabase");
ExecuteShellCommand(runSpace, cmd, false); ExecuteShellCommand(runSpace, cmd, false);
} }
else else
{ {

View file

@ -509,7 +509,16 @@ namespace WebsitePanel.Providers.HostedSolution
user.CommitChanges(); user.CommitChanges();
//set-plan //set-plan
SetLyncUserPlanInternal(organizationId, userUpn, plan, runSpace); int trySleep = 2000; int tryMaxCount = 10; bool PlanSet = false;
for (int tryCount = 0; (tryCount < tryMaxCount) && (!PlanSet); tryCount++)
{
try
{
PlanSet = SetLyncUserPlanInternal(organizationId, userUpn, plan, runSpace);
}
catch { }
if (!PlanSet) System.Threading.Thread.Sleep(trySleep);
}
//initiate addressbook generation //initiate addressbook generation
cmd = new Command("Update-CsAddressBook"); cmd = new Command("Update-CsAddressBook");