2016-07-08 83 views
0

在linux下删除linux的输入工具,我能够这样如何运行LDAP使用Ant任务

sudo ldapdelete -x -w 1234 -D "cn=Manager,o=project1" -r "o=project1" 

运行ldapdelete现在我要做到这一点使用Ant任务:

<target name="ldap-delete"> 
     <exec executable="ldapdelete" failonerror="false"> 
      <arg value="-x"/> 
      <arg value="-w"/> 
      <arg value="${ldap.password}"/> 
      <arg value="-D"/> 
      <arg value="&quot;${ldap.rootdn}&quot;"/> 
      <arg value="-r"/> 
      <arg value="&quot;${ldap.entry}&quot;"/> 
     </exec> 
</target> 

但运行ANT时失败:

[exec] ldap_bind: Invalid DN syntax (34) 
[exec]  additional info: invalid DN 
[exec] Result: 1 

我的ANT任务脚本有什么问题?

感谢

根据马丁·克莱顿的评论,我删除周围的-D报价和-r ARG值是这样的:

<arg value="-D"/> 
<arg value="${ldap.rootdn}"/> 
<arg value="-r"/> 
<arg value="${ldap.entry}"/> 

和运行蚂蚁用详细模式,我得到了以下错误:

[echo] ldapdelete... 
[exec] Current OS is Linux 
[exec] Executing 'ldapdelete' with arguments: 
[exec] '-x' 
[exec] '-w' 
[exec] '1234' 
[exec] '-D' 
[exec] 'cn=Manager,o=project1' 
[exec] '-r' 
[exec] 'o=project1' 
[exec] 
[exec] The ' characters around the executable and arguments are 
[exec] not part of the command. 
[exec] ldap_search: No such object (32) 
[exec] ldap_delete: No such object (32) 
[exec] Result: 32 
+1

您可能不需要在-D和-r arg值附加的额外引号。尝试以详细模式(-v)运行Ant,并且您将能够看到正在运行的实际ldapdelete命令行。 –

+0

感谢马丁。根据您的建议进行了一些更改后,我已更新了该问题,但仍无法正常工作。 – Victor

+0

'ldapdelete'本身有一个详细模式。在''下加''arg value =“ - v”/>'来查看'ldapdelete'是否输出一些有用的额外信息。 –

回答

0

结束了一个解决方案自己:

<target name="ldap-delete"> 
    <exec executable="ldapdelete" failonerror="false"> 
     <arg line="-x -w ${ldap.password} -D &quot;${ldap.rootdn}&quot; -r &quot;${ldap.entry}&quot;"/> 
    </exec> 
</target>