Ë
    ÇVh9  ã                   óp   — 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  G d„ d«      Zd	„ Zed
k(  r e«        yy)é    )Úabsolute_importÚdivisionÚprint_functionad  
module: icinga2_feature

short_description: Manage Icinga2 feature
description:
  - This module can be used to enable or disable an Icinga2 feature.
author: "Loic Blot (@nerzhul)"
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  name:
    type: str
    description:
      - This is the feature name to enable or disable.
    required: true
  state:
    type: str
    description:
      - If set to V(present) and feature is disabled, then feature is enabled.
      - If set to V(present) and feature is already enabled, then nothing is changed.
      - If set to V(absent) and feature is enabled, then feature is disabled.
      - If set to V(absent) and feature is already disabled, then nothing is changed.
    choices: ["present", "absent"]
    default: present
zÐ
- name: Enable ido-pgsql feature
  community.general.icinga2_feature:
    name: ido-pgsql
    state: present

- name: Disable api feature
  community.general.icinga2_feature:
    name: api
    state: absent
z
#
N)ÚAnsibleModulec                   ó   — e Zd Zd„ Zd„ Zd„ Zy)ÚIcinga2FeatureHelperc                 ó¸   — || _         |j                  dd«      | _        | j                   j                  d   | _        | j                   j                  d   | _        y )NÚicinga2TÚnameÚstate)ÚmoduleÚget_bin_pathÚ_icinga2ÚparamsÚfeature_namer   )Úselfr   s     úu/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/icinga2_feature.pyÚ__init__zIcinga2FeatureHelper.__init__D   sJ   € ØˆŒØ×+Ñ+¨I°tÓ<ˆŒØ ŸK™K×.Ñ.¨vÑ6ˆÔØ—[‘[×'Ñ'¨Ñ0ˆ
ó    c                 ón   — | j                   dg}| j                  j                  ||z   d¬«      \  }}}||fS )NÚfeatureT)Úcheck_rc)r   r   Úrun_command)r   ÚargsÚcmdÚrcÚoutÚerrs         r   Ú_execzIcinga2FeatureHelper._execJ   s<   € Ø}‰}˜iÐ(ˆØ—{‘{×.Ñ.¨s°T©zÀDÐ.ÓI‰ˆˆCØ3ˆwˆr   c                 óÈ  — | j                  dg«      \  }}|dk7  r| j                  j                  d¬«       t        j                  d| j
                  z  |«      r| j                  dk(  s2t        j                  d| j
                  z  |«      r+| j                  dk(  r| j                  j                  d	¬
«       | j                  j                  r| j                  j                  d¬
«       | j                  dk(  rdnd}| j                  || j
                  g«      \  }}d	}| j                  dk(  rM|dk7  r/| j                  j                  d|›d| j
                  ›d|›¬«       t        j                  d|«      €Pd}nM|dk(  rd}nEt        j                  d| j
                  z  |«      rd	}n| j                  j                  d|z  ¬«       | j                  j                  |¬
«       y )NÚlistr   zXUnable to list icinga2 features. Ensure icinga2 is installed and present in binary path.)ÚmsgzDisabled features:.* %s[ 
]ÚabsentzEnabled features:.* %s[ 
]ÚpresentF)ÚchangedTÚenableÚdisablez
Failed to z	 feature z. icinga2 command returned zalready enabledz:Cannot disable feature '%s'. Target file .* does not existz-Failed to disable feature. Command returns %s)	r   r   Ú	fail_jsonÚreÚsearchr   r   Ú	exit_jsonÚ
check_mode)r   r   r   Úfeature_enable_strÚchange_applieds        r   ÚmanagezIcinga2FeatureHelper.manageO   s¯  € Ø—*‘*˜f˜XÓ&‰ˆˆCØŠ7ØK‰K×!Ñ!ð '`Ð!ô aô I‰IÐ4°t×7HÑ7HÑHÈ#ÔNÐSW×S]ÑS]ÐaiÒSiÜ—‘Ð8¸4×;LÑ;LÑLÈcÔRÐW[×WaÑWaÐenÒWnØK‰K×!Ñ!¨%Ð!Ô0à;‰;×!Ò!ØK‰K×!Ñ!¨$Ð!Ô/à)-¯©°yÒ)@™XÀiÐà—*‘*Ð0°$×2CÑ2CÐDÓE‰ˆˆCàˆØ:‰:˜Ò"ØQŠwØ—‘×%Ò%ÚL^ØLP×L]ÓL]ÙLOð+QÐ%ô Rô
 y‰yÐ*¨CÓ0Ð8Ø!%‘àQŠwØ!%‘ä—‘ÐWÐZ^×ZkÑZkÑkÐmpÔqØ!&‘à—‘×%Ñ%Ð*YÐ\_Ñ*_Ð%Ô`à‰×Ñ nÐÕ5r   N)Ú__name__Ú
__module__Ú__qualname__r   r   r/   © r   r   r   r   C   s   „ ò1òó
%6r   r   c            
      óÀ   — t        t        t        dd¬«      t        dddgd¬«      ¬«      d¬«      } t        d	d	d	d	¬
«      | _        t        | «      j	                  «        y )NÚstrT)ÚtypeÚrequiredr$   r#   )r6   ÚchoicesÚdefault)r   r   )Úargument_specÚsupports_check_modeÚC)ÚLANGÚLC_ALLÚLC_MESSAGESÚLC_CTYPE)r   ÚdictÚrun_command_environ_updater   r/   )r   s    r   ÚmainrC   w   s[   € ÜÜÜ˜5¨4Ô0Ü˜E¨I°xÐ+@È)ÔTô
ð !ô€Fô )-°#¸cÈsÐ]`Ô(a€FÔ%Ü˜Ó ×'Ñ'Õ)r   Ú__main__)Ú
__future__r   r   r   r6   Ú__metaclass__ÚDOCUMENTATIONÚEXAMPLESÚRETURNr)   Úansible.module_utils.basicr   r   rC   r0   r3   r   r   ú<module>rK      sT   ð÷ AÑ @Ø€ð€ð>
€ð
€ó 
Ý 4÷16ñ 16òh
*ð ˆzÒÙ…Fð r   