Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/modules/source_control/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyo

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZdZdefd��YZdefd��YZd�Zd�Zd�Zd�Zd�Zd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys}
module: github_key
short_description: Manage GitHub access keys.
description:
    - Creates, removes, or updates GitHub access keys.
version_added: "2.2"
options:
  token:
    description:
      - GitHub Access Token with permission to list and create public keys.
    required: true
  name:
    description:
      - SSH key name
    required: true
  pubkey:
    description:
      - SSH public key value. Required when C(state=present).
  state:
    description:
      - Whether to remove a key, ensure that it exists, or update its value.
    choices: ['present', 'absent']
    default: 'present'
  force:
    description:
      - The default is C(yes), which will replace the existing remote key
        if it's different than C(pubkey). If C(no), the key will only be
        set if no key with the given C(name) exists.
    type: bool
    default: 'yes'

author: Robert Estelle (@erydo)
sq
deleted_keys:
    description: An array of key objects that were deleted. Only present on state=absent
    type: list
    returned: When state=absent
    sample: [{'id': 0, 'key': 'BASE64 encoded key', 'url': 'http://example.com/github key', 'created_at': 'YYYY-MM-DDTHH:MM:SZ', 'read_only': False}]
matching_keys:
    description: An array of keys matching the specified name. Only present on state=present
    type: list
    returned: When state=present
    sample: [{'id': 0, 'key': 'BASE64 encoded key', 'url': 'http://example.com/github key', 'created_at': 'YYYY-MM-DDTHH:MM:SZ', 'read_only': False}]
key:
    description: Metadata about the key just created. Only present on state=present
    type: dict
    returned: success
    sample: {'id': 0, 'key': 'BASE64 encoded key', 'url': 'http://example.com/github key', 'created_at': 'YYYY-MM-DDTHH:MM:SZ', 'read_only': False}
s'
- name: Read SSH public key to authorize
  shell: cat /home/foo/.ssh/id_rsa.pub
  register: ssh_pub_key

- name: Authorize key with GitHub
  local_action:
    module: github_key
    name: Access Key for Some Machine
    token: '{{ github_access_token }}'
    pubkey: '{{ ssh_pub_key.stdout }}'
N(t
AnsibleModule(t	fetch_urlshttps://api.github.comtGitHubResponsecB`s#eZd�Zd�Zd�ZRS(cC`s|j�|_||_dS(N(treadtcontenttinfo(tselftresponseR
((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyt__init__\scC`stj|j�S(N(tjsontloadsR(R((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyR`scC`s\i}d|jkrX|jd}tjd|�}x!|D]\}}|||<q;Wn|S(Ntlinks<([^>]+)>; rel="([^"]+)"(R
tretfindall(Rtlinkstlink_headertmatchesturltrel((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyRcs
(t__name__t
__module__RRR(((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyR
[s		t
GitHubSessioncB`seZd�Zdd�ZRS(cC`s||_||_dS(N(tmodulettoken(RRR((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyRns	c	C`s�id|jd6dd6dd6}t|j|d|d|d	|�\}}d
|dkogdkns�|jjd
d|||d
f�nt||�S(Nstoken %st
Authorizationsapplication/jsonsContent-Typesapplication/vnd.github.v3+jsontAccepttmethodtdatatheadersi�Ri�tmsgs$ failed to send request %s to %s: %s(RR	Rt	fail_jsonR
(RR"RR#R$RR
((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pytrequestrs
' N(RRRtNoneR'(((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyRms	cC`s[td}g}xD|rV|jd|�}|j|j��|j�jd�}qW|S(Ns
/user/keystGETtnext(tAPI_BASER'textendRRtget(tsessionRtresulttr((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pytget_all_keys�s
	cC`s�|rcddlm}|j�}idd6|d6|d6dd6|j|d�d	6td
6td6S|jdtd
dtji|d6|d6��j�SdS(Ni(tdatetimetidtkeyttitles(http://example.com/CHECK_MODE_GITHUB_KEYRs%Y-%m-%dT%H:%M:%SZt
created_att	read_onlytverifiedtPOSTs
/user/keysR#(R2tutcnowtstrftimetFalseR'R+Rtdumps(R.tnametpubkeyt
check_modeR2tnow((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyt
create_key�s
cC`s;|r
dSx*|D]"}|jdtd|d�qWdS(NtDELETEs
/user/keys/%sR3(R'R+(R.t	to_deleteR@R4((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pytdelete_keys�s
cC`sZgt|�D]}|d|kr
|^q
}t||d|�it|�d6|d6S(NR5R@tchangedtdeleted_keys(R1REtbool(R.R>R@R4RD((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pytensure_key_absent�s/c
C`sZt|�}g|D]}|d|kr|^q}g}	|jd�d}
xa|D]Y}|djd�d}|
|krU|d|krU|jddj|d��qUqUW|r|r|ddjd�d|
krt||d|�|g}	}n|s#t|||d|�}n
|d}it|	p=|�d	6|	d
6|d6|d6S(NR5t iR4R%sLanother key with the same content is already registered under the name |{0}|iR@RFRGt
matching_keys(R1tsplitR&tformatRERBRH(
RR.R>R?tforceR@tall_keystkRKRGt
new_signatureR4texisting_signature((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pytensure_key_present�s*)
	-
c
	C`s�iitd6td6d6itd6d6id6iddgd6dd	6d
6itd	6dd6d
6}td|dt�}|jd}|jd}|jd
}|jd
}|jjd�}|r�|jd�}t|�dkr|jdd�qn|dkr|jdd�nt||�}|dkrYt||||d
|d|j	�}	n'|dkr�t
||d|j	�}	n|j|	�dS(Ntrequiredtno_logRR>R?tpresenttabsenttchoicestdefaulttstateRHttypeRNt
argument_spectsupports_check_modeRJiR%s("pubkey" parameter has an invalid formats'"pubkey" is required when state=presentR@(tTrueRtparamsR-RLtlenR&RRSR@RIt	exit_json(
R\RRR>RZRNR?tpubkey_partsR.R/((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pytmain�s6	



t__main__(t
__future__RRRR[t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtRETURNtEXAMPLESRRtansible.module_utils.basicRtansible.module_utils.urlsR	R+tobjectR
RR1RBRERIRSRcR(((sM/usr/lib/python2.7/site-packages/ansible/modules/source_control/github_key.pyt<module>s,


#
	
					%

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