- cmd = 'ip link set {0} netns {1}'.format(interface, namespace)
- (rc, _, stderr) = exec_cmd(node, cmd, timeout=5, sudo=True)
- if rc != 0:
- raise RuntimeError(
- 'Could not attach interface, reason:{}'.format(stderr))
- cmd = 'ip netns exec {} ip link set {} up'.format(
- namespace, interface)
- (rc, _, stderr) = exec_cmd(node, cmd, timeout=5, sudo=True)
- if rc != 0:
+ cmd = f"ip link set {interface} netns {namespace}"
+
+ ret_code, _, stderr = exec_cmd(node, cmd, timeout=5, sudo=True)
+ if ret_code != 0:
+ raise RuntimeError(f"Could not attach interface, reason:\n{stderr}")
+
+ cmd = f"ip netns exec {namespace} ip link set {interface} up"
+
+ ret_code, _, stderr = exec_cmd(node, cmd, timeout=5, sudo=True)
+ if ret_code != 0: