Skip to content

Commit

Permalink
Move UDEVADM and SHUTDOWN definitions to runtime constants rockstor#2564
Browse files Browse the repository at this point in the history
  • Loading branch information
FroggyFlox authored and phillxnet committed Jun 6, 2023
1 parent 316654c commit 22f49c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
9 changes: 0 additions & 9 deletions src/rockstor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,6 @@

OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'

# Setup OS specific command paths via 'which cmd' calls
# N.B. this method will not work with an alias, ie in CentOS
# which ls
# alias ls='ls --color=auto'
# /usr/bin/ls
# The following have been tested in CentOS, openSUSE Leap15, and Tumbleweed
UDEVADM = subprocess.check_output(["which", "udevadm"]).rstrip()
SHUTDOWN = subprocess.check_output(["which", "shutdown"]).rstrip()

# Establish our OS base id, name, and version:
# Use id for code path decisions. Others are for Web-UI display purposes.
# Examples given are for CentOS Rockstor variant, Leap 15, and Tumblweed.
Expand Down
4 changes: 4 additions & 0 deletions src/rockstor/system/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@
USERMOD = "/usr/sbin/usermod"

SYSTEMCTL = "/usr/bin/systemctl"

# Works in Leap 15.4 (systemd-249.16-150400.8.28.3) and Tumbleweed (systemd-253.4-2.1)
UDEVADM = "/usr/bin/udevadm"
SHUTDOWN = "/sbin/shutdown"
4 changes: 1 addition & 3 deletions src/rockstor/system/osi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from django.conf import settings

from system.exceptions import CommandException, NonBTRFSRootException
from system.constants import SYSTEMCTL, MKDIR, RMDIR, MOUNT, UMOUNT, DEFAULT_MNT_DIR
from system.constants import SYSTEMCTL, MKDIR, RMDIR, MOUNT, UMOUNT, DEFAULT_MNT_DIR, UDEVADM, SHUTDOWN

logger = logging.getLogger(__name__)

Expand All @@ -52,10 +52,8 @@
LS = "/usr/bin/ls"
LSBLK = "/usr/bin/lsblk"
NMCLI = "/usr/bin/nmcli"
SHUTDOWN = settings.SHUTDOWN
SYSTEMD_ESCAPE = "/usr/bin/systemd-escape"
SYSTEMD_DIR = "/usr/lib/systemd/system"
UDEVADM = settings.UDEVADM
WIPEFS = "/usr/sbin/wipefs"
RTC_WAKE_FILE = "/sys/class/rtc/rtc0/wakealarm"
PING = "/usr/bin/ping"
Expand Down

0 comments on commit 22f49c2

Please sign in to comment.