diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-18 20:27:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-18 20:27:20 +0200 |
commit | 8ca76a93743e18f94428fd00e3d8c277eaaceec9 (patch) | |
tree | 904cffc51618dbb7cb30b0d6293d29005ce1e00f | |
parent | d76dbb558a4fcb73c2377b5524451bb408419802 (diff) | |
parent | dd194aaa4a2ff04865c54c61282098d56d572ed9 (diff) | |
download | vyos-1x-8ca76a93743e18f94428fd00e3d8c277eaaceec9.tar.gz vyos-1x-8ca76a93743e18f94428fd00e3d8c277eaaceec9.zip |
Merge pull request #357 from thomas-mangin/T2320
interfaces: T2320: correctly honour create and debug options
-rw-r--r-- | python/vyos/ifconfig/interface.py | 2 | ||||
-rw-r--r-- | python/vyos/ifconfig/macvlan.py | 3 | ||||
-rw-r--r-- | python/vyos/ifconfig/vxlan.py | 3 | ||||
-rw-r--r-- | python/vyos/ifconfig/wireguard.py | 5 | ||||
-rw-r--r-- | python/vyos/ifconfig/wireless.py | 3 | ||||
-rwxr-xr-x | src/op_mode/wireguard.py | 8 |
6 files changed, 16 insertions, 8 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 32ce1a80c..5b26f8bab 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -49,7 +49,7 @@ class Interface(Control): # WireGuard to modify their display behaviour OperationalClass = Operational - options = [] + options = ['debug', 'create',] required = [] default = { 'type': '', diff --git a/python/vyos/ifconfig/macvlan.py b/python/vyos/ifconfig/macvlan.py index 55b1a3e91..37228e57f 100644 --- a/python/vyos/ifconfig/macvlan.py +++ b/python/vyos/ifconfig/macvlan.py @@ -35,7 +35,8 @@ class MACVLANIf(Interface): 'prefixes': ['peth', ], }, } - options = Interface.options + ['source_interface', 'mode'] + options = Interface.options + \ + ['source_interface', 'mode'] def _create(self): cmd = 'ip link add {ifname} link {source_interface} type macvlan mode {mode}'.format( diff --git a/python/vyos/ifconfig/vxlan.py b/python/vyos/ifconfig/vxlan.py index f47ae17cc..f9f2e38e9 100644 --- a/python/vyos/ifconfig/vxlan.py +++ b/python/vyos/ifconfig/vxlan.py @@ -59,7 +59,8 @@ class VXLANIf(Interface): 'bridgeable': True, } } - options = ['group', 'remote', 'src_interface', 'port', 'vni', 'src_address'] + options = Interface.options + \ + ['group', 'remote', 'src_interface', 'port', 'vni', 'src_address'] mapping = { 'ifname': 'add', diff --git a/python/vyos/ifconfig/wireguard.py b/python/vyos/ifconfig/wireguard.py index ff945c9d0..fdf5d9347 100644 --- a/python/vyos/ifconfig/wireguard.py +++ b/python/vyos/ifconfig/wireguard.py @@ -165,8 +165,9 @@ class WireGuardIf(Interface): 'bridgeable': True, } } - options = ['port', 'private-key', 'pubkey', 'psk', - 'allowed-ips', 'fwmark', 'endpoint', 'keepalive'] + options = Interface.options + \ + ['port', 'private-key', 'pubkey', 'psk', + 'allowed-ips', 'fwmark', 'endpoint', 'keepalive'] """ Wireguard interface class, contains a comnfig dictionary since diff --git a/python/vyos/ifconfig/wireless.py b/python/vyos/ifconfig/wireless.py index 946ae1642..3122ac0a3 100644 --- a/python/vyos/ifconfig/wireless.py +++ b/python/vyos/ifconfig/wireless.py @@ -38,7 +38,8 @@ class WiFiIf(Interface): 'bridgeable': True, } } - options = ['phy', 'op_mode'] + options = Interface.options + \ + ['phy', 'op_mode'] def _create(self): # all interfaces will be added in monitor mode diff --git a/src/op_mode/wireguard.py b/src/op_mode/wireguard.py index 297ba599d..15bf63e81 100755 --- a/src/op_mode/wireguard.py +++ b/src/op_mode/wireguard.py @@ -147,8 +147,12 @@ if __name__ == '__main__': if args.listkdir: list_key_dirs() if args.showinterface: - intf = WireGuardIf(args.showinterface, create=False, debug=False) - print(intf.operational.show_interface()) + try: + intf = WireGuardIf(args.showinterface, create=False, debug=False) + print(intf.operational.show_interface()) + # the interface does not exists + except Exception: + pass if args.delkdir: if args.location: del_key_dir(args.location) |