Skip to content

Commit

Permalink
minor tidy-ups & unused import rockstor#2564
Browse files Browse the repository at this point in the history
Includes prior TODO re ascii to utf-8 on SMART
custom options.
  • Loading branch information
phillxnet committed Jun 6, 2023
1 parent 7f8d633 commit 6edcdb1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/rockstor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Django settings for Rockstor project.
import os
import subprocess, distro
import distro
from huey import SqliteHuey

DEBUG = False
Expand Down
6 changes: 2 additions & 4 deletions src/rockstor/system/smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def extended_info(device, custom_options="", test_mode=TESTMODE):
Attribute name.
:param device: disk device name
:param testmode: Not True causes cat from file rather than smartctl command
:param test_mode: Not True causes cat from file rather than smartctl command
:return: dictionary of smart attributes extracted from device or test file
"""
Expand Down Expand Up @@ -440,9 +440,7 @@ def get_dev_options(dev_byid, custom_options=""):
dev_options = [get_device_path(get_base_device_byid(dev_byid, TESTMODE))]
else:
# Convert string of custom options into a list ready for run_command
# TODO: think this ascii should be utf-8 as that's kernel standard
# TODO: or just use str(custom_options).split()
dev_options = custom_options.encode("ascii").split()
dev_options = custom_options.encode("utf-8").split()
# Remove Rockstor native 'autodev' custom smart option raid dev target.
# As we automatically add the full path by-id if a raid controller
# target dev is not found, we can simply remove this option.
Expand Down
6 changes: 2 additions & 4 deletions src/rockstor/system/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ def get_users(max_wait=60):
timeout=max_wait,
)
out = result.stdout
err = result.stderr
rc = result.returncode
# TODO: Report & handle exception reported via CompletedProcess (result)
out_list = out.split("\n")
# out_list looks like;
Expand Down Expand Up @@ -204,7 +202,7 @@ def smbpasswd(username, passwd):
rc = p.returncode
if rc != 0:
raise CommandException(cmd, out, err, rc)
return (out, err, rc)
return out, err, rc


def update_shell(username, shell):
Expand Down Expand Up @@ -235,7 +233,7 @@ def useradd(username, shell, uid=None, gid=None):
"User({0}) already exists, but her shell({1}) is "
"different from the input({2}).".format(username, pw_entry.shell, shell)
)
return ([""], [""], 0)
return [""], [""], 0

cmd = [USERADD, "-s", shell, "-m", username]
if uid is not None:
Expand Down

0 comments on commit 6edcdb1

Please sign in to comment.