
    Vh                         d dl mZmZmZ eZdZdZd dlZdZ	dZ
	 d dlZdZ	d dlmZmZ d dlmZ d	 Zed
k(  r e        yy# e$ r  ej                         Z
Y 7w xY w)    )absolute_importdivisionprint_functiona  
module: selinux_permissive
short_description: Change permissive domain in SELinux policy
description:
  - Add and remove a domain from the list of permissive domains.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  domain:
    description:
      - The domain that will be added or removed from the list of permissive domains.
    type: str
    required: true
    aliases: [name]
  permissive:
    description:
      - Indicate if the domain should or should not be set as permissive.
    type: bool
    required: true
  no_reload:
    description:
      - Disable reloading of the SELinux policy after making change to a domain's permissive setting.
      - The default is V(false), which causes policy to be reloaded when a domain changes state.
      - Reloading the policy does not work on older versions of the C(policycoreutils-python) library, for example in EL 6.".
    type: bool
    default: false
  store:
    description:
      - Name of the SELinux policy store to use.
    type: str
    default: ''
notes:
  - Requires a recent version of SELinux and C(policycoreutils-python) (EL 6 or newer).
requirements: [policycoreutils-python]
author:
  - Michael Scherer (@mscherer) <misc@zarb.org>
z
- name: Change the httpd_t domain to permissive
  community.general.selinux_permissive:
    name: httpd_t
    permissive: true
NFT)AnsibleModulemissing_required_lib)	to_nativec                     t        t        t        dddg      t        dd      t        dd      t        dd	      
      d      } d	}| j                  d   }| j                  d   }| j                  d   }| j                  d   }t        s!| j	                  d	t        d      t               	 t        j                  |      }dt              v r|j                  |        	 |j                         }|r%|vrE| j                   s	 |j#                  |       d}n$|v r | j                   s	 |j%                  |       d}| j'                  ||||       y # t        $ r9}| j	                  |t        |      t        j                                Y d }~d }~ww xY w# t        $ r9}| j	                  |t        |      t        j                                Y d }~d }~ww xY w# t        $ r:}| j	                  |t        |      t        j                                Y d }~d }~ww xY w# t        $ r:}| j	                  |t        |      t        j                                Y d }~&d }~ww xY w)NstrTname)typerequiredaliases )r   defaultbool)r   r   F)domainstore
permissive	no_reload)argument_specsupports_check_moder   r   r   r   zpolicycoreutils-python)changedmsg	exception)r   r   r   
set_reload)r   r   r   r   )r   dictparamsHAVE_SEOBJECT	fail_jsonr   SEOBJECT_IMP_ERRseobjectpermissiveRecords
ValueErrorr   	traceback
format_excdirr   get_all
check_modeadddelete	exit_json)	moduler   r   r   r   r   permissive_domainseall_domainss	            x/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/selinux_permissive.pymainr1   L   sO   UTF8DE2.$76	
 !F GMM'"E|,J]]8$Fk*I,@AY,Z#3 	 	5\%77>
 s-..%%)m4\(002 $$$h&**62 G[ $$h&--f5 G
WE *6  ;;  \IaLIDXDXDZ[[\  \IaLIDXDXDZ[[\ " h$$F	!PYPdPdPf$ggh " h$$F	!PYPdPdPf$gghs`   /E $F G ,H% 	F/FF	G#/GG	H"(/HH"%	I(./I##I(__main__)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESr$   r   r    r!   ImportErrorr%   ansible.module_utils.basicr   r   +ansible.module_utils.common.text.convertersr   r1   __name__     r0   <module>r=      s    A @)V  .M K A6;r zF A  .+y++-.s   ? AA