
    Vh                     v    d dl mZmZmZ eZdZdZdZd dl	Z	d dl
Z
d dlmZ d dlmZ d Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona  
module: atomic_host
short_description: Manage the atomic host platform
description:
  - Manage the atomic host platform.
  - Rebooting of Atomic host platform should be done outside this module.
deprecated:
  removed_in: 13.0.0
  why: Project Atomic was sunset by the end of 2019.
  alternative: There is none.
author:
  - Saravanan KR (@krsacme)
notes:
  - Host should be an atomic platform (verified by existence of '/run/ostree-booted' file).
  - According to U(https://projectatomic.io/) the project has been sunset around 2019/2020, in favor of C(podman) and Fedora CoreOS.
requirements:
  - atomic
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: none
  diff_mode:
    support: none
options:
  revision:
    description:
      - The version number of the atomic host to be deployed.
      - Providing V(latest) will upgrade to the latest available version.
    default: 'latest'
    aliases: [version]
    type: str
a  
- name: Upgrade the atomic host platform to the latest version (atomic host upgrade)
  community.general.atomic_host:
    revision: latest

- name: Deploy a specific revision as the atomic host (atomic host deploy 23.130)
  community.general.atomic_host:
    revision: 23.130
zo
msg:
  description: The command standard output.
  returned: always
  type: str
  sample: 'Already on latest'
N)AnsibleModule)	to_nativec                 R   | j                   d   }| j                  dd      }t        ddd      | _        |dk(  r|dd	g}n|dd
|g}| j	                  |d      \  }}}|dk(  r|dk(  r| j                  dd       y |dk7  r| j                  ||       y | j                  |d       y )NrevisionatomicT)requiredC)LANGLC_ALLLC_MESSAGESlatesthostupgradedeployF)check_rcM   zAlready on latest)msgchangedr   )rcr   )paramsget_bin_pathdictrun_command_environ_updaterun_command	exit_json	fail_json)moduler	   
atomic_binargsr   outerrs          q/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/atomic_host.pycorer&   E   s    }}Z(H$$X$=J(,#cs(SF%8FI.FHh7%%dU%;LBS	RxH(0%@	qBC(S$/    c            	      L   t        t        t        dddg                  } t        j                  j	                  d      s| j                  d	       	 t        |        y # t        $ r8}| j                  t        |      t        j                         
       Y d }~y d }~ww xY w)Nstrr   version)typedefaultaliases)r	   )argument_specz/run/ostree-bootedz?Module atomic_host is applicable for Atomic Host Platforms only)r   )r   	exception)r   r   ospathexistsr   r&   	Exceptionr   	traceback
format_exc)r    es     r%   mainr7   Z   s    uhL
F 77>>./^_MV MYq\Y5I5I5KLLMs   A" "	B#+.BB#__main__)
__future__r   r   r   r+   __metaclass__DOCUMENTATIONEXAMPLESRETURNr0   r4   ansible.module_utils.basicr   +ansible.module_utils.common.text.convertersr   r&   r7   __name__ r'   r%   <module>rB      sV    A @ D
 
  4 A0*M" zF r'   