ct_netconfc:open/1引发“异常错误:错误参数". [英] ct_netconfc:open/1 raises an "exception error: bad argument"

查看:186
本文介绍了ct_netconfc:open/1引发“异常错误:错误参数".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了这个Erlang模块:

I wrote this Erlang module:

-module(ncclient).
-export([open/0]).

open() -> 
    Host = {ssh, {192,168,30,11}},
    Port = {port, 830},
    User = {user, "admin"},
    Pass = {password, "admin"},
    ct_netconfc:open([Host, Port, User, Pass]).

已编译,然后运行它:

# erl
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]

Eshell V9.1  (abort with ^G)
1> c(ncclient).
{ok,ncclient}
2> ncclient:open().
** exception error: bad argument
 in function  ets:select/2
    called as ets:select(ct_attributes,
                         [{{ct_conf,'$1','_','_','_',undefined,'_'},[],['$1']}])
 in call from ct_config:get_key_from_name/1 (ct_config.erl, line 575)
 in call from ct_util:does_connection_exist/3 (ct_util.erl, line 576)
 in call from ct_gen_conn:do_start/4 (ct_gen_conn.erl, line 223)
 in call from ct_netconfc:open/4 (ct_netconfc.erl, line 388)

我按照如下说明格式化了参数的格式:open/1( http://erlang.org/doc/man/ct_netconfc.html#open-1 );仍然命令返回错误.

I formatted the arguments as explains the documentation for open/1 (http://erlang.org/doc/man/ct_netconfc.html#open-1); still the commands gives back an error.

有人可以帮助我理解吗?

May someone help me to understand?

谢谢

Ariel

推荐答案

实际上需要user_dir选项.您需要像这样使用它:

The user_dir option is actually required. you need to use it like:

-module(ncclient).
-export([open/0]).

open() -> 
  Host = {ssh, {192,168,30,11}},
  Port = {port, 830},
  User = {user, "admin"},
  Pass = {password, "admin"},
  Dir = {user_dir, "/home/username"},
  ct_netconfc:open([Host, Port, User, Pass, Dir]).

希望这会有所帮助:)

这篇关于ct_netconfc:open/1引发“异常错误:错误参数".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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