diff options
author | Ananta Bastola <anantarajbastola@gmail.com> | 2023-12-17 02:19:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-17 08:19:43 +0100 |
commit | a910e094f77ba6d67349a561e5e9780becfe823a (patch) | |
tree | 76682f7f9272c052a4630e6dc4ae42a4dba779a4 | |
parent | 00d3dc86a21d11aede96f81ffbe49babe487984e (diff) |
fix(docker_context): ignore unix domain socket path from Docker Context (#5616)
* fix(modules): ignore unix domain socket path from Docker Context
fix #5548
* refactor(docker_context): ignore docker_context on unix domain socket path
Closes #5548
-rw-r--r-- | src/modules/docker_context.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/modules/docker_context.rs b/src/modules/docker_context.rs index 1c30001a8..ad6c258a7 100644 --- a/src/modules/docker_context.rs +++ b/src/modules/docker_context.rs @@ -57,7 +57,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { } }; - if ctx == "default" { + if ctx == "default" || ctx.starts_with("unix://") { return None; } @@ -294,6 +294,24 @@ mod tests { } #[test] + fn test_docker_host_env_with_unix_path() -> io::Result<()> { + let cfg_dir = tempfile::tempdir()?; + + let actual = ModuleRenderer::new("docker_context") + .env("DOCKER_HOST", "unix:///run/user/1001/podman/podman.sock") + .config(toml::toml! { + [docker_context] + only_with_files = false + }) + .collect(); + let expected = None; + + assert_eq!(expected, actual); + + cfg_dir.close() + } + + #[test] fn test_docker_context_env() -> io::Result<()> { let cfg_dir = tempfile::tempdir()?; |