Commit Graph

9 Commits (main)

Author SHA1 Message Date
dadevel 121288feb9
add exec command 4 weeks ago
UpYoursMicrosoft 150a052211
support moving interfaces into default netns
Closes #23.
2 months ago
Dmitry Vodopyanov 5a3d297d82
handle empty ip netns output
This patch fixes the crash which happens during execution of `wg-netns list`.
The crash happens if nothing else from `wg-netns` is executed on machine yet,
i.e., after the reboot. In that case, `ip -json netns` returns an empty string,
not `[]`, so we get an exception if we pass empty line into `json.loads()`.

```
$ export WG_VERBOSE=1
$ /home/user/.local/bin/wg-netns list
> ip -json netns
error: Expecting value: line 1 column 1 (char 0) (JSONDecodeError)
Traceback (most recent call last):
  File "/home/user/.local/bin/wg-netns", line 391, in <module>
    main()
  File "/home/user/.local/bin/wg-netns", line 27, in main
    cli(sys.argv[1:])
  File "/home/user/.local/bin/wg-netns", line 93, in cli
    data = json.loads(output)
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
5 months ago
dadevel 008833d7fc
release v2.3.0 12 months ago
dadevel 2bbc743d9b
release v2.2.2 1 year ago
dadevel 79c3c81397
release v2.2.1 1 year ago
dadevel 41665ca136
add list and switch commands 2 years ago
Chris Bouchard 56a9e4fbe6
add option to run shell hooks in host netns
Closes #6.
2 years ago
dadevel baa1d01a49
package with poetry 2 years ago