-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add profile's rules checks based on execution environment
- Loading branch information
Showing
2 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#! python3 # noqa: E265 | ||
|
||
""" | ||
Base of QDT jobs. | ||
Author: Julien Moura (https://github.com/guts) | ||
""" | ||
|
||
|
||
# ############################################################################# | ||
# ########## Libraries ############# | ||
# ################################## | ||
|
||
# Standard library | ||
import logging | ||
import platform | ||
from sys import platform as opersys | ||
|
||
# ############################################################################# | ||
# ########## Globals ############### | ||
# ################################## | ||
|
||
# logs | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
# ############################################################################# | ||
# ########## Functions ############# | ||
# ################################## | ||
|
||
|
||
def environment_dict() -> dict: | ||
"""Returns a dictionary containing some environment information (computer, network, | ||
platform) that can be used in QDT various places: rules... | ||
Returns: | ||
dict: _description_ | ||
""" | ||
return { | ||
"computer_network_name": platform.node(), | ||
"operating_system_code": opersys, | ||
"processor_architecture": platform.machine(), | ||
# custom Linux | ||
"linux_distribution_name": f"{platform.freedesktop_os_release().get('NAME')}", | ||
"linux_distribution_version": f"{platform.freedesktop_os_release().get('VERSION_ID')}", | ||
# custom Windows | ||
"windows_edition": platform.win32_edition(), | ||
} |