Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/remote_management/cpm/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_plugcontrol.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZmZmZddlmZmZddlmZmZmZd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: cpm_plugcontrol
version_added: "2.8"
author: "Western Telematic Inc. (@wtinetworkgear)"
short_description: Get and Set Plug actions on WTI OOB and PDU power devices
description:
    - "Get and Set Plug actions on WTI OOB and PDU devices"
options:
  cpm_action:
    description:
      - This is the Action to send the module.
    required: true
    choices: [ "getplugcontrol", "setplugcontrol" ]
  cpm_url:
    description:
      - This is the URL of the WTI device  to send the module.
    required: true
  cpm_username:
    description:
      - This is the Username of the WTI device to send the module.
  cpm_password:
    description:
      - This is the Password of the WTI device to send the module.
  use_https:
    description:
      - Designates to use an https connection or http connection.
    required: false
    type: bool
    default: true
  validate_certs:
    description:
      - If false, SSL certificates will not be validated. This should only be used
      - on personally controlled sites using self-signed certificates.
    required: false
    type: bool
    default: true
  use_proxy:
    description: Flag to control if the lookup will observe HTTP proxy environment variables when present.
    required: false
    type: bool
    default: false
  plug_id:
    description:
      - This is the plug number or the plug name that is to be manipulated
        For the plugget command, the plug_id 'all' will return the status of all the plugs the
        user has rights to access.
    required: true
  plug_state:
    description:
      - This is what action to take on the plug.
    required: false
    choices: [ "on", "off", "boot", "default" ]
so
# Get Plug status for all ports
- name: Get the Plug status for ALL ports of a WTI device
  cpm_plugcontrol:
    cpm_action: "getplugcontrol"
    cpm_url: "rest.wti.com"
    cpm_username: "restpower"
    cpm_password: "restfulpowerpass12"
    use_https: true
    validate_certs: true
    plug_id: "all"

# Get Plug status for port 2
- name: Get the Plug status for the given port of a WTI device
  cpm_plugcontrol:
    cpm_action: "getplugcontrol"
    cpm_url: "rest.wti.com"
    cpm_username: "restpower"
    cpm_password: "restfulpowerpass12"
    use_https: true
    validate_certs: false
    plug_id: "2"

# Reboot plug 5
- name: Reboot Plug 5 on a given WTI device
  cpm_plugcontrol:
    cpm_action: "setplugcontrol"
    cpm_url: "rest.wti.com"
    cpm_username: "restpower"
    cpm_password: "restfulpowerpass12"
    use_https: true
    plug_id: "5"
    plug_state: "boot"
sk
data:
    description: The output JSON returned from the commands sent
    returned: always
    type: str
N(t
AnsibleModule(tto_texttto_bytest	to_native(t	HTTPErrortURLError(topen_urltConnectionErrortSSLValidationErrorcC`s�d}|jdjd�}x�|D]�}|j�tkrTd|t|�f}nd|t|�f}|jddk	r�d|t|jd�f}nd|}q#W|S(	Nttplug_idt,s%s{"plug": "%s"s%s{"plugname": "%s"t
plug_states%s,"state": "%s"s%s}(tparamstsplittisdigittTrueRtNone(t	cpmmodulet	cpmresultt	json_loadtplugspassedtval((sY/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_plugcontrol.pyt
assemble_json�s
 cC`s�tdtdddgdt�dtdddt�d	tdddt�d
tdddtdt�dtdddt�d
tdddddgdt�dtdddt�dtdddt�dtdddt��	}tdtdd�}td|dt�}|jr|Sttjtdj	t
|jd	�t
|jd
��dd���}|jdtkrxd}nd}d}|jddkr�d |t
|jd�f}|jdj
�d!kr�d"|t
|jd�f}nd#}nH|jddkr>t||�}d |t
|jd�f}d$}nygt|d|d%|d|jdd|jdd&id'd(6d)|d*6�}|d#kr�t|d<nWntk
r�}	td+d,j	|t
|	��dt�}
|j|
�n�tk
r4}	td+d-j	|t
|	��dt�}
|j|
�n�tk
rz}	td+d.j	|t
|	��dt�}
|j|
�nGtk
r�}	td+d/j	|t
|	��dt�}
|j|
�nXtj|j��|d<|j|�dS(0Nt
cpm_actiontchoicestgetplugcontroltsetplugcontroltrequiredtcpm_urlttypetstrtcpm_usernametcpm_passwordtno_logRRtontofftboottdefaultt	use_httpstbooltvalidate_certst	use_proxytchangedtdataRt
argument_spectsupports_check_modes{0}:{1}terrorstsurrogate_or_strictshttps://shttp://s%s%s/api/v2/config/powerplugtalls
%s?plug=%stGETtPOSTtmethodtheaderssapplication/jsonsContent-TypesBasic %st
Authorizationtmsgs!Received HTTP error for {0} : {1}sFailed lookup url for {0} : {1}s6Error validating the servers certificate for {0} : {1}s"Error connecting to  for {0} : {1}(tdictRtFalseRt
check_modeR	tbase64t	b64encodeR
tformatRRRtlowerRRRt	fail_jsonR
RRtjsontloadstreadt	exit_json(tmodule_argstresulttmoduletauthtprotocoltPayloadtfullurlR<tresponseteRG((sY/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_plugcontrol.pyt
run_module�sd!		8	 		/''''cC`st�dS(N(RU(((sY/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_plugcontrol.pytmain�st__main__(t
__future__RRRR&t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRCRHtansible.module_utils.basicRtansible.module_utils._textR	R
Rt+ansible.module_utils.six.moves.urllib.errorRR
tansible.module_utils.urlsRRRRRURVt__name__(((sY/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_plugcontrol.pyt<module>s&

8#		E	

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