File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/parallels.cpython-310.pyc
Back
o ;jO � @ s: d Z ddlZddlZddlZddlZddlZddlZddlm Z m Z dZddiZe� e�Ze�dej�Zdd � Zd d� Zd3dd �Zd3dd�Zd4dd�Zd5dd�Zd6dd�Zd6dd�Zd6dd�Zd7dd�Zd6dd�Zd6dd �Zd6d!d"�Zd6d#d�Z d7d$d%�Z!d7d&d'�Z"d8d)d*�Z#d9d+d,�Z$d:d-d.�Z%d;d/d0�Z&d6d1d2�Z'dS )<a� Manage Parallels Desktop VMs with ``prlctl`` and ``prlsrvctl``. Only some of the prlctl commands implemented so far. Of those that have been implemented, not all of the options may have been provided yet. For a complete reference, see the `Parallels Desktop Reference Guide <http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf>`_. This module requires the prlctl binary to be installed to run most functions. To run parallels.prlsrvctl, the prlsrvctl binary is required. What has not been implemented yet can be accessed through ``parallels.prlctl`` and ``parallels.prlsrvctl`` (note the preceding double dash ``--`` as necessary): .. code-block:: bash salt '*' parallels.prlctl installtools macvm runas=macdev salt -- '*' parallels.prlctl capture 'macvm --file macvm.display.png' runas=macdev salt -- '*' parallels.prlsrvctl set '--mem-limit auto' runas=macdev .. versionadded:: 2016.3.0 � N)�CommandExecutionError�SaltInvocationErrorZ parallels�exec_�execzB{?([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})}?c C s: t | t�r t�| �S t | ttf�rdd� | D �S t| �gS )z* Return args as a list of strings c S s g | ]}t |��qS � )�str)�.0�argr r �J/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/parallels.py� <listcomp>4 s z#_normalize_args.<locals>.<listcomp>)� isinstancer �shlex�split�tuple�list)�argsr r r �_normalize_args, s r c C sD g }t �t| �D ]}|�� r|�|�d��d�� qttt |���S )a� Return the set of GUIDs found in guid_string :param str guid_string: String containing zero or more GUIDs. Each GUID may or may not be enclosed in {} Example data (this string contains two distinct GUIDs): PARENT_SNAPSHOT_ID SNAPSHOT_ID {a5b8999f-5d95-4aff-82de-e515b0101b66} {a5b8999f-5d95-4aff-82de-e515b0101b66} *{a7345be5-ab66-478c-946e-a6c2caf14909} r �{}) �re�finditer� GUID_REGEX�groups�append�group�strip�sortedr �set)Zguid_stringZguidsZ found_guidr r r �_find_guids9 s �r c C �@ t jj�d�std��d| g}|r|�t|�� td ||d�S )a Execute a prlsrvctl command .. versionadded:: 2016.11.0 :param str sub_cmd: prlsrvctl subcommand to execute :param str args: The arguments supplied to ``prlsrvctl <sub_cmd>`` :param str runas: The user that the prlsrvctl command will be run as Example: .. code-block:: bash salt '*' parallels.prlsrvctl info runas=macdev salt '*' parallels.prlsrvctl usb list runas=macdev salt -- '*' parallels.prlsrvctl set '--mem-limit auto' runas=macdev � prlsrvctlzprlsrvctl utility not available�cmd.run��runas��salt�utils�path�whichr �extendr Z__salt__�Zsub_cmdr r"