Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ability to Remove Etcd & RKE2 User #69

Merged
merged 2 commits into from
Jul 8, 2020

Conversation

briandowns
Copy link
Member

Adds the ability for the rke2 uninstall script to remove the rke2 and etcd user, if they exist, as well as groups.

This can be verified by running the following commands:

grep etcd /etc/passwd
grep rke2 /etc/passwd
grep etcd /etc/group
grep rke2 /etc/group

Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>

for u in etcd rke2; do
if id -u \${u} 2>/dev/null; then
userdel \${u}
Copy link
Contributor

Choose a reason for hiding this comment

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

If these fail for any reason they uninstall will return non-zero. Is that on purpose?
I would submit that uninstalls should rarely, if ever, exit non-zero.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want to account for that sort of edge case? The failure scnearios would be be not being able to update the passwd or group file (we're running as root) , can't remove home dir (home dir is already remvoed by this point), and user doesn't exist which we check for before attempting the removal.

Copy link
Contributor

@galal-hussein galal-hussein left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@briandowns briandowns merged commit 5487e7d into rancher:master Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants