HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/chef.cpython-310.pyc
o

�N�gv�@s�dZddlZddlZddlZddlZddlZddlZe�e	�Z
dd�Zdd�Zej
jj�d�dd	d
��Zej
jj�d�ddd
��Zdd�ZdS)z%
Execute chef in server or solo mode
�NcCstjj�d�s	dSdS)z(
    Only load if chef is installed
    �chef-client)Fz.Cannot load chef module: chef-client not foundT)�salt�utils�path�which�rr�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/chef.py�__virtual__sr	cCsrtjj��r,tj�tdd�}tj�|�st�	|�t
j||ddd�}|j}|�
�|Stjj�d|�d��}|S)z#
    Retrieve the logfile name
    Zcachedir�tmpz.logF)�dir�prefix�suffix�deletez/var/log)rr�platformZ
is_windows�osr�joinZ__opts__�isdir�mkdir�tempfileZNamedTemporaryFile�name�close)Zexe_nameZtmp_dirZlogfile_tmp�logfilerrr�_default_logfiles
��rrFcKsP|durtd�}dddd|�d�dg}|r|�d�|r!|�d	�t|i|��S)
a�
    Execute a chef client run and return a dict with the stderr, stdout,
    return code, and pid.

    CLI Example:

    .. code-block:: bash

        salt '*' chef.client server=https://localhost

    server
        The chef server URL

    client_key
        Set the client key file location

    config
        The configuration file to use

    config-file-jail
        Directory under which config files are allowed to be loaded
        (no client.rb or knife.rb outside this path will be loaded).

    environment
        Set the Chef Environment on the node

    group
        Group to set privilege to

    json-attributes
        Load attributes from a JSON file or URL

    localmode
        Point chef-client at local repository if True

    log_level
        Set the log level (debug, info, warn, error, fatal)

    logfile
        Set the log file location

    node-name
        The node name for this client

    override-runlist
        Replace current run list with specified items for a single run

    pid
        Set the PID file location, defaults to /tmp/chef-client.pid

    run-lock-timeout
        Set maximum duration to wait for another client run to finish,
        default is indefinitely.

    runlist
        Permanently replace current run list with specified items

    user
        User to set privilege to

    validation_key
        Set the validation key file location, used for registering new clients

    whyrun
        Enable whyrun mode when set to True

    Nr�
--no-colorz--once�--logfile "�"�--format doc�	--why-runz--local-mode�r�append�	_exec_cmd)�whyrunZ	localmoder�kwargs�argsrrr�client,sE
�

r$�	chef-solocKs@|durtd�}ddd|�d�dg}|r|�d�t|i|��S)a
    Execute a chef solo run and return a dict with the stderr, stdout,
    return code, and pid.

    CLI Example:

    .. code-block:: bash

        salt '*' chef.solo override-runlist=test

    config
        The configuration file to use

    environment
        Set the Chef Environment on the node

    group
        Group to set privilege to

    json-attributes
        Load attributes from a JSON file or URL

    log_level
        Set the log level (debug, info, warn, error, fatal)

    logfile
        Set the log file location

    node-name
        The node name for this client

    override-runlist
        Replace current run list with specified items for a single run

    recipe-url
        Pull down a remote gzipped tarball of recipes and untar it to
        the cookbook cache

    run-lock-timeout
        Set maximum duration to wait for another client run to finish,
        default is indefinitely.

    user
        User to set privilege to

    whyrun
        Enable whyrun mode when set to True
    Nr%rrrrrr)r!rr"r#rrr�solo�s2
�
r&cOsJd�|�}d�dd�|��D��}|�|��}t�d|�td|dd�S)	N� �cSs*g|]\}}|�d�sd|�d|���qS)�__z --r')�
startswith)�.0�k�vrrr�
<listcomp>�s*z_exec_cmd.<locals>.<listcomp>zChef command: %szcmd.run_allF)Zpython_shell)r�items�log�debugZ__salt__)r#r"Zcmd_argsZ
cmd_kwargsZcmd_execrrrr �s
�r )FFN)FN)�__doc__�loggingrrZsalt.utils.decorators.pathrZsalt.utils.pathZsalt.utils.platform�	getLogger�__name__r0r	rrZ
decoratorsrrr$r&r rrrr�<module>s
	W@