
    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#Vultr plugin for integration tests.    )annotationsN   )display)IntegrationConfig   )CloudEnvironmentCloudEnvironmentConfigCloudProviderc                  0     e Zd ZdZd fdZd fdZ xZS )VultrCloudProviderz[Checks if a configuration file has been passed or fixtures are going to be used for testingc                2    t         |   |       d| _        y )NT)super__init__uses_config)selfargs	__class__s     g/home/dcms/DCMS/lib/python3.12/site-packages/ansible_test/_internal/commands/integration/cloud/vultr.pyr   zVultrCloudProvider.__init__   s        c                B    t         |           | j                          y)zKSetup the cloud resource before delegation and register a cleanup callback.N)r   setup_use_static_config)r   r   s    r   r   zVultrCloudProvider.setup   s    !r   )r   r   returnNone)r   r   )__name__
__module____qualname____doc__r   r   __classcell__)r   s   @r   r   r      s    e 
" "r   r   c                      e Zd ZdZddZy)VultrCloudEnvironmentz_Updates integration test environment after delegation. Will setup the config file as parameter.c                "   t        j                         }|j                  | j                         t	        |j                  dd            }t        j                  j                  |d          t	        | j                        }t        ||      S )zRReturn environment configuration for use in the test environment after delegation.defaultkey)VULTR_API_KEYr%   )vultr_resource_prefix)env_varsansible_vars)configparserConfigParserreadconfig_pathdictgetr   	sensitiveaddresource_prefixr	   )r   parserr'   r(   s       r   get_environment_configz,VultrCloudEnvironment.get_environment_config'   s}    **,D$$% **Y6
 	h78"&"6"6
 &%
 	
r   N)r   r	   )r   r   r   r   r3    r   r   r!   r!   $   s
    i
r   r!   )r   
__future__r   r)   utilr   configr    r   r	   r
   r   r!   r4   r   r   <module>r9      s;    ) "  " "
, 
r   