
    Vh"                         d dl mZmZmZ eZdZdZdZd dl	Z	d dl
mZ d dlmZ d dlmZ d d	lmZ d
 Zedk(  r e        yy)    )absolute_importdivisionprint_functiona(  
module: honeybadger_deployment
author: "Benjamin Curtis (@stympy)"
short_description: Notify Honeybadger.io about app deployments
description:
  - Notify Honeybadger.io about app deployments (see U(http://docs.honeybadger.io/article/188-deployment-tracking)).
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  token:
    type: str
    description:
      - API token.
    required: true
  environment:
    type: str
    description:
      - The environment name, typically V(production), V(staging), and so on.
    required: true
  user:
    type: str
    description:
      - The username of the person doing the deployment.
  repo:
    type: str
    description:
      - URL of the project repository.
  revision:
    type: str
    description:
      - A hash, number, tag, or other identifier showing what revision was deployed.
  url:
    type: str
    description:
      - Optional URL to submit the notification to.
    default: "https://api.honeybadger.io/v1/deploys"
  validate_certs:
    description:
      - If V(false), SSL certificates for the target URL will not be validated. This should only be used on personally controlled
        sites using self-signed certificates.
    type: bool
    default: true
z
- name: Notify Honeybadger.io about an app deployment
  community.general.honeybadger_deployment:
    token: AAAAAA
    environment: staging
    user: ansible
    revision: b6826b8
    repo: 'git@github.com:user/repo.git'
#N)AnsibleModule)	urlencode)	to_native)	fetch_urlc                     t        t        t        dd      t        d      t        d      t        d      t        d      t        dd      t        dd      	      d
      } i }| j                  d   r| j                  d   |d<   | j                  d   r| j                  d   |d<   | j                  d   r| j                  d   |d<   | j                  d   r| j                  d   |d<   | j                  d   |d<   | j                  j                  d      }| j                  r| j                  d       	 t        |      }t        | ||      \  }}|d   dk(  r| j                  d       y | j                  d|d   |fz         y # t        $ r;}| j                  dt        |      z  t        j                                Y d }~y d }~ww xY w)NT)requiredno_log)r   Fz%https://api.honeybadger.io/v1/deploys)r   defaultbool)r   type)tokenenvironmentuserreporevisionurlvalidate_certs)argument_specsupports_check_moder   zdeploy[environment]r   zdeploy[local_username]r   zdeploy[repository]r   zdeploy[revision]r   api_keyr   )changed)datastatus   z%HTTP result code: %d connecting to %s)msgz Unable to notify Honeybadger: %s)r   	exception)r   dictparamsget
check_mode	exit_jsonr   r
   	fail_json	Exceptionr	   	traceback
format_exc)moduler"   r   r   responseinfoes          |/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/honeybadger_deployment.pymainr/   T   s   T2d+u%u%5)e-TU6:
 !F F}}]#(.m(D$%}}V+1==+@'(}}V'-}}V'<#$}}Z %+]]:%>!"g.F9
--

E
"C &	b "63T:$ >S T*!HDQYN\_K`!`a  r?)A,NZcZnZnZpqqrs   9F 	G1G

G__main__)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNr(   ansible.module_utils.basicr   +ansible.module_utils.six.moves.urllib.parser   +ansible.module_utils.common.text.convertersr	   ansible.module_utils.urlsr
   r/   __name__     r.   <module>r=      sS    A @/b 
  4 A A /.bb zF r<   