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 unexpected keyword argument 'crypt_id' on FreeBSD 14.1 #1955

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions Utils/distroutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def get_my_distro(config, os_name=None):
if 'FreeBSD' in platform.system():
return FreeBSDDistro(config)

if os_name is None:
if os.path.isfile(constants.os_release):
os_name = ext_utils.get_line_starting_with("NAME", constants.os_release)
Expand Down Expand Up @@ -280,8 +280,8 @@ def __init__(self, config):


# noinspection PyMethodOverriding
def chpasswd(self, user, password):
return ext_utils.run_send_stdin(['pw', 'usermod', 'user', '-h', '0'], password, log_cmd=False)
def chpasswd(self, user, password, **kwargs):
return ext_utils.run_send_stdin(['pw', 'usermod', 'user', '-h', '0'], password.encode('utf-8'), log_cmd=False)

def create_account(self, user, password, expiration, thumbprint, enable_nopasswd):
"""
Expand All @@ -296,8 +296,8 @@ def create_account(self, user, password, expiration, thumbprint, enable_nopasswd
pass
uidmin = None
try:
if os.path.isfile("/etc/login.defs"):
uidmin = int(ext_utils.get_line_starting_with("UID_MIN", "/etc/login.defs").split()[1])
if os.path.isfile("/etc/pw.conf"):
uidmin = int(ext_utils.get_line_starting_with("minuid", "/etc/pw.conf").split('=')[1].strip(' "'))
except (ValueError, KeyError, AttributeError, EnvironmentError):
pass
pass
Expand Down Expand Up @@ -374,9 +374,8 @@ def delete_account(self, user):
return
uidmin = None
try:
if os.path.isfile("/etc/login.defs"):
uidmin = int(
ext_utils.get_line_starting_with("UID_MIN", "/etc/login.defs").split()[1])
if os.path.isfile("/etc/pw.conf"):
uidmin = int(ext_utils.get_line_starting_with("minuid", "/etc/pw.conf").split('=')[1].strip(' "'))
except (ValueError, KeyError, AttributeError, EnvironmentError):
pass
if uidmin is None:
Expand Down Expand Up @@ -554,4 +553,4 @@ def restart_ssh_service(self):
retcode = ext_utils.run(ssh_restart_cmd)
if retcode > 0:
logger.error("Failed to restart SSH service with return code:" + str(retcode))
return retcode
return retcode