FAI Environment Variables

This module provides access to the most important FAI environment variables. If not running from FAI, most variables here are None.

Hint

Many functions in the fai package depend on correct environment settings defined here. If you want to run your scripts without a full FAI process, make sure to define them properly.

fai.env.ACTION: Union[fai.env.Action, str]

FAI action ($FAI_ACTION)

Well-known actions are mapped to elements of Action. If running a custom action, this is simply a str.

class fai.env.Action(value)

Enum of well-known FAI actions

dirinstall
install
inventory
softupdate
sysinfo
fai.env.CONFIG_SPACE: pathlib.Path

FAI config space ($FAI)

fai.env.LOGDIR: pathlib.Path

FAI log directory ($LOGDIR)

fai.env.ROOTCMD: Sequence[str]

Chroot command ($ROOTCMD)

The value from the environment is splitted with shlex.split and can thus be directly fed to subprocess.run.

fai.env.classes: Sequence[str]

FAI classes ($classes)

fai.env.is_online()

Check if system installed/updated by FAI is online

Some tasks such as starting a service are only possible when FAI is run within the target system (i.e. FAI is doing a softupdate).

Return type

bool

fai.env.target: pathlib.Path

FAI Installation target ($target)