Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pyc

�
�Udac@`sUddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZddlmZddlmZddlmZidd6dd6dd6Zdddeeddedddeed�
Zd�Zd�Zd�Zdded�Zd�Ze dkrQe�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: netapp_e_auth
short_description: NetApp E-Series set or update the password for a storage array.
description:
    - Sets or updates the password for a storage array.  When the password is updated on the storage array, it must be updated on the SANtricity Web
      Services proxy. Note, all storage arrays do not have a Monitor or RO role.
version_added: "2.2"
author: Kevin Hulquest (@hulquest)
options:
    validate_certs:
        required: false
        default: true
        description:
        - Should https certificates be validated?
        type: bool
    name:
      description:
        - The name of the storage array. Note that if more than one storage array with this name is detected, the task will fail and you'll have to use
          the ID instead.
      required: False
    ssid:
      description:
        - the identifier of the storage array in the Web Services Proxy.
      required: False
    set_admin:
      description:
        - Boolean value on whether to update the admin password. If set to false then the RO account is updated.
      type: bool
      default: False
    current_password:
      description:
        - The current admin password. This is not required if the password hasn't been set before.
      required: False
    new_password:
      description:
        - The password you would like to set. Cannot be more than 30 characters.
      required: True
    api_url:
      description:
        - The full API url.
        - "Example: http://ENDPOINT:8080/devmgr/v2"
        - This can optionally be set via an environment variable, API_URL
      required: False
    api_username:
      description:
        - The username used to authenticate against the API
        - This can optionally be set via an environment variable, API_USERNAME
      required: False
    api_password:
      description:
        - The password used to authenticate against the API
        - This can optionally be set via an environment variable, API_PASSWORD
      required: False
s
- name: Test module
  netapp_e_auth:
    name: trex
    current_password: OldPasswd
    new_password: NewPasswd
    set_admin: yes
    api_url: '{{ netapp_api_url }}'
    api_username: '{{ netapp_api_username }}'
    api_password: '{{ netapp_api_password }}'
sw
msg:
    description: Success message
    returned: success
    type: str
    sample: "Password Updated Successfully"
N(tbasic_auth_argument_spec(t
AnsibleModule(t	HTTPError(t	to_native(topen_urlsapplication/jsonsContent-TypetAccepttnones!x-netapp-password-validate-methodtGETi
cC`sy[td|d|d|d|d|d|d|d|d	|d
|	d|
d|d
|�
}Wntk
ry}|j}nXy.|j�}|r�tj|�}nd}Wn&tk
r�|
r�q�t|��nX|j�}|dkr|
rt||��n
||fSdS(Nturltdatatheaderstmethodt	use_proxytforcet
last_mod_timettimeouttvalidate_certsturl_usernameturl_passwordt
http_agenttforce_basic_authi�(	RR
tfptreadtjsontloadstNonet	Exceptiontgetcode(RRRRRRRRRRRRRt
ignore_errorstrtetraw_datat	resp_code((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pytrequestjs($



c
C`s�d}d}||}t|dtd|d|d|j�\}}	x[|	D]S}
|
d|krJ|d7}|dkr�|jd	d
d�q�|
d}qJqJqJW|dkr�|jd	d
|�n|SdS(Nisstorage-systemsRRRRtnameitmsgsZYou supplied a name for the Storage Array but more than 1 array was found with that name. sUse the id insteadtids+No storage array with the name %s was found(R)tHEADERSRt	fail_json(tmoduleR*tapi_urltusertpwdtcounttall_systemstsystems_urltrcRtsystemtssid((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pytget_ssid�s"


	
c

C`s�d|}||}yCt|dtd|d|d|j�\}}|d|dfSWn-tk
r�}	|jdd	t|	��nXdS(
Nsstorage-systems/%s/passwordsRRRRtreadOnlyPasswordSettadminPasswordSetR+s|There was an issue with connecting, please check that your endpoint is properly defined and your credentials are correct: %s(R)R-RR
R.R(
R/R8R0R1R2t
pwd_statusRR6RR&((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pytget_pwd_status�s

cC`s�d|}||}tjtd|��}yGt|d|dddtd|d|d	|j�\}	}
|	|
fSWn3tk
r�}|jd
d|t|�f�nXdS(
s)Update the stored storage-system passwordsstorage-systems/%ststoredPasswordRRtPOSTRRRRR+s6Failed to update system password. Id [%s].  Error [%s]N(	RtdumpstdictR)R-RR"R.R(R/R8R2R0tapi_usrtapi_pwdt
update_pwdRt	post_bodyR6RR&((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pytupdate_storage_system_pwd�s

!cC`s�d|}||}	|s#d}ntjtd|d|d|��}
yCt|	ddd|
d	td
|d|dtd
|j�\}}Wn?tk
r�}
|jdd|t	|
�fdt
j��nX|dkr`tjtddd|d|��}
y=t|	ddd|
d	td
|d|d
|j�\}}Wq`tk
r\|jdd�q`Xnt|�dkr�|jdd|||f�nt
||||||�\}}t|�dkr�|S|jdd||f�dS(sSet the storage-system passwordsstorage-systems/%s/passwordsttcurrentAdminPasswordt
adminPasswordtnewPasswordRR?RRRRR$RR+s3Failed to set system password. Id [%s].  Error [%s]t	exceptioni�sNWrong or no admin password supplied. Please update your playbook and try againi,s=Failed to set system password. Id [%s] Code [%s].  Error [%s]s%s:%sN(RR@RAR)R-tTrueRR"R.Rt	tracebackt
format_exctintRF(R/R8R0R1R2tcurrent_passwordtnew_passwordt	set_admintset_passRRER6RR&tupdate_data((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pytset_password�s2

	'$'
 !c
C`sVt�}|jtdtdtdd�dtdtdd�dtdtdt�dtdtdt�d	tdtdd
�dtdt�dtdt�d
tdtdt���td|dddggdddgg�}|jd}|jd}|jd}|jd}|jd	}|jd}|jd
}|jd}	|jd|_|	jd�sv|	d7}	n|r�t	|||	||�}nt
|||	||�\}
}|r�|r�|jddd�nt|�dkr�|jdd�nt
|||	||d|d|d	|�}|jdtddd|dd|d�dS(NR*trequiredttypetstrR8RPtno_logRQRRtboolR0tapi_usernametapi_passwordt
argument_spectmutually_exclusivetrequired_one_ofRt/R+s"Admin account has a password set. sMYou must supply current_password in order to update the RO or Admin passwordsis:Passwords must not be greater than 30 characters in lengthtchangedsPassword Updated Successfullytpassword_settpasswordSettpassword_statustpasswordStatus(RtupdateRAtFalseRLR	tparamsRtendswithR9R=R.tlenRUt	exit_json(
R]R/R*R8RPRQRRR1R2R0tro_pwdt	admin_pwdtresult((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pytmain�sJ	









	
t__main__(!t
__future__RRRRWt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRRMtansible.module_utils.apiRtansible.module_utils.basicR	t+ansible.module_utils.six.moves.urllib.errorR
tansible.module_utils._textRtansible.module_utils.urlsRR-R!RLRgR)R9R=RFRURot__name__(((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auth.pyt<module>s8


8
			
&	2

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]