File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/seed.cpython-310.pyc
Back
o ;jS# � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl ZddlZe�e �ZddiZdd� Zdd� Zdd d �Zdd� Z ddd�Z ddd�Zdd� Zdd� Zdd� ZdS )z( Virtual machine image management tools � N�apply_Zapplyc C sP t j�| �r&tjj�| ��}tjj�|� � �W d � S 1 s!w Y | S �N) �os�path�exists�salt�utils�files�fopen�stringutils� to_unicode�read)Zfile_�fic� r �E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/seed.py�_file_or_content s �r c C sx t d � }tj�| dt�� � �}tj�|�st�|� t�|d� tj�|tj� |��}t �||� |�| d�}||fS )z� Update and get the random script to a random place CLI Example: .. code-block:: bash salt '*' seed.prep_bootstrap /tmp zconfig.gather_bootstrap_script�tmpi� � ) �__salt__r r �join�uuidZuuid4r �makedirs�chmod�basename�shutil�copy�replace)�mptZbs_Zfpd_�fp_�tmppathr r r �prep_bootstrap s r c C s� d }|dkrt �� }td || �st�|� d S |S |dkr | S |dkrAdtv r+d}n dtv r2d}nd S td | ||d �}|sAd S |S ) N�blockzmount.mount�dir�file� guestfs.mount�guestfs� qemu_nbd.init�qemu_nbd�Zdevice�util)�tempfile�mkdtempr r �rmdir)r �ftype�rootr r) r r r �_mount7 s&