Edit File: cpapicustombin.cpython-311.pyc
� �e! � �� � d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlmZm Z m Z mZ ddlm Z ddlmZ d Zd e ee eee eef f f fd�Zded ee eef fd �ZdS )zv common helper functions, related to processing api using custom binary currently available for Directadmin and Plesk � )�absolute_import)�division)�print_functionN)�List�Tuple�Union�Optional)�exec_utility)�ClPwdz#/usr/share/python-cllib/userdomains�returnc � � t t g � � \ } }t j |� � }| dk rt t d� |� � � � }| |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 � � t | � � S )N)�tuple)�xs ��/builddir/build/BUILDROOT/alt-python27-cllib-3.3.5-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/cpapi/cpapicustombin.py�<lambda>z/get_domains_via_custom_binary.<locals>.<lambda>( s � ��q��� � )r �USERDOMAINS�json�loads�list�map)�rc�out�ress r �get_domains_via_custom_binaryr sQ � �"