o nnh @sJddlmZdZdZddlmZddlmZddZe dkr#ed Sd S) ) annotationsa --- module: dpkg_selections short_description: Dpkg package selection selections description: - Change dpkg package selection state via --get-selections and --set-selections. version_added: "2.0" author: - Brian Brazil (@brian-brazil) options: name: description: - Name of the package. required: true type: str selection: description: - The selection state to set the package to. choices: [ 'install', 'hold', 'deinstall', 'purge' ] required: true type: str extends_documentation_fragment: - action_common_attributes attributes: check_mode: support: full diff_mode: support: full platform: support: full platforms: debian notes: - This module will not cause any packages to be installed/removed/purged, use the M(ansible.builtin.apt) module for that. z - name: Prevent python from being upgraded ansible.builtin.dpkg_selections: name: python selection: hold - name: Allow python to be upgraded ansible.builtin.dpkg_selections: name: python selection: install ) AnsibleModule)get_best_parsable_localec Cstttddtgdddddd}|dd}t|}t||||d}||_|jd }|jd }|j|d |gdd \}}}d |vrN|jd||fdn |sSd} n|d} | |k} |j sb| sj|j | | |d|j|dgd||fdd|j | | |ddS)NT)required)installhold deinstallpurge)choicesr)name selection) argument_specsupports_check_modedpkg)LANGLC_ALL LC_MESSAGESLC_CTYPEr r z--get-selections)check_rczno packages found matchingz6Failed to find package '%s' to perform selection '%s'.)msgz not present)changedbeforeafterz--set-selectionsz%s %s)datar) rdict get_bin_pathrrun_command_environ_updateparams run_command fail_jsonsplit check_mode exit_json) modulerlocaleDPKG_ENVr r rcouterrcurrentrr+J/usr/local/lib/python3.10/dist-packages/ansible/modules/dpkg_selections.pymain;s0     r-__main__N) __future__r DOCUMENTATIONEXAMPLESansible.module_utils.basicr"ansible.module_utils.common.localerr-__name__r+r+r+r,s " $