%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/vault.pyo

�
���^c@@shdZddlmZmZmZddlZddlZeje�Z	d�Z
d�Zd�ZdS(u�
States for managing Hashicorp Vault.
Currently handles policies. Configuration instructions are documented in the execution module docs.

:maintainer:    SaltStack
:maturity:      new
:platform:      all

.. versionadded:: 2017.7.0

i(tabsolute_importtprint_functiontunicode_literalsNcC@s�dj|�}tdd|�}yS|jdkrNt|||j�d�S|jdkrjt||�S|j�Wn9tk
r�}i|d6id6td	6d
j|�d6SXdS(
u�
    Ensure a Vault policy with the given name and rules is present.

    name
        The name of the policy

    rules
        Rules formatted as in-line HCL


    .. code-block:: yaml

        demo-policy:
          vault.policy_present:
            - name: foo/bar
            - rules: |
                path "secret/top-secret/*" {
                  policy = "deny"
                }
                path "secret/not-very-secret/*" {
                  policy = "write"
                }

    uv1/sys/policy/{0}uvault.make_requestuGETi�urulesi�unameuchangesuresultuFailed to get policy: {0}ucommentN(	tformatt	__utils__tstatus_codet_handle_existing_policytjsont_create_new_policytraise_for_statust	ExceptiontFalse(tnametrulesturltresponsete((s5/usr/lib/python2.7/site-packages/salt/states/vault.pytpolicy_presents
cC@s�tdr?i|d6iidd6|d6|6d6dd6dd	6Si|d
6}dj|�}tdd
|d|�}|jdkr�i|d6id6td6dj|j�d	6Si|d6td6iidd6|d6|6d6dd	6S(NutestunameuuoldunewuchangesuresultuPolicy would be createducommenturulesuv1/sys/policy/{0}uvault.make_requestuPUTRi�i�uFailed to create policy: {0}uPolicy was created(i�i�(t__opts__tNoneRRRRtreasontTrue(RR
tpayloadRR((s5/usr/lib/python2.7/site-packages/salt/states/vault.pyR@s(

cC@sBi|d6}||kr;t|d<i|d<d|d<|Sdjtj|jt�|jt���}tdr�d|d<ii|d6|6|d<d	|d<|Si|d
6}dj|�}tdd
|d|�}|j	dkri|d6id6t
d6dj|j�d6St|d<ii|d6|6|d<d|d<|S(Nunameuresultuchangesu*Policy exists, and has the correct contentucommentuutestuchangeuPolicy would be changedurulesuv1/sys/policy/{0}uvault.make_requestuPUTRi�i�uFailed to change policy: {0}uPolicy was updated(i�i�(Rtjointdifflibtunified_difft
splitlinesRRRRRRR(Rt	new_rulestexisting_rulestrettchangeRRR((s5/usr/lib/python2.7/site-packages/salt/states/vault.pyR\s2



-





(
t__doc__t
__future__RRRtloggingRt	getLoggert__name__tlogRRR(((s5/usr/lib/python2.7/site-packages/salt/states/vault.pyt<module>s	+	

Zerion Mini Shell 1.0