Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #35 from lucab/ups/cargo-update-users
Browse files Browse the repository at this point in the history
cargo: update users to 0.8
  • Loading branch information
Luca Bruno authored Oct 17, 2018
2 parents 9ca7ea4 + 3985ad4 commit f38f3d5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ license = "Apache-2.0"
repository = "https://github.com/coreos/update-ssh-keys"
documentation = "https://docs.rs/update-ssh-keys"
description = "A tool for managing authorized SSH keys"
version = "0.3.1-alpha.0"
version = "0.4.0-alpha.0"

[dependencies]
# Private dependencies.
clap = "2.26"
error-chain = { version = "0.12", default-features = false }
fs2 = "0.4"
# Public dependencies, exposed through library API.
error-chain = { version = "0.12", default-features = false }
openssh-keys = "0.3"
users = "0.7"
users = "0.8"

[[bin]]
name = "update-ssh-keys"
Expand Down
9 changes: 5 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,14 @@ fn run() -> Result<()> {
}

fn config() -> Result<Config> {
// get the default user by figuring out the current user if the current user
// is root (or doesn't exist) then use core
// get the default user by figuring out the current user; if the current user
// is root (or doesn't exist) then use 'core'.
let default_user = get_current_username().map_or("core".into(), |u| {
if u == "root" {
let name = u.to_string_lossy();
if name == "root" {
"core".into()
} else {
u
name.into_owned()
}
});

Expand Down

0 comments on commit f38f3d5

Please sign in to comment.