Ë
    ÇVh”  ã                   ó€   — d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZ d dlmZmZmZmZmZmZ d„ Zed	k(  r e«        y
y
)é    )Úabsolute_importÚdivisionÚprint_functionaÔ  
---
module: mongodb_shutdown
short_description: Cleans up all database resources and then terminates the mongod/mongos process.
description:
  - Cleans up all database resources and then terminates the process.
author: Rhys Campbell (@rhysmeister)
version_added: "1.0.0"

extends_documentation_fragment:
  - community.mongodb.login_options
  - community.mongodb.ssl_options

options:
  force:
    description:
      - Specify true to force the mongod to shut down.
      - Force shutdown interrupts any ongoing operations on the mongod and may result in unexpected behavior.
    type: bool
    default: false
  timeout:
    description:
    - The number of seconds the primary should wait for a secondary to catch up.
    type: int
    default: 10
notes:
- Requires the pymongo Python package on the remote host, version 4+.. This
  can be installed using pip or the OS package manager.
  @see U(http://api.mongodb.org/python/current/installation.html)
requirements:
  - pymongo
zÎ
- name: Attempt to perform a clean shutdown
  community.mongodb.mongodb_shutdown:

- name: Force shutdown with a timeout of 60 seconds
  community.mongodb.mongodb_shutdown:
    force: true
    timeout: 60
a  
changed:
  description: Whether the member was shutdown.
  returned: success
  type: bool
msg:
  description: A short description of what happened.
  returned: success
  type: str
failed:
  description: If something went wrong
  returned: failed
  type: bool
)ÚAnsibleModule)Ú	to_native)Úmissing_required_libÚmongodb_common_argument_specÚ
mongo_authÚPYMONGO_IMP_ERRÚpymongo_foundÚget_mongodb_clientc                  ó‚  — t        «       } | j                  t        dd¬«      t        dd¬«      ¬«       t        | ddd	gg¬
«      }	 ddlm} t        s |j                  t        d«      t        ¬«       |j                  d   }|j                  d   }t        d¬«      }	 t        |d¬«      }t        ||d¬«      }	  dd|fd|fg«      }d   j#                  |«       d|d<   d|d<    |j(                  di |¤Ž y # t        $ rF}	 ddlm} n4# t        $ r(}|j                  dt        |«      z  ¬«       Y d }~nd }~ww xY wY d }~Œ÷d }~ww xY w# t         $ r(}|j                  dt        |«      z  ¬«       Y d }~Œ¿d }~ww xY w# t         $ r6}dt%        |«      v rd|d<   d|d<   ndj'                  |«      |d<   Y d }~ŒÓd }~ww xY w)NÚboolF)ÚtypeÚdefaultÚinté
   )ÚforceÚtimeoutTÚ
login_userÚlogin_password)Úargument_specÚsupports_check_modeÚrequired_togetherr   )ÚOrderedDictz[Cannot import OrderedDict class. You can probably install with: pip install ordereddict: %s)ÚmsgÚpymongo)r   Ú	exceptionr   r   )Úchanged)ÚdirectConnectionz Unable to connect to MongoDB: %s)Úshutdowné   ÚtimeoutSecsÚadminr   z)mongod process was terminated sucessfullyr   zconnection closedzAn error occurred: {0}© )r	   ÚupdateÚdictr   Úcollectionsr   ÚImportErrorÚordereddictÚ	fail_jsonr   r   r   r   Úparamsr   r
   Ú	ExceptionÚcommandÚstrÚformatÚ	exit_json)	r   Úmoduler   Úexcepr   r   ÚresultÚclientÚcmd_docs	            úv/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/mongodb/plugins/modules/mongodb_shutdown.pyÚmainr8   P   só  € Ü0Ó2€MØ×ÑÜ˜¨Ô.Ü˜%¨Ô,ð ô ô Ø#Ø Ø(Ð*:Ð;Ð<ô€Fð1Ý+õ Ø×ÑÔ1°)Ó<Ü#2ð 	ô 	4ð M‰M˜'Ñ"€EØm‰m˜IÑ&€GäØô€FðTÜ# F¸TÔBˆÜ˜F F¸TÔBˆðCÙØØeÐØ˜GÐ$ð
ó ˆð
 	ˆw‰×Ñ Ô(Ø ˆˆyÑØCˆˆu‰ð €F×ÑÑvÓøôQ ò 1ð	1Þ/øÜò 	1Ø×ÑÐ!~Ü(¨Ó/ñ"0Ð÷ 1ñ 1ûð	1ÿûð1ûô* ò TØ×ÑÐ?Ä)ÈEÓBRÑRÐ×SÑSûðTûô ò CØ¤# e£*Ñ,Ø $ˆF9ÑØGˆF5ŠMà4×;Ñ;¸EÓBˆF5‰MÿøðCúsl   ÁC9 ÂE Â9-E? Ã9	EÄD
Ä	EÄ
	D;ÄD6Ä1EÄ6D;Ä;EÅEÅ	E<ÅE7Å7E<Å?	F>Æ,F9Æ9F>Ú__main__N)Ú
__future__r   r   r   r   Ú__metaclass__ÚDOCUMENTATIONÚEXAMPLESÚRETURNÚansible.module_utils.basicr   Úansible.module_utils._textr   ÚIansible_collections.community.mongodb.plugins.module_utils.mongodb_commonr   r	   r
   r   r   r   r8   Ú__name__r%   ó    r7   ú<module>rD      sU   ð÷ AÑ @Ø€ð€ðB€ð
€õ 5Ý 0÷÷ ò6ðr ˆzÒÙ…Fð rC   