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

distro(freebsd): add_user: respect homedir #5061

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

igalic
Copy link
Collaborator

@igalic igalic commented Mar 14, 2024

Proposed Commit Message

distro(freebsd): add_user: respect homedir

reportedly, passing `homedir` to a user struct doesn't actually change
the homedir to the desired value. This is because we hard-code the path.
Respect the value we are passed, and only make up a default when we
don't get a `homedir`.

Simplify style to remove cerimonious verbosity around strings, and amend
tests to verify what we did.


Sponsored by: The FreeBSD Foundation

Additional Context

Test Steps

Checklist

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

@igalic igalic force-pushed the fbsd/adduser-home branch 2 times, most recently from 70de3fd to 2d88c4a Compare March 14, 2024 23:30
@holmanb holmanb self-assigned this Mar 14, 2024
@igalic igalic force-pushed the fbsd/adduser-home branch 2 times, most recently from 85589e2 to 042cdfe Compare March 15, 2024 11:01
)
if "homedir" in kwargs:
homedir = kwargs["homedir"]
pw_useradd_cmd.append("-d{homedir}".format(homedir=homedir))
Copy link
Member

@holmanb holmanb Mar 15, 2024

Choose a reason for hiding this comment

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

Nit: This is a little verbose, I think the lines above could be simplified to the following:

homedir = kwargs.get("homedir", f"{self.home_dir}/{name}")
pw_useradd_cmd.append("-d" + homedir)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

reportedly, passing `homedir` to a user struct doesn't actually change
the homedir to the desired value. This is because we hard-code the path.
Respect the value we are passed, and only make up a default when we
don't get a `homedir`.

Simplify style to remove cerimonious verbosity around strings, and amend
tests to verify what we did.

Sponsored by: The FreeBSD Foundation
@igalic igalic force-pushed the fbsd/adduser-home branch from 042cdfe to 7c46bf0 Compare March 16, 2024 10:11
Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

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

Thanks @igalic!

@holmanb holmanb merged commit 82a5fb3 into canonical:main Mar 16, 2024
29 checks passed
@igalic igalic deleted the fbsd/adduser-home branch March 18, 2024 09:14
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