
    VhB              	      f   d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	 ddl
mZ ddlmZ dd	lmZ d
dlmZmZmZ dZi dde dde dddde ddddg ddddddddddd d!dd"de d#d$d%d&d'd(d)d*dddddd+dd,d-Zd.j-                         Z G d/ d0e      Z G d1 d2e      Zy)3z5Galaxy (ansible-galaxy) plugin for integration tests.    )annotationsN   )IntegrationConfig)docker_cp_todocker_exec)run_support_container)to_text)display   )CloudEnvironmentCloudEnvironmentConfigCloudProviderzgalaxy-pulpPULP_CONTENT_ORIGINhttp://PULP_ANSIBLE_API_HOSTNAMEPULP_GALAXY_API_PATH_PREFIX/api/galaxy/PULP_ANSIBLE_CONTENT_HOSTNAMEz2/pulp/content/api/galaxy/v3/artifacts/collections/PULP_CONTENT_PATH_PREFIX"PULP_GALAXY_AUTHENTICATION_CLASSES)z3rest_framework.authentication.SessionAuthenticationz1rest_framework.authentication.TokenAuthenticationz1rest_framework.authentication.BasicAuthenticationz)django.contrib.auth.backends.ModelBackend$PULP_GALAXY_REQUIRE_CONTENT_APPROVALtruePULP_GALAXY_DEPLOYMENT_MODE
standalone!PULP_GALAXY_AUTO_SIGN_COLLECTIONSfalse&PULP_GALAXY_COLLECTION_SIGNING_SERVICEzansible-defaultPULP_RH_ENTITLEMENT_REQUIREDinsightsPULP_TOKEN_AUTH_DISABLEDPULP_TOKEN_SERVERz/token/PULP_TOKEN_SIGNATURE_ALGORITHMES256PULP_PUBLIC_KEY_PATHz7/src/galaxy_ng/dev/common/container_auth_public_key.pemPULP_PRIVATE_KEY_PATHz8/src/galaxy_ng/dev/common/container_auth_private_key.pemPULP_ANALYTICS/password)4PULP_GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_ACCESS6PULP_GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_DOWNLOADPULP_GALAXY_ENABLE_LEGACY_ROLES1PULP_GALAXY_FEATURE_FLAGS__execution_environments#PULP_SOCIAL_AUTH_LOGIN_REDIRECT_URL(PULP_GALAXY_FEATURE_FLAGS__ai_deny_indexPULP_DEFAULT_ADMIN_PASSWORDsJ  
[galaxy-importer]
ansible_local_tmp=~/.ansible/tmp
ansible_test_local_image=false
check_required_tags=false
check_runtime_yaml=false
check_changelog=false
infra_osd=false
local_image_docker=false
log_level_main=INFO
require_v1_or_greater=false
run_ansible_doc=false
run_ansible_lint=false
run_ansible_test=false
run_flake8=false
c                  0     e Zd ZdZd fdZd fdZ xZS )GalaxyProviderz
    Galaxy plugin. Sets up pulp (ansible-galaxy) servers for tests.
    The pulp source itself resides at: https://github.com/pulp/pulp-oci-images
    c                |    t         |   |       t        j                  j	                  dd      | _        d| _        y )NANSIBLE_PULP_CONTAINERzquay.io/pulp/galaxy:4.7.1T)super__init__osenvirongetimageuses_docker)selfargs	__class__s     h/home/dcms/DCMS/lib/python3.12/site-packages/ansible_test/_internal/commands/integration/cloud/galaxy.pyr5   zGalaxyProvider.__init__`   s4    ZZ^^$'


      c                ~   t         	|           t        j                  d      5 }dj	                  d t
        j                         D              }|j                  |       |j                          t        j                  d| d       t        | j                  | j                  | j                  t        dgt        gd	d
|j                   g      }ddd       sydt"        dfg}|D ]  \  }}}t        j                         5 }|j                  |       |j                          t        j                  d| dt%        |       d       t'        | j                  |j(                  ddt*        j,                  j/                  |      gd	       t1        | j                  |j(                  |j                   |       t'        | j                  |j(                  dd|gd	       ddd        | j3                  dt               | j3                  dd       | j3                  dd       y# 1 sw Y   TxY w# 1 sw Y   RxY w)z@Setup cloud resource before delegation and reg cleanup callback.zw+)mode
c              3  0   K   | ]  \  }}| d |   yw)=N ).0keyvalues      r>   	<genexpr>z'GalaxyProvider.setup.<locals>.<genexpr>o   s$      !%/S%3%q !s   z>>> galaxy_ng Configuration
   )	verbosityP   Tz
--env-file)aliasesstartoptionsNz(/etc/galaxy-importer/galaxy-importer.cfgzgalaxy-importerz>>> z Configuration
mkdirz-pchownz	pulp:pulp	PULP_HOST	PULP_USERadminPULP_PASSWORDr(   )r4   setuptempfileNamedTemporaryFilejoinSETTINGSitemswriteflushr
   infor   r<   platformr9   GALAXY_HOST_NAMEnameGALAXY_IMPORTERr	   r   container_idr6   pathdirnamer   _set_cloud_config)
r;   env_fdsettings
descriptorinjected_filesrd   contentfriendly_nametemp_fdr=   s
            r>   rV   zGalaxyProvider.setupj   s   ((d3 	vyy !3;>>3C! H LL"LLNLL8
CqQ.		

  %  &++J	0  8J[\
 -; 	d(D'=,,. d'g&tM?2B77CSBTUabcDIIz'>'>$PRPWPWP_P_`dPe@fhlmTYY
(?(?tTDIIz'>'>+W[@\^bcd d	d 	{,<={G4
;S	 	>d ds   B-H%CH2%H/2H<	)r<   r   returnNone)rn   ro   )__name__
__module____qualname____doc__r5   rV   __classcell__)r=   s   @r>   r1   r1   Z   s    
 -< -<r?   r1   c                      e Zd ZdZddZy)GalaxyEnvironmentzQGalaxy environment plugin. Updates integration test environment after delegation.c                   t        | j                  d            }t        | j                  d            }| j                  d      }t        t        ||d| d| dd| d      t        ||d| dd| d	      
      S )zRReturn environment configuration for use in the test environment after delegation.rS   rU   rR   r   z/pulp_ansible/galaxy/r   )	pulp_userpulp_passwordpulp_apipulp_servergalaxy_ng_serverz/pulp_ansible/galaxy/api/)rS   rU   PULP_SERVERGALAXY_NG_SERVER)ansible_varsenv_vars)str_get_cloud_configr   dict)r;   rx   ry   	pulp_hosts       r>   get_environment_configz(GalaxyEnvironment.get_environment_config   s    ..{;<	D22?CD**;7	%#+"9+.%i[0EF#*9+\!B #+%i[0IJ#*9+\!B	
 	
r?   N)rn   r   )rp   rq   rr   rs   r   rE   r?   r>   rv   rv      s
    [
r?   rv   )rs   
__future__r   r6   rW   configr   docker_utilr   r   
containersr   encodingr	   utilr
    r   r   r   r`   rZ   striprb   r1   rv   rE   r?   r>   <module>r      s   ; " 	 
  ! !W%5$67!7+;*<!=! ">! $w/?.@@r%s!  T! ) +! +F!  "<!!" (#!$ -.?%!& #J'!( )!* 7#3"4G<+!, %g-!. U/!0 W1!2 g3!4 =C>D'-9@+.06#-A!H 
EG $=<] =<@
( 
r?   