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/modules/__pycache__/boto_cfn.cpython-310.pyc
o

�N�g��@sdZddlZddlZe�e�ZzddlZddlZddl	m
Z
e�d��ej�dZ
Wney5dZ
Ynwdd�Zd	d
�Zddd�Zdd
d�Z															ddd�Z																	ddd�Zddd�Zddd�Z						ddd�ZdS)aX
Connection module for Amazon Cloud Formation

.. versionadded:: 2015.5.0

:configuration: This module accepts explicit AWS credentials but can also utilize
    IAM roles assigned to the instance through Instance Profiles. Dynamic
    credentials are then automatically obtained from AWS API and no further
    configuration is necessary. More Information available at:

    .. code-block:: text

        http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

    If IAM roles are not used you need to specify them either in a pillar or
    in the minion's config file:

    .. code-block:: yaml

        cfn.keyid: GKTADJGHEIQSXMKKRBJ08H
        cfn.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

    A region may also be specified in the configuration:

    .. code-block:: yaml

        cfn.region: us-east-1

:depends: boto
�N)�BotoServerError�botoTFcCstjjjdd�S)z,
    Only load if boto libraries exist.
    F)Zcheck_boto3)�salt�utilsZversionsZcheck_boto_reqs�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_cfn.py�__virtual__9srcCs trtdtddtd�dSdS)Nzboto.assign_funcsZcfnZcloudformation)�module�pack)�HAS_BOTOZ	__utils__�__name__Z__salt__)�optsrrr�__init__@s

��rc
Csbt||||d�}z|�|�}t�d|�WdSty0}ztjddd�WYd}~dSd}~ww)z�
    Check to see if a stack exists.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cfn.exists mystack region=us-east-1
    ��region�key�keyid�profile�Stack %s exists.Tz#boto_cfn.exists raised an exception)�exc_infoNF)�	_get_conn�describe_stacks�log�debugr)�namerrrr�conn�exists�errrrGs

��rc
s�t||||d�}zW|�|�}|rW|d�t�d�j�d}�fdd�|D�}t�d�}	t�d�}
i}i}|	D]}
|
j||
j<q6||d<|
D]}|j||j<qE||d<d	|iWSt�d
|�WdStyy}zt�	d||�WYd
}~dSd
}~ww)z�
    Describe a stack.

    .. versionadded:: 2015.8.0

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cfn.describe mystack region=us-east-1
    rrz
Found VPC: %s)�stack_id�descriptionZstack_statusZstack_status_reason�tagscs"i|]
}t�|�r|t�|��qSr)�hasattr�getattr)�.0�k��stackrr�
<dictcomp>ys"zdescribe.<locals>.<dictcomp>�outputs�
parametersr&rTzCould not describe stack %s.
%sNF)
rrrrrr"�valuerr�warning)rrrrrr�r�keys�ret�o�pr(r)�i�jrrr%r�describe]s4



��r3cCs~t||
||d�}z|�||||||||||	|
|�WSty>}zd|�d|��}t�|�t�|�WYd}~dSd}~ww)z�
    Create a CFN stack.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cfn.create mystack template_url='https://s3.amazonaws.com/bucket/template.cft'         region=us-east-1
    r�Failed to create stack z.
NF)rZcreate_stackrr�errorr)r�
template_body�template_urlr)�notification_arns�disable_rollback�timeout_in_minutes�capabilitiesr Z
on_failure�stack_policy_body�stack_policy_urlrrrrrr�msgrrr�create�s.�

��r?cCs�t||||d�}z|�||||||||||	|
|||
�}t�d|�|WStyI}zd|�d�}t�|�t�|�t|�WYd}~Sd}~ww)z�
    Update a CFN stack.

    .. versionadded:: 2015.8.0

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cfn.update_stack mystack template_url='https://s3.amazonaws.com/bucket/template.cft'         region=us-east-1
    rzUpdated result is : %s.zFailed to update stack �.N)r�update_stackrrrr5�str)rr6r7r)r8r9r:r;r Zuse_previous_templateZstack_policy_during_update_bodyZstack_policy_during_update_urlr<r=rrrrr�updaterr>rrrrA�s6 �

��rAc
Csjt||||d�}z|�|�WSty4}zd|�d�}t�|�t�|�t|�WYd}~Sd}~ww)z�
    Delete a CFN stack.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cfn.delete mystack region=us-east-1
    rr4r@N)rZdelete_stackrrr5rrB)rrrrrrrr>rrr�delete�s


��rDc	
Cszt||||d�}z|�|�}t�d|�|WSty<}zt�|�d|�d�}t�|�t|�WYd}~Sd}~ww)z�
    Check to see if attributes are set on a CFN stack.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cfn.get_template mystack
    rzRetrieved template for stack %sz	Template z does not existN)r�get_templater�inforrr5rB)	rrrrrr�templaterr>rrrrEs



��rEc	
Cslt||||d�}z|�||�WSty5}zt�|�d|�d�}t�|�t|�WYd}~Sd}~ww)z�
    Validate cloudformation template

    .. versionadded:: 2015.8.0

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cfn.validate_template mystack-template
    rz(Error while trying to validate template r@N)r�validate_templaterrrr5rB)	r6r7rrrrrrr>rrrrH*s

��rH)NNNN)NNNNNNNNNNNNNNN)NNNNFNNNNNNNNNNNN)NNNNNN)�__doc__�loggingZsalt.utils.versionsr�	getLoggerrrrZboto.cloudformationZboto.exceptionr�setLevel�CRITICALr�ImportErrorrrrr3r?rArDrErHrrrr�<module>sx#
�

3
�6
�
<
�