Skip to content

Commit 50d782a

Browse files
committed
fix: Remove DNS check that pollutes stdout
The cat /etc/resolv.conf check was outputting to stdout during setup, which broke tests that capture command output. Just write the DNS configuration directly without checking first.
1 parent c915816 commit 50d782a

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

src/jail/linux/mod.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -447,33 +447,6 @@ nameserver {}\n",
447447
let namespace_name = self.namespace_name();
448448
let host_ip = format_ip(self.host_ip);
449449

450-
// Check current DNS configuration
451-
let check_result = netlink::execute_in_netns(
452-
&namespace_name,
453-
&["cat".to_string(), "/etc/resolv.conf".to_string()],
454-
&[],
455-
None,
456-
);
457-
458-
let needs_fix = if let Ok(status) = check_result {
459-
if !status.success() {
460-
debug!("Cannot read /etc/resolv.conf in namespace, will fix DNS");
461-
true
462-
} else {
463-
// We can't easily capture output from execute_in_netns, so just assume we need to fix
464-
// if the namespace was just created
465-
debug!("DNS configuration exists, will update it to point to our server");
466-
true
467-
}
468-
} else {
469-
debug!("Failed to check DNS in namespace, will attempt fix");
470-
true
471-
};
472-
473-
if !needs_fix {
474-
return Ok(());
475-
}
476-
477450
debug!(
478451
"Configuring DNS in namespace {} to use {}",
479452
namespace_name, host_ip

0 commit comments

Comments
 (0)