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: checkbox crash for non-existent usernames and refactor user handling #451

Merged
merged 2 commits into from
May 15, 2023

Conversation

kissiel
Copy link
Contributor

@kissiel kissiel commented May 12, 2023

Description

This patch fixes a problem where checkbox would crash when controller provided a username that doesn't exists on the controlled system. It also moves the user handling heuristics into a new module and simplifies the existing logic.

See bug on JIRA and unit tests from this patch for details.

Resolved issues

Fixes: CHECKBOX-597

Documentation

The functionality doesn't change so no docs.

Tests

In this patch I provide unit tests for the heuristics.
Moreover the following PR will have a metabox test that will test this as well.

Testing

I tested the branch using a remote/service combo with launchers specifying random combination of existing and non-existent users.
And of course tox + metabox.

This patch also checks if the provided user is available on the system.

See bug on JIRA and unit tests from this patch for details.

Fixes: CHECKBOX-597
Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

What a beautiful change! We have so little unit tests in checkbox_ng proper...!

Thanks for that!

Copy link
Contributor

@yphus yphus left a comment

Choose a reason for hiding this comment

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

A corner case not covered I think with the new guess_normal_user() version, a user foo w/ uid 1002.

Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@yphus yphus left a comment

Choose a reason for hiding this comment

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

+1 thanks for covering the logic with unit tests. It really helps (as always)

@yphus yphus merged commit 92dc56e into main May 15, 2023
@yphus yphus deleted the better-user-heuristics branch May 15, 2023 06:46
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