当方法仅返回false时,如何调试ruby-ldap? [英] How do I debug ruby-ldap when a method only returns false?

查看:88
本文介绍了当方法仅返回false时,如何调试ruby-ldap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是将帐户移至另一个OU。我的理解是以下代码可以完成这项工作。但是,它返回 false 。没有错误,警告或异常。我该如何调试为什么它不起作用?

My goal is to move an account to another OU. My understanding is that the following code should do the job. However, it returns false. There is no error, warning or exceptions. How do I debug why this isn't working?

secure_ldap.rename(
    olddn: self.dn, 
    newrdn: "CN=#{self.cn}", 
    delete_attributes: true, 
    new_superior: "#{ou}"
  )


推荐答案

好吧,一种方法可能是添加 pry-byebug 到您的应用程序。修改您的代码以包含 binding.pry ,然后运行您的应用程序:

Well, one approach might be to add pry and pry-byebug to your application. Modify your code to include binding.pry then run your application:

Frame number: 0/0

From: ./test.rb @ line 1 :

 => 1: binding.pry
    2: secure_ldap.rename(
    3:   olddn: self.dn,
    4:   newrdn: "CN=#{self.cn}",
    5:   delete_attributes: true,
    6:   new_superior: "#{ou}"

=> 

现在使用 step 逐行执行,它将允许您进入 重命名方法在net-ldap内部调用,例如检查该方法调用中的局部变量。

Now use step to step through the execution line by line. It will allow you to step into the rename method call inside of net-ldap, and for example inspect the local variables within that method call.

这篇关于当方法仅返回false时,如何调试ruby-ldap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆