File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_cfn.cpython-310.pyc
o
�N�g� � @ s d Z ddlZddlZe�e�ZzddlZddlZddl m
Z
e�d��ej� dZ
W n ey5 dZ
Y nw dd� 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�botoTFc C s t jjjdd�S )z,
Only load if boto libraries exist.
F)Zcheck_boto3)�salt�utilsZversionsZcheck_boto_reqs� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_cfn.py�__virtual__9 s r c C s t rtd tddtd� d S d S )Nzboto.assign_funcsZcfnZcloudformation)�module�pack)�HAS_BOTOZ __utils__�__name__Z__salt__)�optsr r r �__init__@ s
��r c
C sb t ||||d�}z|�| �}t�d| � W dS ty0 } ztjddd� W Y d}~dS d}~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 )�namer r r r �conn�exists�er r r r G s
��r c
s� t ||||d�}zW|�| �}|rW|d � t�d� j� d}� fdd�|D �}t� d�} t� d�}
i }i }| D ]}
|
j||
j<