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

fix: Write new authorized_keys if needed is not idempotent #162

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

richm
Copy link
Contributor

@richm richm commented Aug 16, 2023

Cause: The new key content had an extra newline at the end.

Consequence: The test to see if the new key content was in the
current authorized_key list failed, so the key was added every
time, and the task was not idempotent.

Fix: Ensure the new key value has no extra newline. Use a simple
list in test to see if the new value is in the existing list.

Result: The task to write authorized_keys is idempotent.

Signed-off-by: Rich Megginson [email protected]

@richm
Copy link
Contributor Author

richm commented Aug 16, 2023

[citest]

@richm richm force-pushed the authorized_keys-not-idempotent branch from 7506037 to 345ef6e Compare August 16, 2023 13:19
@richm
Copy link
Contributor Author

richm commented Aug 16, 2023

[citest]

Cause: The new key content had an extra newline at the end.

Consequence: The test to see if the new key content was in the
current authorized_key list failed, so the key was added every
time, and the task was not idempotent.

Fix: Ensure the new key value has no extra newline. Use a simple
list `in` test to see if the new value is in the existing list.

Result: The task to write authorized_keys is idempotent.

Signed-off-by: Rich Megginson <[email protected]>
@richm richm force-pushed the authorized_keys-not-idempotent branch from 345ef6e to 6e03ff3 Compare August 16, 2023 14:19
@richm
Copy link
Contributor Author

richm commented Aug 16, 2023

[citest]

@richm richm merged commit e488ab7 into linux-system-roles:main Aug 16, 2023
@richm richm deleted the authorized_keys-not-idempotent branch August 16, 2023 15:56
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.

2 participants