-
Notifications
You must be signed in to change notification settings - Fork 908
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
Conversation
70de3fd
to
2d88c4a
Compare
85589e2
to
042cdfe
Compare
cloudinit/distros/freebsd.py
Outdated
) | ||
if "homedir" in kwargs: | ||
homedir = kwargs["homedir"] | ||
pw_useradd_cmd.append("-d{homedir}".format(homedir=homedir)) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
042cdfe
to
7c46bf0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @igalic!
add homedir patch: canonical/cloud-init#5061 Also work around python.mk autoplist bug described in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205056. Changelogs: - https://github.com/canonical/cloud-init/releases/tag/24.1 - https://github.com/canonical/cloud-init/releases/tag/24.1.1 - https://github.com/canonical/cloud-init/releases/tag/24.1.2 - https://github.com/canonical/cloud-init/releases/tag/24.1.3 - https://github.com/canonical/cloud-init/releases/tag/24.1.4 PR: 277708 Approved by: andrey@bsdnir.info (maintainer, timeout) Sponsored by: The FreeBSD Foundation
Proposed Commit Message
Additional Context
Test Steps
Checklist
Merge type