File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/client/ssh/__pycache__/ssh_py_shim.cpython-310.pyc
Back
o ;j�3 � @ s d Z ddlmZmZ ddlZddlZddlZddlZddlZddl Z ddl Z ddlZdZdZ dZdZdZd Zd ZdZG dd � d �Ze� ZdZdd� Zdd� Zdd� Zd&dd�Zdd� Zdd� Zdd� Zd'dd �Zd!d"� Zd#d$� Z e!d%kr~e �"e e j#�� dS dS )(a This is a shim that handles checking and updating salt thin and then invoking thin. This is not intended to be instantiated as a module, rather it is a helper script used by salt.client.ssh.Single. It is here, in a separate file, for convenience of development. � )�absolute_import�print_functionNz salt-thin.tgzzsalt-ext_mods.tgz� � � � � �I c @ s e Zd ZdZdS )�OptionsContainerz? An empty class for holding instance attribute values. N)�__name__� __module__�__qualname__�__doc__� r r �O/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/ssh/ssh_py_shim.pyr ! s r c C s� d} t j�d�st jdurt jj} | sLddl}z|�� } W n ty, |jdd�} Y nw ~| s4t � � } | sLt j�d�r@d} | S t j�d�rJd} | S d } | S ) zN Get system encoding. Most of this code is a part of salt/__init__.py N�winr T)�do_setlocale�darwin�utf-8�mbcs�ascii) �sys�platform� startswith�stdin�encoding�localeZgetencoding�AttributeError�getpreferredencoding�getdefaultencoding)r r r r r �get_system_encoding/ s, ���r c C s t j�d�S )z? Simple function to return if a host is Windows or not r )r r r r r r r � is_windows` s r! c C s, t j�tj�r t�tj� t �d�} z t �tj� W t �| � nt �| � w t � s�t � � }t �tj�}|j|kr;t � |jd@ dkrEt � t j�d�}|r�z#t �tjdt|�� t �tj�}t �tj|jtjB tjB tjB � W n ty� tj�d� t�d� Y nw tj�d�tj�� t�t� d S ) z� Salt thin needs to be deployed - prep the target directory and emit the delimiter and exit code that signals a required deployment. �? i����i�A ZSUDO_GID���z� Unable to set permissions on thin directory. If sudo_user is set and is not root, be certain the user is in the same group as the login user� z{0} deploy N)�os�path�exists�OPTIONS�saltdir�shutil�rmtree�umask�makedirsr! �geteuid�stat�st_uid�need_deployment�st_mode�environ�get�chown�int�chmod�S_IWGRP�S_IRGRP�S_IXGRP�OSErrorr �stdout�write�exit�format� delimiter�EX_THIN_DEPLOY)� old_umaskZeuidZdstatZsudo_gidZsttr r r r1 g s<