%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_s3.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlj	j
Z
ddlZej
e�Zd�Zeddddd	d
ddd
ddddg
�Zeddg�Zed
dddg�Zddddddddd�ZdS(u�
Manage S3 Resources
=================

.. versionadded:: 2018.3.0

Manage S3 resources. Be aware that this interacts with Amazon's services,
and so may incur charges.

This module uses ``boto3``, which can be installed via package, or pip.

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 `here
<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 file or
in the minion's config file:

.. code-block:: yaml

    s3.keyid: GKTADJGHEIQSXMKKRBJ08H
    s3.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

It's also possible to specify ``key``, ``keyid`` and ``region`` via a profile,
either passed in as a dict, or as a string to pull from pillars or minion
config:

.. code-block:: yaml

    myprofile:
        keyid: GKTADJGHEIQSXMKKRBJ08H
        key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
            region: us-east-1

.. code-block:: yaml

    Ensure s3 object exists:
        boto_s3.object_present:
            - name: s3-bucket/s3-key
            - source: /path/to/local/file
            - region: us-east-1
            - keyid: GKTADJGHEIQSXMKKRBJ08H
            - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
            - profile: my-profile

:depends: boto3
i(tabsolute_importtprint_functiontunicode_literalsNcC@sdtkrtSdS(u)
    Only load if boto is available.
    uboto_s3.get_object_metadatauboto_s3(t__salt__tFalse(((s7/usr/lib/python2.7/site-packages/salt/states/boto_s3.pyt__virtual__AsuCacheControluContentDispositionuContentEncodinguContentLanguageuContentTypeuExpiresuMetadatauServerSideEncryptionuSSECustomerAlgorithmuSSECustomerKeyMD5uSSEKMSKeyIduStorageClassuWebsiteRedirectLocationuSSECustomerKeyuRequestPayeruboto_s3_object_extra_argsc	
@si|d6dd6id6}	|d&kr0i}ntjtd|i��}
td|
|�|
r�ttB}ttj	|
��}||}
|
r�dj
|
�}i|d6Sn|s�td	}nytj
jj|d
|�}Wngtk
r}t|	d<dj
||�|	d<|	Stk
rJ}t|	d<d
j
||�|	d<|	SXd}|
jdi�||
dkr�|
d||kr�t|	d<dj
|�|	d<|	Sn||
d|<td�tj|
�D���td�tj|
�D��}td|d|d|d|d|d|��d�krTt|	d<dj
�d�|	d<|	S�dr�t��fd�tD��}|�kr�t|	d<dj
|�|	d<|	Sd}nd&}d}d�}djtj||�jt�|��jt���}tdrYd&|	d<d j
||�|	d<|	dcd!j
|�7<i|d"6|	d<|	Std#||d|
d|d|d|d|��d�kr�t|	d<d$j
|�d�|	d<|	St|	d<d%j
||�|	d<|	dcd!j
|�7<i|d"6|	d<|	S('u"
    Ensure object exists in S3.

    name
        The name of the state definition.
        This will be used to determine the location of the object in S3,
        by splitting on the first slash and using the first part
        as the bucket name and the remainder as the S3 key.

    source
        The source file to upload to S3,
        currently this only supports files hosted on the minion's local
        file system (starting with /).

    hash_type
        Hash algorithm to use to check that the object contents are correct.
        Defaults to the value of the `hash_type` config option.

    extra_args
        A dictionary of extra arguments to use when uploading the file.
        Note that these are only enforced if new objects are uploaded,
        and not modified on existing objects.
        The supported args are those in the ALLOWED_UPLOAD_ARGS list at
        http://boto3.readthedocs.io/en/latest/reference/customizations/s3.html.
        However, Note that the 'ACL', 'GrantFullControl', 'GrantRead',
        'GrantReadACP',  and 'GrantWriteACL' keys are currently not supported.

    extra_args_from_pillar
        Name of pillar dict that contains extra arguments.
        Extra arguments defined for this specific state will be
        merged over those from the pillar.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.
    unameuucommentuchangesu
config.optionudictupdate.updateu%extra_args keys {0} are not supporteduerroru	hash_typetformuresultu"Could not read local file {0}: {1}u"Could not hash local file {0}: {1}usalt_managed_content_hashuMetadatau]Salt uses the {0} metadata key internally,do not pass it to the boto_s3.object_present state.cs@s-|]#\}}|tkr||fVqdS(N(tUPLOAD_ONLY_EXTRA_ARGS(t.0tktv((s7/usr/lib/python2.7/site-packages/salt/states/boto_s3.pys	<genexpr>�s	cs@s-|]#\}}|tkr||fVqdS(N(tGET_METADATA_EXTRA_ARGS(RR	R
((s7/usr/lib/python2.7/site-packages/salt/states/boto_s3.pys	<genexpr>�s	uboto_s3.get_object_metadatat
extra_argstregiontkeytkeyidtprofileu)Failed to check if S3 object exists: {0}.c3@s?|]5}|�kr|�dkr|�d|fVqdS(uresultN((RR	(tdesired_metadatatr(s7/usr/lib/python2.7/site-packages/salt/states/boto_s3.pys	<genexpr>�suS3 object {0} is present.uupdateucreatecS@s0d}td|�}td|dtd|�S(u>
        Safely dump YAML using a readable flow style
        uIndentedSafeOrderedDumperuyaml.get_dumperu	yaml.dumptdefault_flow_styletDumper(t	__utils__R(tattrstdumper_nametdumper((s7/usr/lib/python2.7/site-packages/salt/states/boto_s3.pyt_yaml_safe_dump	sutestuS3 object {0} set to be {1}d.u

Changes:
{0}udiffuboto_s3.upload_fileuFailed to {0} S3 object: {1}.uS3 object {0} {1}d.N(tNonetcopytdeepcopyRRtSTORED_EXTRA_ARGSRt	frozensettsixtiterkeystformatt__opts__tsalttutilst	hashutilstget_hashtIOErrorRt
ValueErrort
setdefaulttdictt	iteritemstTruetjointdifflibtunified_difft
splitlines(tnametsourcet	hash_typeRtextra_args_from_pillarR
RRRtrettcombined_extra_argstsupported_argstcombined_extra_args_keyst
extra_keystmsgtdigesttetHASH_METADATA_KEYtmetadata_extra_argsts3_metadatatactionRtchanges_diff((RRs7/usr/lib/python2.7/site-packages/salt/states/boto_s3.pytobject_presentns�8
	








	


		

	

(t__doc__t
__future__RRRRR.tloggingtsalt.ext.sixtextRtsalt.utils.hashutilsR#t	getLoggert__name__tlogRRRRRRRB(((s7/usr/lib/python2.7/site-packages/salt/states/boto_s3.pyt<module>2sL	

Zerion Mini Shell 1.0