refactor: generalize Distro add_user and shutdown_command#6800
Open
blackboxsw wants to merge 1 commit intocanonical:mainfrom
Open
refactor: generalize Distro add_user and shutdown_command#6800blackboxsw wants to merge 1 commit intocanonical:mainfrom
blackboxsw wants to merge 1 commit intocanonical:mainfrom
Conversation
Perform preliminary refactor to be used by securirity event logging. Split add_user method into separate methods: - _add_user_preprocess_kwargs: filter distro-specific args before cmd - _build_add_user_cmd: return tuple of cmd and log_command for the useradd - _post_add_user: distro-specific post-creation steps for Alpine - _user_groups_to_list: normalize group input to a list Move util.is_user check into create_user and make add_user raise on failure instead of returning bool. Subclasse now only override the separate methods instead of duplicating add_user. Refactor shutdown_command introducing a new _build_shutdown_command which is overridden in subclasses.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decomposed #6689 into part-1 and part-2 to aid reviewing.
Proposed Commit Message
Additional Context
Test Steps
tox -e py3
Merge type