Patch :
+ Talk to master if homeserver is not set.
Please review.
Thanks,
Johnny
Index: src/server/Simias.Server/DomainService.asmx.cs
===================================================================
--- src/server/Simias.Server/DomainService.asmx.cs (revision 6746)
+++ src/server/Simias.Server/DomainService.asmx.cs (working copy)
@@ -135,6 +135,37 @@
[WebMethod(EnableSession=true)]
[SoapDocumentMethod]
+ public Simias.Host.HostInfo[] GetHosts()
+ {
+ Simias.Server.EnterpriseDomain enterpriseDomain =
+ new Simias.Server.EnterpriseDomain( false );
+ if ( enterpriseDomain == null )
+ {
+ throw new SimiasException( "Enterprise server
domain does not exist." );
+ }
+
+ Simias.Host.HostInfo[] infoList;
+ HostNode[] hosts =
HostNode.GetHosts(enterpriseDomain.ID);
+
+ if (hosts.Length > 0)
+ {
+ infoList = new
Simias.Host.HostInfo[hostsLength];
+ int i = 0;
+ foreach (HostNode hn in hosts)
+ {
+ infoList[i++] = new
Simias.Host.HostInfo(hn);
+ }
+ }
+ else
+ {
+ infoList = new Simias.Host.HostInfo[0];
+ }
+
+ return infoList;
+ }
+
+ [WebMethod(EnableSession=true)]
+ [SoapDocumentMethod]
public Simias.Host.HostInfo GetHomeServer( string user )
{
Simias.Server.EnterpriseDomain enterpriseDomain =
@@ -156,8 +187,14 @@
HostNode hNode = member.HomeServer;
if ( hNode == null )
{
- return ProvisionService.ProvisionUser( user );
- }
+ if (HostNode.GetLocalHost().IsMasterHost)
+ return ProvisionService.ProvisionUser(
user );
+ else
+ {
+ return null;
+ //need to get the home server from
master.
+ }
+ }
return new Simias.Host.HostInfo(hNode);
}
Index: src/core/Domain/DomainAgent.cs
===================================================================
--- src/core/Domain/DomainAgent.cs (revision 6746)
+++ src/core/Domain/DomainAgent.cs (working copy)
@@ -470,7 +470,30 @@
string hostID = null;
try
{
- HostInfo hInfo =
domainService.GetHomeServer(user);
+//Provisioning should be done only in master.
+
+ HostInfo hInfo =
domainService.GetHomeServer(user);
+ if (hInfo == null)
+ {
+ string masterServerURL = null;
+ HostInfo[] serverList =
domainService.GetHosts ();
+ foreach (HostInfo server in
serverList)
+ {
+ if (server.Master)
+ masterServerURL =
server.PublicAddress;
+ }
+
+ //Now Talk to the master server and
provision the user.
+ DomainService ds = new
DomainService();
+ ds.CookieContainer = cookies;
+ ds.Url = (new
Uri(masterServerURL.TrimEnd( new char[] {'/'} ) + DomainService)).ToString();
+ ds.Credentials = myCred;
+ ds.PreAuthenticate = true;
+// ds.Proxy =
ProxyState.GetProxyState( domainServiceUrl );
+ ds.AllowAutoRedirect = true;
+ hInfo = ds.GetHomeServer(user);
+ }
+
domainServiceUrl = new
Uri(hInfo.PublicAddress.TrimEnd( new char[] {'/'} ) + DomainService);
domainService.Url = domainServiceUrl.ToString();
hostID = hInfo.ID;
Index: src/core/SimiasClient/DomainService.cs
===================================================================
--- src/core/SimiasClient/DomainService.cs (revision 6746)
+++ src/core/SimiasClient/DomainService.cs (working copy)
@@ -49,6 +49,21 @@
object[] results = this.EndInvoke(asyncResult);
return ((DomainInfo)(results[0]));
}
+
+
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://novell.com/simias/domain/GetHosts",
RequestNamespace="http://novell.com/simias/domain",
ResponseNamespace="http://novell.com/simias/domain",
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped,
Use=System.Web.Services.Description.SoapBindingUse.Literal)]
+ public HostInfo[] GetHosts() {
+ object[] results = this.Invoke("GetHosts", new object[0]);
+ return ((HostInfo[])(results[0]));
+ }
+
+ public System.IAsyncResult BeginGetHosts(System.AsyncCallback
callback, object asyncState) {
+ return this.BeginInvoke("GetHosts", new object[0], callback,
asyncState);
+ }
+
+ public HostInfo[] EndGetHosts(System.IAsyncResult asyncResult) {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((HostInfo[])(results[0]));
+ }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://novell.com/simias/domain/GetHomeServer",
RequestNamespace="http://novell.com/simias/domain",
ResponseNamespace="http://novell.com/simias/domain",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
_______________________________________________
ifolder-dev mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/ifolder-dev