Other helper modules
Module: logging
This module is used to deal with all logs. It not only prints them but also writes them to /var/log/syslog
Members
-
class linuxmusterLinuxclient7.logging.Level(value)[source]
An enumeration.
-
linuxmusterLinuxclient7.logging.debug(message)[source]
Do a debug log.
- Parameters
message (str) – The message to log
-
linuxmusterLinuxclient7.logging.error(message)[source]
Do an error log.
- Parameters
message (str) – The message to log
-
linuxmusterLinuxclient7.logging.exception(exception)[source]
Log an exception
- Parameters
exception (Exception) – The exception to log
-
linuxmusterLinuxclient7.logging.fatal(message)[source]
Do a fatal log. If used in onLogin hook, this will create a dialog containing the message.
- Parameters
message (str) – The message to log
-
linuxmusterLinuxclient7.logging.info(message)[source]
Do an info log.
- Parameters
message (str) – The message to log
-
linuxmusterLinuxclient7.logging.printLogs(compact=False, anonymize=False)[source]
Print logs of linuxmuster-linuxclient7 from /var/log/syslog.
- Parameters
compact (bool, optional) – If set to True, some stuff like time and date will be removed. Defaults to False
anonymize (bool, optional) – If set to True, domain/realm/serverHostname will be replaced by linuxmuster.lan. Defaults to False
-
linuxmusterLinuxclient7.logging.warning(message)[source]
Do a warning log.
- Parameters
message (str) – The message to log
Module: localUserHelper
This module is used to deal with local users.
Members
-
linuxmusterLinuxclient7.localUserHelper.getGroupsOfLocalUser(username)[source]
Get all groups of a local user
- Parameters
username (str) – The username of the user
- Returns
Tuple (success, list of groups)
- Return type
tuple
Module: setup
This module is used to setup, clean and upgrade the client.
Module: imageHelper
This module is used to prepare a client for imaging.
Members
-
linuxmusterLinuxclient7.imageHelper.prepareForImage(unattended=False)[source]
Prepare the computer for creating an image
- Parameters
unattended (bool, optional) – If set to True, all questions will be answered with yes, defaults to False
- Returns
True on success, False otherwise
- Return type
bool
Module: hooks
This module is used to deal with local hookdirs in /etc/linuxmuster-linuxclient7 and the sysvol.
Members
-
class linuxmusterLinuxclient7.hooks.Type(value)[source]
Enum containing all hook types
-
Boot = 0
The onBoot hook
-
Login = 3
The onLogin hook
-
LoginAsRoot = 2
The onLoginAsRoot hook
-
SessionStarted = 4
The onSession started hook
-
Shutdown = 1
The on Shutdown hook
-
linuxmusterLinuxclient7.hooks.getLocalHookScript(hookType)[source]
Get the path of a local hookscript
- Parameters
hookType (hooks.Type) – The type of hook script to get the path for
- Returns
The path
- Return type
str
-
linuxmusterLinuxclient7.hooks.runHook(hookType)[source]
Executes hooks.runLocalHook() and hooks.runRemoteHook()
- Parameters
hookType (hooks.Type) – The type of hook to run
-
linuxmusterLinuxclient7.hooks.runLocalHook(hookType)[source]
Run all scripts in a local hookdir
- Parameters
hookType (hooks.Type) – The type of hook to run
-
linuxmusterLinuxclient7.hooks.runRemoteHook(hookType)[source]
Run hookscript from sysvol
- Parameters
hookType (hooks.Type) – The type of hook to run
-
linuxmusterLinuxclient7.hooks.shouldHooksBeExecuted(overrideUsername=None)[source]
Check if hooks should be executed
- Parameters
overrideUsername (str, optional) – Override the username to check, defaults to None
- Returns
True if hooks should be executed, fale otherwise
- Return type
bool
Module: gpo
This module is used to deal with Microsoft GPOs.
Members
-
linuxmusterLinuxclient7.gpo.processAllPolicies()[source]
Process all applicable policies (equivalent to gpupdate on windows)
- Returns
True on success, False otherwise
- Return type
bool
Module: fileHelper
This module is used to deal files.
Members
-
linuxmusterLinuxclient7.fileHelper.deleteAllInDirectory(directory)[source]
Delete all files in a given directory
- Parameters
directory (str) – The path of the directory
- Returns
True on success, False otherwise
- Return type
bool
-
linuxmusterLinuxclient7.fileHelper.deleteDirectory(directory)[source]
Recoursively delete a directory.
- Parameters
directory (bool) – The path of the directory
- Returns
True on success, False otherwise
- Return type
bool
-
linuxmusterLinuxclient7.fileHelper.deleteFile(filePath)[source]
Delete a file
- Parameters
filePath (str) – The path of the file
- Returns
True on success, False otherwise
- Return type
bool
-
linuxmusterLinuxclient7.fileHelper.deleteFilesWithExtension(directory, extension)[source]
Delete all files with a given extension in a given directory.
- Parameters
-
- Returns
True on success, False otherwise
- Return type
bool
-
linuxmusterLinuxclient7.fileHelper.removeLinesInFileContainingString(filePath, forbiddenStrings)[source]
Remove all lines containing a given string form a file.
- Parameters
-
- Returns
True on success, False otherwise
- Return type
bool
Module: environment
This module is used to export and unset environment variables during the onLogin/logon hook.
Members
-
linuxmusterLinuxclient7.environment.export(keyValuePair)[source]
Export an environment variable
- Parameters
keyValuePair – Key value pair in format key=value
- Returns
True or False
- Return type
bool
-
linuxmusterLinuxclient7.environment.unset(key)[source]
Unset a previously exported environment variable
- Parameters
key (str) – The key to unset
- Returns
True or False
- Return type
bool
Module: keytab
This module is used to manage the keytab (/etc/krb5.keytab) file.
Members
-
linuxmusterLinuxclient7.keytab.patchKeytab()[source]
Patches the /etc/krb5.keytab file. It inserts the correct hostname of the current computer.
- Returns
True on success, False otherwise
- Return type
bool
Module: templates
This module is used to manage templates for config files.
Members
-
linuxmusterLinuxclient7.templates.applyAll()[source]
Applies all templates from /usr/share/linuxmuster-linuxclient7/templates
- Returns
True on success, False otherwise
- Return type
bool