opsicommon.system package¶
Subpackages¶
Submodules¶
opsicommon.system.info module¶
system.info
- opsicommon.system.info.is_deb_based()¶
- Return type:
bool
- opsicommon.system.info.is_linux()¶
- Return type:
bool
- opsicommon.system.info.is_macos()¶
- Return type:
bool
- opsicommon.system.info.is_pacman_based()¶
- Return type:
bool
- opsicommon.system.info.is_posix()¶
- Return type:
bool
- opsicommon.system.info.is_rpm_based()¶
- Return type:
bool
- opsicommon.system.info.is_ucs()¶
- Return type:
bool
- opsicommon.system.info.is_unix()¶
- Return type:
bool
- opsicommon.system.info.is_windows()¶
- Return type:
bool
- opsicommon.system.info.linux_distro_id()¶
- Return type:
str
- opsicommon.system.info.linux_distro_id_like()¶
- Return type:
set[str]
- opsicommon.system.info.linux_distro_id_like_contains(search)¶
Returns true if any string in ID_LIKE contains one of the search strings passed in search.
- Parameters:
search (
Union[str,Iterable[str]])- Return type:
bool
- opsicommon.system.info.linux_distro_version()¶
- Return type:
str
- opsicommon.system.info.linux_distro_version_id()¶
- Return type:
str
opsicommon.system.network module¶
system.network
- opsicommon.system.network.get_domain()¶
- Return type:
str
- opsicommon.system.network.get_fqdn()¶
- Return type:
str
- opsicommon.system.network.get_hostnames()¶
- Return type:
Set[str]
- opsicommon.system.network.get_ip_addresses()¶
- Return type:
Generator[Dict[str,Any],None,None]
opsicommon.system.subprocess module¶
system.subprocess
- class opsicommon.system.subprocess.Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, universal_newlines=None, startupinfo=None, creationflags=0, restore_signals=True, start_new_session=False, pass_fds=(), *, text=None, encoding=None, errors=None, user=None, group=None, extra_groups=None, umask=-1, pipesize=-1, process_group=None, session_id=None, session_env=None, session_elevated=None, session_desktop=None)¶
Bases:
Popen- Parameters:
args (
Union[str,bytes,PathLike[str],PathLike[bytes],Sequence[str|bytes|PathLike[str] |PathLike[bytes]]])bufsize (
int)executable (
str|bytes|PathLike[str] |PathLike[bytes] |None)stdin (
Union[int,IO[Any],None])stdout (
Union[int,IO[Any],None])stderr (
Union[int,IO[Any],None])preexec_fn (
Optional[Callable[[],Any]])close_fds (
bool)shell (
bool)cwd (
str|bytes|PathLike[str] |PathLike[bytes] |None)env (
Optional[Mapping[str,str]])universal_newlines (
bool|None)startupinfo (
Any|None)creationflags (
int)restore_signals (
bool)start_new_session (
bool)pass_fds (
Collection[int])text (
bool|None)encoding (
str|None)errors (
str|None)user (
str|int|None)group (
str|int|None)extra_groups (
Optional[Iterable[str|int]])umask (
int)pipesize (
int)process_group (
int|None)session_id (
str|int|None)session_env (
bool|None)session_elevated (
bool|None)session_desktop (
str|None)
- opsicommon.system.subprocess.patch_popen()¶
- Return type:
None
Module contents¶
system
- opsicommon.system.ensure_not_already_running(process_name=None)¶
- Parameters:
process_name (
Optional[str])- Return type:
None
- opsicommon.system.get_system_uuid()¶
- Return type:
str
- opsicommon.system.get_user_sessions(username=None, session_type=None)¶
- Parameters:
username (
Optional[str])session_type (
Optional[str])
- Return type:
Generator[Session,None,None]
- opsicommon.system.lock_file(file, exclusive=False, timeout=5.0)¶
An exclusive or write lock gives a process exclusive access for writing to the specified part of the file. While a write lock is in place, no other process can lock that part of the file. A shared or read lock prohibits any other process from requesting a write lock on the file.
- Parameters:
file (
TextIO|BinaryIO|IO)exclusive (
bool)timeout (
float)
- Return type:
Generator[None,None,None]
- opsicommon.system.run_process_in_session(command, session_id, shell=False, impersonate=False)¶
- Parameters:
command (
List[str])session_id (
str)shell (
bool)impersonate (
bool)
- Return type:
- opsicommon.system.set_system_datetime(utc_datetime)¶
- Parameters:
utc_datetime (
datetime)- Return type:
None