How to run /opt/manageiq/manageiq/tools/ldap_ping.rb from command line?


#1

from code here tools/ldap_ping.rb,
Looks like the is a good command line tool to debug ldap/ldaps connection issue.

How can I run it from command line prompt ?

[root@miq01 tools]# ruby ldap_ping.rb
ldap_ping.rb:4:in `’: uninitialized constant VMDBLogger (NameError)
[root@miq01 tools]#


#2

@tjyang try:

bundle exec rails r tools/ldap_ping.rb


#3

@Joe_Vlcek, thanks for the reply.

Here is the successful run lda_ping.rb script.
This will be a useful tool to debug ldap binding issue.
./ldap_ping.log has more detail connection log.

[root@miq01 vmdb]# bundle exec rails r tools/ldap_ping.rb
[2017-03-20 12:03:46 UTC] INFO: ==================================
[2017-03-20 12:03:46 UTC] INFO: Starting
[2017-03-20 12:03:46 UTC] INFO: Resolved host <dst01.test.com> has these IP Address: [“10.65.174.2”]
[2017-03-20 12:03:46 UTC] INFO: ----------------------------------
[2017-03-20 12:03:46 UTC] INFO: Binding to LDAP: Host: <10.65.174.2>, User: <CN=myname,OU=User Accounts,DC=test,DC=com>…
[2017-03-20 12:03:46 UTC] WARN: Binding to LDAP: Host: <10.65.174.2>, User: <CN=myname,OU=User Accounts,DC=test,DC=com>… unsuccessful because
[2017-03-20 12:03:46 UTC] INFO: Done
[root@miq01 vmdb]#

Ref: http://stackoverflow.com/questions/7958594/how-to-run-a-ruby-script-within-bundler-context


#4

Thanks to @Fryguy and @kbrock for helping me answer your question.