HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/ports.cpython-310.pyc
o

�N�gZ�@s�dZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZmZe�
e�Zdd�Zdd�Zd	d
�Zdd�Zdd
d�ZdS)a;
Manage software from FreeBSD ports

.. versionadded:: 2014.1.0

.. note::

    It may be helpful to use a higher timeout when running a
    :mod:`ports.installed <salt.states.ports>` state, since compiling the port
    may exceed Salt's timeout.

    .. code-block:: bash

        salt -t 1200 '*' state.highstate
�N)�CommandExecutionError�SaltInvocationError)�
_normalize�_options_file_existscCs t�dd�dkrdtvrdSdS)N�os�ZFreeBSD�
ports.installZports)Fz ports module could not be loaded)Z
__grains__�get�__salt__�rr�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/ports.py�__virtual__sr
cCsdd�tjj�|���D�S)z!
    Repack the options data
    cSsi|]\}}t|�t|��qSr)�strr��.0�x�yrrr�
<dictcomp>)s��z#_repack_options.<locals>.<dictcomp>)�salt�utils�dataZrepack_dictlist�items��optionsrrr�_repack_options%s�rcCsd�dd�|��D��S)zv
    Returns the key/value pairs in the passed dict in a commaspace-delimited
    list in the format "key=value".
    �, cSsg|]\}}|�d|���qS)�=rrrrr�
<listcomp>4sz$_get_option_list.<locals>.<listcomp>)�joinrrrrr�_get_option_list/srcCs|r	dt|���SdS)zS
    Common function to get a string to append to the end of the state comment
    z"with the following build options: zwith the default build options)rrrrr�_build_option_string7sr c

s|id|�d�d�}z(td|ddd�}td|ddd��|r'|tt|��}�r1�tt����Wn"ttfyT}zd|d<d�||�|d	<|WYd
}~Sd
}~ww|d
ur]t|�ni}t���}|�	|�dd�td
dd��
�D�}||kr�||vr�|r�|d	dt|�7<|S�s�|r�d|d<d�|�|d	<|Stdr�d
|d<|�d�|d	<|Snm�fdd�|D�}|r�d|d<d�|d�
|��|d	<|Stdr�d
|d<|�d�|d	<|d	t|�7<|S|�rtd|fddi|���sd|d<d|��|d	<|Sntd|�t|��rd|d<d|��|d	<|Std|�|d<dd�td
dd��
�D�}tjtdjj�d d
�}	|	�sJ||v�rNd|d<|d�rkd!|��|d	<��ri|d	dt|�7<|Sd"|��|d	<|	�r�|d	d#|	��7<|S)$a-
    Verify that the desired port is installed, and that it was compiled with
    the desired options.

    options
        Make sure that the desired non-default options are set

        .. warning::

            Any build options not passed here assume the default values for the
            port, and are not just differences from the existing cached options
            from a previous ``make config``.

    Example usage:

    .. code-block:: yaml

        security/nmap:
          ports.installed:
            - options:
              - IPV6: off
    Tz is already installed)�name�changes�result�commentzports.showconfigF)�defaultZdict_returnr#zuUnable to get configuration for {}. Port name may be invalid, or ports tree may need to be updated. Error message: {}r$NcS�g|]}|d�qS��originr�rrrrrrv��zinstalled.<locals>.<listcomp>z
pkg.list_pkgs)Zwith_origin� z>{} does not have any build options, yet options were specified�testz will be installedcsg|]}|�vr|�qSrrr)�Zdefault_optionsrrr�sz2The following options are not available for {}: {}rz will be installed zports.config�resetzUnable to set options for zports.rmconfigzUnable to clear options for rr"cSr&r'rr)rrrr�r*z	test.pingzports.install_errorzSuccessfully installed zFailed to install z. Error message:
)r
�next�iterrr�formatr�copy�deepcopy�update�valuesr Z__opts__rr�sys�modules�
__module__�__context__�pop)
r!r�retZcurrent_options�excZdesired_optionsZ	ports_preZbad_optsZ
ports_post�errrr-r�	installedAs��������	

����
���
��
�r>)N)�__doc__r2�loggingrr6Zsalt.utils.datarZsalt.exceptionsrrZsalt.modules.freebsdportsrr�	getLogger�__name__�logr
rrr r>rrrr�<module>s