Task Environment Variables¶
Restraint exports the following environment variables for task use. They can be altered using the environment variable of the metadata file or testinfo.desc file (see Tasks).
| Restraint Variables | Description | Source |
|---|---|---|
| HOME | home directory defaults to /root. Can be overwritten using recipe or task params. | Static |
| HOSTNAME | Set by task plugin before execution of user task | Task Plugin |
| LANG | Environment variable to specify locale. The default is en_US.UTF-8. It can be overwritten using recipe or task params. | Static |
| PATH | Program search path environment variable. The default default is “/usr/local/bin:/usr/bin:/bin: /usr/local/sbin:/usr/sbin:/sbin”. It can be overwritten using recipe or task params. | Static |
| RSTRNT_JOBID | Populated from the job_id attribute of the recipe node. | Job |
| RSTRNT_MAXTIME | Max time in seconds for this task to complete. Input to local and external watchdog timers. | Job |
| RSTRNT_OSARCH | OS Architectures. Ex: x86_64, s390x, i386, aarch64, ppc64, ppc64le, armhfp | Job/Task Plugin |
| RSTRNT_OSDISTRO | Name of the distro (Provided if running in Beaker). | Job |
| RSTRNT_OSMAJOR | OS Major Version of Distro. Ex: Fedora31, CentOS7, RedHatEnterpriseLinux8 | Job/Task Plugin |
| RSTRNT_OSVARIANT | Not all distros use variants. Ex: Server, Client | Job |
| RSTRNT_OWNER | Populated from the owner attribute of the job node. | Job |
| RSTRNT_REBOOTCOUNT | The number of times the system has rebooted for this task. If no reboot occurred, the values is 0. | Restraint |
| RSTRNT_RECIPEID | Populated from the id attribute of the recipe node. | Job |
| RSTRNT_RECIPESETID | Populated from the recipe_set_id attribute of the recipe node. | Job |
| RSTRNT_TASKID | Populated from the id attribute of the task node. | Job |
| RSTRNT_TASKNAME | Name of task from the job. Ex: “/distribution/command”. | metadata |
| RSTRNT_TASKORDER | Sequence Order of tasks multiplied by 2. Used by Restraint when it performs multihosting. | Restraint |
| RSTRNT_TASKPATH | Where the task is installed. | rpm path/ Restraint |
| TERM | Terminal type defaults to vt100. Can be overwritten using recipe or task params. | Static |
| TESTID | Contains the ID assigned to this task. | Job |
For legacy RHTS variables, refer to Legacy RHTS Task Environment Variables.
Script/Plugin Environment Variables¶
This table lists environment variables which affect outcome of restraint scripts and plugins. These variables are often set by the user. They are as follows:
| Restraint Variables | Description | Source |
|---|---|---|
| AVC_ERROR | Refer to Legacy Reporting Mode for replacement. | User |
| FAILURESTRINGS FALSESTRINGS | Used by report_result plugin to report user’s task. Details can be found Report Result | User |
| CLIENTS, SERVERS, DRIVERS | Assist in the execution of the scripts rstrnt-sync-block/set. rstrnt-sync-block | User |
| NEXTBOOT_VALID_TIME | Assist in the execution of the script rstrnt-prepare-reboot. rstrnt-prepare-reboot | Default/ User |
| OUTPUTFILE | Used by localwatchdog plugin to report user’s task output if set. | User |
| TESTPATH/logs2get | File used by localwatchdog plugin to log user’s files listed in logs2get. | User |
| RSTRNT_BACKUP_DIR | To specify directory when using using Restraint’s backup/restore scripts. rstrnt-backup | User |
| RSTRNT_DISABLED | User populated to disable a plugin from running. Do RSTRNT_DISABLED=”99_reboot” to prevent 99_reboot from running after local watchdog expires. Do RSTRNT_DISABLED=”01_dmesg_check 10_avc_check” to prevent multiple error checking plugins from running (though disabling these is not advised). | User |
| RSTRNT_DISABLE_LINGER | Used by task_run plugin to disable user lingering. Refer to OS command loginctl enable/disable linger for details. This was introduced due to behavior changes from Fedora24+. Default is to enable. | User |
| RSTRNT_LOGGING | Enables debugging for plugins. Default: 3 (1=Debug, 2=Info, 3=Warning, 4=Error, 5=Critical) | User |
| RSTRNT_NOPLUGINS | Set by restraint to disable some plugin functionality when “task_run” plugins execute. Further details on this variable can be found Plugins. | Restraint |
| RSTRNT_PKG_CMD RSTRNT_PKG_ARGS RSTRNT_PKG_INSTALL RSTRNT_PKG_REMOVE RSTRNT_PKG_RETRIES RSTRNT_PKG_DELAY | These variables are used to control the behavior of the command rstrnt-package. For more details, refer to rstrnt-package command. | Default/ User |
| RSTRNT_PLUGINS_DIR | Specifies the directory to run localwatchdog or report_result plugins. | Restraint |