blogic / udrone

2 stars 1 forks source link

udrone responds with 22: Invalid argument #16

Open aparcar opened 4 years ago

aparcar commented 4 years ago

When trying basic commands with ubus to receive some data I receive the error message stated in the title.

I'm using the test setup described here

The commands are tested on the drone itself and work, however the udrone ubus module seems to handle the parameters wrong.

On the drone:

root@66fb9110fc03:/tmp# ubus call file read '{"path":"/tmp/resolv.conf","base64":false}'
{
    "data": "search lan\nnameserver 127.0.0.1\n"
}
root@66fb9110fc03:/tmp# ubus call file read '{"path":"/tmp/resolv.conf","base64":true}'
{
    "data": "c2VhcmNoIGxhbgpuYW1lc2VydmVyIDEyNy4wLjAuMQo="
}

Running the same via udronerc:

recv    {"from":"th","to":"th_basic_dhcp","type":"ubus","seq":1416042969,"data":{"path":"file","method":"read","param":{"path":"/tmp/resolv.conf","base64":false}}}
send    {"to":"th","from":"0242c0a80101","seq":1416042969,"type":"status","data":{"code":22,"errstr":"Invalid argument"}}

My conclusion is that it's related to #13

aparcar commented 4 years ago

With the latest udronerc and suites/network.yml I get the following output:

INFO:udronerc.cli:Starting CLI
INFO:udronerc.dronehost:Initializing host on 192.168.1.2 with ID th
INFO:udronerc.udronerc:PLAY basic_dhcp - Basic DHCP test [0/1]
INFO:udronerc.udronerc:TASK [Sysinfo]
ok: [0242c0a80101] => {
    "bufferram": 392974336.0,
    "freeram": 6681120768.0,
    "freeswap": 16986927104.0,
    "load1": 262.75,
    "load15": 149.625,
    "load5": 220.25,
    "procs": 1426,
    "sharedram": 1441439744.0,
    "totalram": 16599801856.0,
    "totalswap": 16986927104.0,
    "uptime": 13795
}
INFO:udronerc.udronerc:TASK [Set UCI configuration]
{'0242c0a80101': {'to': 'th', 'from': '0242c0a80101', 'seq': 143416792, 'type': 'status', 'data': {'code': 0}, 'status': 'ok'}}
ok: [0242c0a80101] => {
    "code": 0
}
INFO:udronerc.udronerc:TASK [Print resolv.conf]
WARNING:udronerc.dronegroup:drone 0242c0a80101 responded with 22: Invalid argument
failed: [0242c0a80101] => {
    "code": 22,
    "errstr": "Invalid argument"
}
INFO:udronerc.udronerc:TASK [checkip]
WARNING:udronerc.dronegroup:drone 0242c0a80101 responded with 22: Invalid argument
failed: [0242c0a80101] => {
    "code": 22,
    "errstr": "Invalid argument"
}
INFO:udronerc.udronerc:TASK [host_sleep]
ok: [host]: sleep 5s => "Sleep just for testing"
INFO:udronerc.udronerc:TASK [Restart dhcp/network]
ok: [0242c0a80101] => {
    "error": "Invalid action"
}
INFO:udronerc.udronerc:Reset group basic_dhcp
INFO:udronerc.cli:Stored suite results to results.json

The drone log:

recv    {"from":"th","to":"th_basic_dhcp","type":"!whois","seq":1847213443,"data":{"board":"generic"}}
recv    {"from":"th","to":"!all-default","type":"!whois","seq":515959467,"data":{"board":"generic"}}
send    {"to":"th","from":"0242c0a80101","seq":515959467,"type":"status","data":{"board":"generic","code":0}}
recv    {"from":"th","to":"0242c0a80101","type":"!assign","seq":1180246774,"data":{"group":"th_basic_dhcp","seq":143416790}}
send    {"to":"th","from":"0242c0a80101","seq":1180246774,"type":"status","data":{"board":"generic","code":0}}
recv    {"from":"th","to":"th_basic_dhcp","type":"sysinfo","seq":143416791,"data":null}
send    {"to":"th","from":"0242c0a80101","seq":143416791,"type":"sysinfo","data":{"uptime":13795,"load1":262.750000,"load5":220.250000,"load15":149.625000,"totalram":16599801856.000000,"freeram":6681120768.000000,"sharedram":1441439744.000000,"bufferram":392974336.000000,"totalswap":16986927104.000000,"freeswap":16986927104.000000,"procs":1426}}
recv    {"from":"th","to":"th_basic_dhcp","type":"uci_set","seq":143416792,"data":{"network":{"wan":{"proto":"dhcp"},"lan":{"gateway":"192.168.11.1","ipaddr":"192.168.11.11","netmask":"255.255.255.0","proto":"static"}}}}
udrone-05051572d6b97d68340261ee0771abe1acd098f8/cmd_uci.c:handler_uci_set[75]proto dhcp
udrone-05051572d6b97d68340261ee0771abe1acd098f8/cmd_uci.c:handler_uci_set[75]gateway 192.168.11.1
udrone-05051572d6b97d68340261ee0771abe1acd098f8/cmd_uci.c:handler_uci_set[75]ipaddr 192.168.11.11
udrone-05051572d6b97d68340261ee0771abe1acd098f8/cmd_uci.c:handler_uci_set[75]netmask 255.255.255.0
udrone-05051572d6b97d68340261ee0771abe1acd098f8/cmd_uci.c:handler_uci_set[75]proto static
send    {"to":"th","from":"0242c0a80101","seq":143416792,"type":"status","data":{"code":0}}
recv    {"from":"th","to":"th_basic_dhcp","type":"ubus","seq":143416793,"data":{"path":"file","method":"read","param":{"path":"/tmp/resolv.conf","base64":false}}}
send    {"to":"th","from":"0242c0a80101","seq":143416793,"type":"status","data":{"code":22,"errstr":"Invalid argument"}}
recv    {"from":"th","to":"th_basic_dhcp","type":"ubus","seq":143416794,"data":{"path":"network.interface.lan","method":"dump"}}
send    {"to":"th","from":"0242c0a80101","seq":143416794,"type":"status","data":{"code":22,"errstr":"Invalid argument"}}
recv    {"from":"th","to":"th_basic_dhcp","type":"ubus","seq":143416795,"data":{"path":"luci","method":"setInitAction","param":{"name":"network","action":"restart"}}}
send    {"to":"th","from":"0242c0a80101","seq":143416795,"type":"ubus","data":{"error":"Invalid action"}}