Server IP : 85.214.239.14 / Your IP : 3.142.55.138 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/ansible_test/_internal/commands/integration/cloud/ |
Upload File : |
"""ACME plugin for integration tests.""" from __future__ import annotations import os from ....config import ( IntegrationConfig, ) from ....containers import ( CleanupMode, run_support_container, ) from . import ( CloudEnvironment, CloudEnvironmentConfig, CloudProvider, ) class ACMEProvider(CloudProvider): """ACME plugin. Sets up cloud resources for tests.""" DOCKER_SIMULATOR_NAME = 'acme-simulator' def __init__(self, args: IntegrationConfig) -> None: super().__init__(args) # The simulator must be pinned to a specific version to guarantee CI passes with the version used. if os.environ.get('ANSIBLE_ACME_CONTAINER'): self.image = os.environ.get('ANSIBLE_ACME_CONTAINER') else: self.image = 'quay.io/ansible/acme-test-container:2.1.0' self.uses_docker = True def setup(self) -> None: """Setup the cloud resource before delegation and register a cleanup callback.""" super().setup() if self._use_static_config(): self._setup_static() else: self._setup_dynamic() def _setup_dynamic(self) -> None: """Create a ACME test container using docker.""" ports = [ 5000, # control port for flask app in container 14000, # Pebble ACME CA ] run_support_container( self.args, self.platform, self.image, self.DOCKER_SIMULATOR_NAME, ports, allow_existing=True, cleanup=CleanupMode.YES, ) self._set_cloud_config('acme_host', self.DOCKER_SIMULATOR_NAME) def _setup_static(self) -> None: raise NotImplementedError() class ACMEEnvironment(CloudEnvironment): """ACME environment plugin. Updates integration test environment after delegation.""" def get_environment_config(self) -> CloudEnvironmentConfig: """Return environment configuration for use in the test environment after delegation.""" ansible_vars = dict( acme_host=self._get_cloud_config('acme_host'), ) return CloudEnvironmentConfig( ansible_vars=ansible_vars, )