@Override
public InetAddress attachNetwork(String containerId) {
Tasks.setBlockingDetails("Attach Weave to " + containerId);
try {
Cidr cidr = getEntity().getConfig(WeaveInfrastructure.WEAVE_CIDR);
InetAddress address = getEntity().getConfig(WeaveContainer.WEAVE_INFRASTRUCTURE).get();
((WeaveContainer) getEntity()).getDockerHost().execCommand(BashCommands.sudo(String.format("%s attach %s/%d %s",
getWeaveCommand(), address.getHostAddress(), cidr.getLength(), containerId)));
return address;
} finally {
Tasks.resetBlockingDetails();
}
}