Ë
    Ç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: cobbler_sync
short_description: Sync Cobbler
description:
  - Sync Cobbler to commit changes.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  host:
    description:
      - The name or IP address of the Cobbler system.
    default: 127.0.0.1
    type: str
  port:
    description:
      - Port number to be used for REST connection.
      - The default value depends on parameter O(use_ssl).
    type: int
  username:
    description:
      - The username to log in to Cobbler.
    default: cobbler
    type: str
  password:
    description:
      - The password to log in to Cobbler.
    type: str
  use_ssl:
    description:
      - If V(false), an HTTP connection will be used instead of the default HTTPS connection.
    type: bool
    default: true
  validate_certs:
    description:
      - If V(false), SSL certificates will not be validated.
      - This should only set to V(false) when used on personally controlled sites using self-signed certificates.
    type: bool
    default: true
author:
  - Dag Wieers (@dagwieers)
todo:
notes:
  - Concurrently syncing Cobbler is bound to fail with weird errors.
  - On Python 2.7.8 and older (such as RHEL7) you may need to tweak the Python behaviour to disable certificate validation.
    More information at L(Certificate verification in Python standard library HTTP clients,https://access.redhat.com/articles/2039753).
zº
- name: Commit Cobbler changes
  community.general.cobbler_sync:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
  run_once: true
  delegate_to: localhost
z
# Default return values
N)ÚAnsibleModule)Úxmlrpc_client)Úto_text)Únowc                  óN  — t        t        t        dd¬«      t        d¬«      t        dd¬«      t        dd¬«      t        d	d¬«      t        d	d¬«      ¬
«      d¬«      } | j                  d   }| j                  d   }| j                  d   }| j                  d   }| j                  d   }|rdnd| j                  d<   |s|rdnd| j                  d<   t        d¬«      }t        «       }d }|s.	 t	        j
                  «       }t        j
                  t        _         dj                  d i | j                  ¤Ž}	|rt        j                  |	|¬«      }
nt        j                  |	«      }
	 |
j                  ||«      }| j"                  s	 |
j%                  «       t        «       |z
  } | j&                  d d|j(                  i|¤Ž y # t        $ r Y Œ³w xY w# t        j                  $ rB}| j                   dj                  d |	t        |«      dœ| j                  ¤Ž¬«       Y d }~Œ©d }~wt         $ r6}| j                  dj                  |	t        |«      ¬«      ¬«       Y d }~Œæd }~ww xY w# t         $ r6}| j                  dj                  t        |«      ¬«      ¬«       Y d }~Œ
d }~ww xY w)!NÚstrz	127.0.0.1)ÚtypeÚdefaultÚint)r   ÚcobblerT)r   Úno_logÚbool)ÚhostÚportÚusernameÚpasswordÚuse_sslÚvalidate_certs)Úargument_specÚsupports_check_moder   r   r   r   r   ÚhttpsÚhttpÚprotoÚ443Ú80)Úchangedz#{proto}://{host}:{port}/cobbler_api)Úcontextz<Failed to log in to Cobbler '{url}' as '{username}'. {error})ÚurlÚerror)Úmsgz%Connection to '{url}' failed. {error}zFailed to sync Cobbler. {error})r"   Úelapsed© )r   ÚdictÚparamsr	   ÚsslÚ_create_unverified_contextÚ_create_default_https_contextÚAttributeErrorÚformatr   ÚServerProxyÚServerÚloginÚFaultÚ	fail_jsonr   Ú	ExceptionÚ
check_modeÚsyncÚ	exit_jsonÚseconds)Úmoduler   r   r   r   r   ÚresultÚstartÚssl_contextr!   ÚconnÚtokenÚer$   s                 úr/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/cobbler_sync.pyÚmainr?   X   s˜  € ÜÜÜ˜5¨+Ô6Ü˜5Ô!Ü˜u¨iÔ8Ü˜u¨TÔ2Ü˜f¨dÔ3Ü V°TÔ:ô
ð !ô
€Fð }‰}˜ZÑ(€HØ}‰}˜ZÑ(€HØ=‰=˜Ñ €DØm‰m˜IÑ&€GØ—]‘]Ð#3Ñ4€Ná(/™W°V€F‡MM'ÑÙÙ)0¡°dˆ‰fÑäØô€Fô ‹E€Eà€KÙð	OÜ×8Ñ8Ó:ˆKô 14×0NÑ0NŒCÔ-à
6Ð
/×
6Ñ
6Ñ
G¸¿¹Ñ
G€CÙÜ×(Ñ(¨°kÔB‰ä×#Ñ# CÓ(ˆðhØ—
‘
˜8 XÓ.ˆð ×Òð	]ØI‰IeÔô ‹ee‰m€GØ€F×ÑÑ7˜WŸ_™_Ð7°Ó7øô7 ò 	áð	ûô ×Ñò PØ×ÑÐbÐ[×bÑbð  OÐgjÔryÐz{Ór|ñ  Oð  AG÷  ANñ  ANñ  OÐ÷  	Pñ  	PûÜò hØ×ÑÐD×KÑKÐPSÔ[bÐcdÓ[eÐKÓfÐ×gÑgûðhûô ò 	]Ø×ÑÐ!B×!IÑ!IÔPWÐXYÓPZÐ!IÓ![Ð×\Ò\ûð	]úsN   Ã,G Å%G ÆI% Ç	GÇGÇI"Ç#8H È I"È,,IÉI"É%	J$É.+JÊJ$Ú__main__)Ú
__future__r   r   r   r   Ú__metaclass__ÚDOCUMENTATIONÚEXAMPLESÚRETURNr(   Úansible.module_utils.basicr   Úansible.module_utils.six.movesr   Ú+ansible.module_utils.common.text.convertersr   ÚCansible_collections.community.general.plugins.module_utils.datetimer	   r?   Ú__name__r%   ó    r>   ú<module>rL      sV   ð÷ AÑ @Ø€ð2€ðh€ð
€ó å 4Ý 8Ý ?õò
<8ð~ ˆzÒÙ…Fð rK   