§
;Š»j~ ã ó — d Z ddlZddlZddlmZmZmZmZ ddlm Z ddl
mZ dZdee
eeeeeef f f fd„Zd edeeeef fd
„ZdS )zv
common helper functions, related to processing api using custom binary
currently available for Directadmin and Plesk
é N)ÚListÚTupleÚUnionÚOptional)Úexec_utility)ÚClPwdz#/usr/share/python-cllib/userdomainsÚreturnc ó¸ — t t g ¦ « \ } } t j |¦ « }| dk r| d„ |D ¦ « fS n# t j $ r Y nw xY w| |fS )aÃ
Calls USERDOMAINS(userdomains.c) bin and returns rc and loaded json output
This is equals to call `userdomains(pwd.getpwuid(os.getuid()).pw_name, as_root=True)`
Returns: return code of USERDOMAINS and json output
if rc == 0: `out` is out from `userdomains()`
NB: there is no tuples in JSON so da_out's type is List[List[str, str]] instead of List[Tuple[str, str]]
if rc != 0: `out` type is str
error codes:
1: diradmin/psaadmin user not found
2: not DA/Plesk panel
3: seteuid() syscall failed
4: executed as root
10: exception during `userdomains()` call
11: no such user in panel
r c ó† — g | ]>}t |¦ « d k ¯t d„ |D ¦ « ¦ « ¯.|d |d f‘Œ?S )é c 3 ó@ K — | ]}t |t ¦ « V — Œd S )N)Ú
isinstanceÚstr)Ú.0Úps ú�/builddir/build/BUILDROOT/alt-python27-cllib-3.4.44-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/cpapi/cpapicustombin.pyú