2016-07-08 82 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>