
    Vh]                    t    d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
mZ  G d	 d
e      Z G d de	      Zy)z"ACME plugin for integration tests.    )annotationsN   )IntegrationConfig)run_support_container   )CloudEnvironmentCloudEnvironmentConfigCloudProviderc                  @     e Zd ZdZd fdZd fdZddZddZ xZS )ACMEProviderz/ACME plugin. Sets up cloud resources for tests.c                    t         |   |       t        j                  j	                  d      r,t        j                  j	                  d      | _        d| _        y d| _        d| _        y )NANSIBLE_ACME_CONTAINERz)quay.io/ansible/acme-test-container:2.1.0T)super__init__osenvirongetimageuses_docker)selfargs	__class__s     f/home/dcms/DCMS/lib/python3.12/site-packages/ansible_test/_internal/commands/integration/cloud/acme.pyr   zACMEProvider.__init__   sT     ::>>23(@ADJ   EDJ    c                    t         |           | j                         r| j                          y| j	                          y)zKSetup the cloud resource before delegation and register a cleanup callback.N)r   setup_use_static_config_setup_static_setup_dynamic)r   r   s    r   r   zACMEProvider.setup#   s0    ""$ !r   c                    ddg}t        | j                  | j                  | j                  d|      }|sy| j	                  d|j
                         y)z*Create a ACME test container using docker.i  i6  zacme-simulatorN	acme_host)r   r   platformr   _set_cloud_configname)r   ports
descriptors      r   r   zACMEProvider._setup_dynamic,   sT     

 +IIMMJJ

 {JOO<r   c                    t               )N)NotImplementedError)r   s    r   r   zACMEProvider._setup_static@   s    !##r   )r   r   returnNone)r)   r*   )	__name__
__module____qualname____doc__r   r   r   r   __classcell__)r   s   @r   r   r      s    9	 "=($r   r   c                      e Zd ZdZddZy)ACMEEnvironmentzOACME environment plugin. Updates integration test environment after delegation.c                P    t        | j                  d            }t        |      S )zRReturn environment configuration for use in the test environment after delegation.r!   )r!   )ansible_vars)dict_get_cloud_configr	   )r   r3   s     r   get_environment_configz&ACMEEnvironment.get_environment_configG   s,    ,,[9
 &%
 	
r   N)r)   r	   )r+   r,   r-   r.   r6    r   r   r1   r1   D   s
    Y
r   r1   )r.   
__future__r   r   configr   
containersr    r   r	   r
   r   r1   r7   r   r   <module>r<      s<    ( " 	 ,$= ,$^
& 
r   