Skip to content

Commit

Permalink
Merge pull request #639 from rust-lang/fix-ssh-key-deletion
Browse files Browse the repository at this point in the history
Fix deletion of SSH keys
  • Loading branch information
jdno authored Dec 4, 2024
2 parents 20bcecc + b67c1d8 commit 5b12925
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions ansible/roles/dev-desktop/files/team_login/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
for entry in std::fs::read_dir(KEY_DIR)? {
let entry = entry?;
let path = entry.path();
if !path.is_file() {
if let Some(extension) = path.extension() {
if extension == "keys" {
if let Some(stem) = path.file_stem() {
if let Some(stem) = stem.to_str() {
if stem.starts_with("gh-") && !users.contains(stem) {
std::fs::remove_file(path)?;
}
}
if path.is_file() {
if let Some(stem) = path.file_stem() {
if let Some(stem) = stem.to_str() {
if stem.starts_with("gh-") && !users.contains(stem) {
std::fs::remove_file(path)?;
}
}
}
Expand Down

0 comments on commit 5b12925

Please sign in to comment.