
    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 Zedk(  r e        y	y	)
    )absolute_importdivisionprint_functionaw  
module: bootc_manage
version_added: 9.3.0
author:
  - Ryan Cook (@cooktheryan)
short_description: Bootc Switch and Upgrade
description:
  - This module manages the switching and upgrading of C(bootc).
options:
  state:
    description:
      - Control whether to apply the latest image or switch the image.
      - B(Note:) This will not reboot the system.
      - Please use M(ansible.builtin.reboot) to reboot the system.
    required: true
    type: str
    choices: ['switch', 'latest']
  image:
    description:
      - The image to switch to.
      - This is required when O(state=switch).
    required: false
    type: str
ah  
# Switch to a different image
- name: Provide image to switch to a different image and retain the current running image
  community.general.bootc_manage:
    state: switch
    image: "example.com/image:latest"

# Apply updates of the current running image
- name: Apply updates of the current running image
  community.general.bootc_manage:
    state: latest

)AnsibleModule)get_best_parsable_localec                     t        t        ddddg      t        dd            } t        | d	dd
gfg      }|j                  d	   }|j                  d
   }|dk(  rdd|dg}n	|dk(  rddg}t        |      }t        |||||      |_        |j                  d      \  }}}d|v rd|d}	 |j                  di |	 y d|v sd|v rd|d}	 |j                  di |	 y d|d}	 |j                  dddi|	 y )NstrTswitchlatest)typerequiredchoicesF)r   r   )stateimager   r   )argument_specrequired_ifbootcz--retainupgrade)LANGLC_ALLLC_MESSAGESLC_CTYPELANGUAGE)check_rczQueued for next boot: )changedstdoutzNo changes in z!Image specification is unchanged.)r   stderrmsgz ERROR: Command execution failed. )dictr   paramsr   run_command_environ_updaterun_command	exit_json	fail_json)
r   moduler   r   commandlocalercr   errresults
             r/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/bootc_manage.pymainr.   9   s?   x6JK.M #h	*
F MM'"EMM'"EHeZ8	(	I&%f-F(,&U[flw}(~F%((4(@OB6)!V4"6"	V	#'Jf'T"f5"6""c2J?J6J    __main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   "ansible.module_utils.common.localer   r.   __name__r    r/   r-   <module>r9      sK    C B2
 5 G KF zF r/   