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

[rqd] Allow customizing HOME and MAIL environments #1579

Merged
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions rqd/rqd/rqconstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
# Copy specific environment variable from the RQD host to the frame env.
RQD_HOST_ENV_VARS = []

RQD_CUSTOM_HOME_PREFIX = None
RQD_CUSTOM_MAIL_PREFIX = None

RQD_BECOME_JOB_USER = True
RQD_CREATE_USER_IF_NOT_EXISTS = True
SENTRY_DSN_PATH = None
Expand Down Expand Up @@ -226,6 +229,10 @@
SENTRY_DSN_PATH = config.getint(__override_section, "SENTRY_DSN_PATH")
if config.has_option(__override_section, "SP_OS"):
SP_OS = config.get(__override_section, "SP_OS")
if config.has_option(__override_section, "RQD_CUSTOM_HOME_PREFIX"):
RQD_CUSTOM_HOME_PREFIX = config.get(__override_section, "RQD_CUSTOM_HOME_PREFIX")
if config.has_option(__override_section, "RQD_CUSTOM_MAIL_PREFIX"):
RQD_CUSTOM_MAIL_PREFIX = config.get(__override_section, "RQD_CUSTOM_MAIL_PREFIX")

if config.has_section(__host_env_var_section):
RQD_HOST_ENV_VARS = config.options(__host_env_var_section)
Expand Down
10 changes: 10 additions & 0 deletions rqd/rqd/rqcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ def __createEnvVariables(self):
self.frameEnv["CUE_GPU_MEMORY"] = str(self.rqCore.machine.getGpuMemoryFree())
self.frameEnv["SP_NOMYCSHRC"] = "1"

if rqd.rqconstants.RQD_CUSTOM_HOME_PREFIX:
self.frameEnv["HOME"] = "%s/%s" % (
rqd.rqconstants.RQD_CUSTOM_HOME_PREFIX,
self.runFrame.user_name)

if rqd.rqconstants.RQD_CUSTOM_MAIL_PREFIX:
self.frameEnv["MAIL"] = "%s/%s" % (
rqd.rqconstants.RQD_CUSTOM_MAIL_PREFIX,
self.runFrame.user_name)

if platform.system() == "Windows":
for variable in ["SYSTEMROOT", "APPDATA", "TMP", "COMMONPROGRAMFILES", "SYSTEMDRIVE"]:
if variable in os.environ:
Expand Down
Loading