관리-도구
편집 파일: cpapicustombin.cpython-311.pyc
� \�Dg~ � �� � 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/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/cpapi/cpapicustombin.py� <genexpr>z;get_domains_via_custom_binary.<locals>.<listcomp>.<genexpr>, s, � � � �(I�(I���A�s�);�);�(I�(I�(I�(I�(I�(I� r � )�len�all)r �rows r � <listcomp>z1get_domains_via_custom_binary.<locals>.<listcomp>) sW � � � � ���s�8�8�q�=�=�S�(I�(I�S�(I�(I�(I�%I�%I�=� �Q���Q�� � �=�=r )r �USERDOMAINS�json�loads�JSONDecodeError)�rc�out�ress r �get_domains_via_custom_binaryr! s� � �"