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

Only take care of ssh-keys if ensure is set to 'present' #174

Merged
merged 1 commit into from
Sep 14, 2018

Conversation

opteamax
Copy link
Contributor

Trying to remove a user by simply setting "ensure = absent" leads to the following errors:

Error: Cannot create /home/USERNAME/.ssh; parent directory /home/USERNAME does not exist
Error: /Stage[main]/Fcsbase::Install/Accounts::User[USERNAME]/Accounts::Key_management[USERNAME_key_management]/File[/home/USERNAME/.ssh]/ensure: change from absent to directory failed: Cannot create /home/USERNAME/.ssh; parent directory /home/USERNAME does not exist
Notice: /Stage[main]/Fcsbase::Install/Accounts::User[USERNAME]/Accounts::Key_management[USERNAME_key_management]/File[/home/USERNAME/.ssh/authorized_keys]: Dependency File[/home/USERNAME/.ssh] has failures: true
Warning: /Stage[main]/Fcsbase::Install/Accounts::User[USERNAME]/Accounts::Key_management[USERNAME_key_management]/File[/home/USERNAME/.ssh/authorized_keys]: Skipping because of failed dependencies

I added checking ensure == present before instantiation of accounts::key_management to be able to cleanly remove users without warnings and errors.

@Q1tum
Copy link

Q1tum commented Sep 13, 2018

I run into the same problem on FreeBSD, the suggested changes resolve this issue for me.

@pmcmaw pmcmaw added the bugfix label Sep 14, 2018
@pmcmaw
Copy link
Contributor

pmcmaw commented Sep 14, 2018

I have ran this through our internet adhoc pipeline and everything has passed.
The change also looks sane therefore I am going to merge.

Thank you @opteamax for taking the time to submit this PR 👍
We really appreciate it! :-)

@pmcmaw pmcmaw merged commit 4f3b372 into puppetlabs:master Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants