Skip to content

Instantly share code, notes, and snippets.

View cathay4t's full-sized avatar

Gris Ge cathay4t

View GitHub Profile
from collections.abc import Mapping
from collections.abc import Sequence
def foo(desire, current):
if isinstance(desire, Mapping):
return isinstance(current, Mapping) and all(
foo(val, current.get(key))
for key, val in desired.items()
)
elif isinstance(desire, Sequence) and not isinstance(
Laptop2: 198.51.100.1/24
|
[Internet]
|
| [www.example.org eth0: 203.0.113.1/24]
+---------------------------------------+
| |
| www.example.org (SRV A) |
| |
+---------------------------------------+
#!/bin/bash -x
if [[ $1 ]]; then
sudo ip link del eth1
sudo ip link del eth2
sudo nmcli c delete eth1 eth2
exit
fi
sudo ip link add eth1 type veth peer name eth1.ep
  • DNS editing
    • Limitations:
      • Only support up most 2 name servers
      • DNS configure is stored in profile of interface with static default gateway.
    • Demos:
      • Change DNS setting using examples/dns_edit_eth1.yml
      • Remove DNS setting using examples/dns_remove.yml
      • Preserve old DNS config with empty state.
diff --git a/tests/integration/linux_bridge_test.py b/tests/integration/linux_bridge_test.py
index 9609c88..15eae7a 100644
--- a/tests/integration/linux_bridge_test.py
+++ b/tests/integration/linux_bridge_test.py
@@ -17,6 +17,7 @@
from contextlib import contextmanager
from copy import deepcopy
+import time
# _generate_dns_metadata() should be executed before
# _generate_route_metadata() as DNS editing might include new interface
# into desire_state with name only, the route metadata is required after
# that.
#!/bin/bash
pytest-3 --log-level=DEBUG --verbose --verbose $@