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

�N�g�-�@s�dZddlZddlmmZddlZddlZe�	e
�ZdZdd�Z
																		ddd�Zddd	�Zd
d�Z						ddd
�Zdd�ZdS)ah
Connection module for Amazon Cloud Formation

.. versionadded:: 2015.8.0

:depends: boto
: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
    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

        keyid: GKTADJGHEIQSXMKKRBJ08H
        key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

    .. code-block:: yaml

        stack-present:
          boto_cfn.present:
            - name: mystack
            - template_body: salt://base/mytemplate.json
            - disable_rollback: true
            - region: eu-west-1
            - keyid: 'AKIAJHTMIQ2ASDFLASDF'
            - key: 'fdkjsafkljsASSADFalkfjasdf'

    .. code-block:: yaml

        stack-absent:
          boto_cfn.absent:
            - name: mystack
�NZboto_cfncCsdtvrdSddt�d�fS)zF
    Only load if elementtree xml library and boto are available.
    �boto_cfn.existsTFzCannot load z# state: boto_cfn module unavailable)�__salt__�__virtualname__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/boto_cfn.py�__virtual__2s

�rcCst|ddid�}t||�}t|
|�}
t|
|�}
||
|
fD]}t|t�r&|Sqt||||||�}t�d|�|durL|\}}d|d<d�||�|d<|St�d	|�td
|||||�r�td|||||�}|dd
d�dd�}t	j
j�|�}t	j
j�|�}t	j
j
�||�}|dkr�t�d|�tdr�d|�d�|d<d|d<|Std|||||||||||
||
|||||�}t|t�r�t|�\}}t�d||�d|d<d�|||�|d<|Sd�|�|d<||dd<|Sd|�d�|d<i|d<|Std�rd|�d�|d<d|d<|Std||||||||||	|
|||||�}|�r4d|�d �|d<||dd<|Sd|d<|S)!u

    Ensure cloud formation stack is present.

    name (string) - Name of the stack.

    template_body (string) – Structure containing the template body. Can also be loaded from a file by using salt://.

    template_url (string) – Location of file containing the template body. The URL must point to a template located in
    an S3 bucket in the same region as the stack.

    parameters (list) – A list of key/value tuples that specify input parameters for the stack. A 3-tuple (key, value,
    bool) may be used to specify the UsePreviousValue option.

    notification_arns (list) – The Simple Notification Service (SNS) topic ARNs to publish stack related events.
    You can find your SNS topic ARNs using the `SNS_console`_ or your Command Line Interface (CLI).

    disable_rollback (bool) – Indicates whether or not to rollback on failure.

    timeout_in_minutes (integer) – The amount of time that can pass before the stack status becomes CREATE_FAILED; if
    DisableRollback is not set or is set to False, the stack will be rolled back.

    capabilities (list) – The list of capabilities you want to allow in the stack. Currently, the only valid capability
    is ‘CAPABILITY_IAM’.

    tags (dict) – A set of user-defined Tags to associate with this stack, represented by key/value pairs. Tags defined
    for the stack are propagated to EC2 resources that are created as part of the stack. A maximum number of 10 tags can
    be specified.

    on_failure (string) – Determines what action will be taken if stack creation fails. This must be one of:
    DO_NOTHING, ROLLBACK, or DELETE. You can specify either OnFailure or DisableRollback, but not both.

    stack_policy_body (string) – Structure containing the stack policy body. Can also be loaded from a file by using
    salt://.

    stack_policy_url (string) – Location of a file containing the stack policy. The URL must point to a policy
    (max size: 16KB) located in an S3 bucket in the same region as the stack.If you pass StackPolicyBody and
    StackPolicyURL, only StackPolicyBody is used.

    use_previous_template (boolean) – Used only when templates are not the same. Set to True to use the previous
    template instead of uploading a new one via TemplateBody or TemplateURL.

    stack_policy_during_update_body (string) – Used only when templates are not the same. Structure containing the
    temporary overriding stack policy body. If you pass StackPolicyDuringUpdateBody and StackPolicyDuringUpdateURL,
    only StackPolicyDuringUpdateBody is used. Can also be loaded from a file by using salt://.

    stack_policy_during_update_url (string) – Used only when templates are not the same. Location of a file containing
    the temporary overriding stack policy. The URL must point to a policy (max size: 16KB) located in an S3 bucket in
    the same region as the stack. If you pass StackPolicyDuringUpdateBody and StackPolicyDuringUpdateURL, only
    StackPolicyDuringUpdateBody is used.

    region (string) - Region to connect to.

    key (string) - Secret key to be used.

    keyid (string) - Access key to be used.

    profile (dict) - A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key
    and keyid.

    .. _`SNS_console`: https://console.aws.amazon.com/sns

    T���name�result�comment�changeszValidate is : %s.Frz'Template could not be validated.
{} 
{}rzTemplate %s is valid.rzboto_cfn.get_templateZGetTemplateResponseZGetTemplateResultZTemplateBody�ascii�ignorerz/Templates are not the same. Compare value is %s�test�Stack z is set to be updated.Nzboto_cfn.update_stackz$Update error is %s and message is %sz&Stack {} could not be updated.
{} 
{}.z-Cloud formation template {} has been updated.r
�newz exists.z is set to be created.zboto_cfn.createz
 was created.)�
_get_template�
isinstance�dict�	_validate�log�debug�formatr�encode�salt�utils�json�loads�compat�cmp�__opts__�str�
_get_error)r
�
template_body�template_urlZ
parametersZnotification_arnsZdisable_rollbackZtimeout_in_minutesZcapabilities�tagsZ
on_failureZstack_policy_bodyZstack_policy_urlZuse_previous_templateZstack_policy_during_update_bodyZstack_policy_during_update_url�region�key�keyid�profile�ret�iZ_valid�code�message�templateZ_template_bodyZcompare�updated�createdrrr�present?s�S

�
��
���
��
�r2c	Cs�|ddid�}td|||||�sd|�d�|d<i|d<|Std	r1d|�d
�|d<d|d<|Std
|||||�}t|t�rYt|�\}}d�|||�|d<d|d<i|d<|S|rkd|�d�|d<||dd<|SdS)uu
    Ensure cloud formation stack is absent.

    name (string) – The name of the stack to delete.

    region (string) - Region to connect to.

    key (string) - Secret key to be used.

    keyid (string) - Access key to be used.

    profile (dict) - A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key
    and keyid.
    Trr	rrz does not exist.rr
rz is set to be deleted.Nrzboto_cfn.deletez$Stack {} could not be deleted.
{}
{}Fz
 was deleted.�deleted)rr!rr"r#r)	r
r'r(r)r*r+r3r-r.rrr�absent�s.
��r4c
Cs||ddid�}|dur<d|vr<ztd|�WSty;}zt�|�d|�d�|d<d	|d
<|WYd}~Sd}~ww|S)NTrr	zsalt://zcp.get_file_strzFile z not found.rFr)r�OSErrorrr)r/r
r+�errrr s
��rc	CsRtd||||||�}t�d|�t|t�r't|�\}}t�d||�||fSdS)Nzboto_cfn.validate_templatezValidate result is %s.z'Validate error is %s and message is %s.T)rrrrr"r#)	r$r%r'r(r)r*�validater-r.rrrr.s	�
rcCsFd�|�d�dd��}t�|�}|ddj}|ddj}||fS)N�
�r�)�join�split�ETZ
fromstring�text)�errorr-r.rrrr#Bs

r#)NNNNNNNNNNNNNNNNNN)NNNN)NNNNNN)�__doc__�loggingZxml.etree.ElementTreeZetreeZElementTreer=Zsalt.utils.compatrZsalt.utils.json�	getLogger�__name__rrrr2r4rrr#rrrr�<module>sL&

�
;'
�