Skip to content

Commit

Permalink
Merge pull request #965 from mheon/internal_naming
Browse files Browse the repository at this point in the history
Add suffix to Aardvark internal network filenames
  • Loading branch information
openshift-merge-bot[bot] authored May 13, 2024
2 parents 395ace5 + 0e03c7c commit d982b8b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/commands/teardown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl Teardown {
container_ips_v6: Vec::new(),
container_names: Vec::new(),
container_dns_servers: &None,
is_internal: network.internal,
});
}
}
Expand Down
14 changes: 12 additions & 2 deletions src/dns/aardvark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub struct AardvarkEntry<'a> {
pub container_ips_v6: Vec<Ipv6Addr>,
pub container_names: Vec<String>,
pub container_dns_servers: &'a Option<Vec<IpAddr>>,
pub is_internal: bool,
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -221,7 +222,12 @@ impl Aardvark {
}

for entry in &entries {
let path = Path::new(&self.config).join(entry.network_name);
let mut path = Path::new(&self.config).join(entry.network_name);
if entry.is_internal {
let new_path = Path::new(&self.config).join(entry.network_name.to_owned() + "%int");
let _ = std::fs::rename(&path, &new_path);
path = new_path;
}

let file = match OpenOptions::new().write(true).create_new(true).open(&path) {
Ok(mut f) => {
Expand Down Expand Up @@ -326,7 +332,11 @@ impl Aardvark {
}

pub fn delete_entry(&self, container_id: &str, network_name: &str) -> Result<()> {
let path = Path::new(&self.config).join(network_name);
let mut path = Path::new(&self.config).join(network_name);
if !path.exists() {
path = Path::new(&self.config).join(network_name.to_owned() + "%int");
}

let file_content = fs::read_to_string(&path)?;
let lines: Vec<&str> = file_content.split_terminator('\n').collect();

Expand Down
1 change: 1 addition & 0 deletions src/network/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ impl driver::NetworkDriver for Bridge<'_> {
container_ips_v6: ipv6,
container_names: names,
container_dns_servers: self.info.container_dns_servers,
is_internal: self.info.network.internal,
})
} else {
// If --dns-enable=false and --dns was set then return following DNS servers
Expand Down

1 comment on commit d982b8b

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.