KeyError:'ifname'将OpenWRT tar.gz转换为NetJSON

问题描述 投票:0回答:1

我试图使用netjsonconfig命令行实用程序并尝试将OpenWRT tar.gz转换为NetJSON并打印到标准输出(带有4个空格缩进)实用程序

netjsonconfig --native network --backend openwrt --method json -a indent=" "

但是跟随错误显示,

ubuntu@ip-172-31-21-48:~/netjsontest$ netjsonconfig --native backup.tar.gz --backend openwrt --method json -a indent="    "

Traceback (most recent call last):
  File "/usr/local/bin/netjsonconfig", line 180, in <module>
instance = backend_class(**options)

  File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/backend.py", line 47, in __init__
    self.parse(native)

  File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/backend.py", line 280, in parse
    self.to_netjson()

  File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/backend.py", line 293, in to_netjson
    value = converter.to_netjson()

  File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/converter.py", line 108, in to_netjson
    result = self.to_netjson_loop(block, result, index + 1)

  File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/openwrt/converters/wireless.py", line 118, in to_netjson_loop
    interface = self.__get_netjson_interface(block)

  File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/openwrt/converters/wireless.py", line 246, in __get_netjson_interface
    if interface['name'] == wifi['ifname']:
KeyError: 'ifname'

`

  • Python版本:Python 2.7.6
  • 操作系统:ubuntu:14.04

任何人都可以帮我解决这个问题吗?

编辑:

http://netjsonconfig.openwisp.org/en/stable/general/commandline_utility.html
linux python-2.7 ubuntu-14.04 openwrt openwisp
1个回答
0
投票

network包含什么?

你得到的例外看起来像一个bug,你不应该得到例外而是失败。

也许最好在https://github.com/openwisp/netjsonconfig中打开一个问题

© www.soinside.com 2019 - 2024. All rights reserved.