From 576884ec10b4a46b243b8138926c0fc650bcdaba Mon Sep 17 00:00:00 2001 From: Ian Duffy Date: Mon, 17 Jun 2013 15:00:19 +0100 Subject: [PATCH] Add fix for CLOUDSTACK-2168. Changed listAll output to conform to the same output as listconfiguration Signed-off-by: Abhinandan Prateek --- .../api/command/admin/ldap/LDAPConfigCmd.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java index 2726f84163d..efd1c76645c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java @@ -17,6 +17,9 @@ package org.apache.cloudstack.api.command.admin.ldap; +import java.util.ArrayList; +import java.util.List; + import javax.naming.NamingException; import org.apache.cloudstack.api.APICommand; @@ -24,7 +27,9 @@ import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse; import org.apache.cloudstack.api.response.LDAPConfigResponse; +import org.apache.cloudstack.api.response.ListResponse; import org.apache.log4j.Logger; import com.cloud.exception.ConcurrentOperationException; @@ -158,9 +163,16 @@ public class LDAPConfigCmd extends BaseCmd { if (getListAll()){ // return the existing conf LDAPConfigCmd cmd = _configService.listLDAPConfig(this); - LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN()); - lr.setResponseName(getCommandName()); - this.setResponseObject(lr); + ListResponse response = new ListResponse(); + List responses = new ArrayList(); + + if(!cmd.getHostname().equals("")) { + responses.add(_responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN())); + } + + response.setResponses(responses); + response.setResponseName(getCommandName()); + this.setResponseObject(response); } else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) { throw new InvalidParameterValueException("You need to provide hostname, searchbase and queryfilter to configure your LDAP server"); @@ -191,4 +203,4 @@ public class LDAPConfigCmd extends BaseCmd { } -} +} \ No newline at end of file