Skip to content

Commit bb74558

Browse files
authored
[rqd] Add new config option RQD_USE_PATH_ENV_VAR. (#1241)
1 parent 8a33d83 commit bb74558

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

rqd/rqd/__main__.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
2929
Optional configuration file:
3030
----------------------------
31-
in /etc/rqd3/rqd3.conf:
31+
In /etc/opencue/rqd.conf (on Linux) or %LOCALAPPDATA%/OpenCue/rqd.conf (on Windows):
3232
[Override]
3333
OVERRIDE_CORES = 2
3434
OVERRIDE_PROCS = 3
@@ -89,14 +89,17 @@ def setupLogging():
8989

9090
def usage():
9191
"""Prints command line syntax"""
92-
s = sys.stderr
93-
print("SYNOPSIS", file=s)
94-
print(" ", sys.argv[0], "[options]\n", file=s)
95-
print(" -d | --daemon => Run as daemon", file=s)
96-
print(" --nimbyoff => Disables nimby activation", file=s)
97-
print(" -c => Provide an alternate config file", file=s)
98-
print(" Defaults to /etc/rqd3/rqd3.conf", file=s)
99-
print(" Config file is optional", file=s)
92+
usage_msg = f"""SYNOPSIS
93+
{sys.argv[0]} [options]
94+
95+
-d | --daemon => Run as daemon
96+
--nimbyoff => Disables nimby activation
97+
-c => Provide an alternate config file
98+
On Linux: defaults to /etc/opencue/rqd.conf
99+
On Windows: Defaults to %LOCALAPPDATA%/OpenCue/rqd.conf
100+
Config file is optional
101+
"""
102+
print(usage_msg, file=sys.stderr)
100103

101104

102105
def main():

rqd/rqd/rqconstants.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
RQD_RETRY_CRITICAL_REPORT_DELAY = 30
6767
RQD_USE_IP_AS_HOSTNAME = True
6868
RQD_USE_IPV6_AS_HOSTNAME = False
69+
70+
# Use the PATH environment variable from the RQD host.
71+
RQD_USE_PATH_ENV_VAR = False
72+
6973
RQD_BECOME_JOB_USER = True
7074
RQD_CREATE_USER_IF_NOT_EXISTS = True
7175
RQD_TAGS = ''
@@ -111,7 +115,7 @@
111115
SYS_HERTZ = os.sysconf('SC_CLK_TCK')
112116

113117
if platform.system() == 'Windows':
114-
CONFIG_FILE = os.path.expandvars('$LOCALAPPDATA/OpenCue/rqd.conf')
118+
CONFIG_FILE = os.path.expandvars('%LOCALAPPDATA%/OpenCue/rqd.conf')
115119
else:
116120
CONFIG_FILE = '/etc/opencue/rqd.conf'
117121

@@ -177,6 +181,8 @@
177181
RQD_USE_IP_AS_HOSTNAME = config.getboolean(__section, "RQD_USE_IP_AS_HOSTNAME")
178182
if config.has_option(__section, "RQD_USE_IPV6_AS_HOSTNAME"):
179183
RQD_USE_IPV6_AS_HOSTNAME = config.getboolean(__section, "RQD_USE_IPV6_AS_HOSTNAME")
184+
if config.has_option(__section, "RQD_USE_PATH_ENV_VAR"):
185+
RQD_USE_PATH_ENV_VAR = config.getboolean(__section, "RQD_USE_PATH_ENV_VAR")
180186
if config.has_option(__section, "RQD_BECOME_JOB_USER"):
181187
RQD_BECOME_JOB_USER = config.getboolean(__section, "RQD_BECOME_JOB_USER")
182188
if config.has_option(__section, "RQD_TAGS"):

rqd/rqd/rqmachine.py

+2
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ def getHostname(self):
507507
@rqd.rqutil.Memoize
508508
def getPathEnv(self):
509509
"""Returns the correct path environment for the given machine"""
510+
if rqd.rqconstants.RQD_USE_PATH_ENV_VAR:
511+
return os.getenv('PATH')
510512
if platform.system() == 'Linux':
511513
return '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
512514
if platform.system() == 'Windows':

0 commit comments

Comments
 (0)