
    f              
          U d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZmZ ddlmZ d	Zd
ddeg de ed      gdgdZeed<    ee      Z  ej$                  e      ZddgZdgZdZd ZeddfdZdede	dededdf
dZy)z*Spacewalk: Install and configure spacewalk    N)dedent)subp)Cloud)Config)
MetaSchemaget_meta_doc)PER_INSTANCEa  This module installs spacewalk and applies basic configuration. If the
``spacewalk`` config key is present spacewalk will be installed. The server to
connect to after installation must be provided in the ``server`` in spacewalk
configuration. A proxy to connect through and a activation key may optionally
be specified.

For more information about spacewalk see: https://fedorahosted.org/spacewalk/
cc_spacewalk	SpacewalkzInstall and configure spacewalk)rhelfedora	openeulerz            spacewalk:
              server: <url>
              proxy: <proxy host>
              activation_key: <key>
            	spacewalk)idnametitledescriptiondistros	frequencyexamplesactivate_by_schema_keysmetaredhatr   z	rhn-setupz'/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERTc                      d} 	 t        j                   ddgd       d} | S # t         j                  $ r}|j                  dk7  r Y d }~| S d }~ww xY w)NFzrhn-profile-syncz	--verbosecaptureT   )r   ProcessExecutionError	exit_code)already_registeredes     ?/usr/lib/python3/dist-packages/cloudinit/config/cc_spacewalk.pyis_registeredr#   4   sc     		%{3UC!  %% ;;! s   ! AA

Ac                 ~   t         j                  d||        dg}|j                  dd| z  g       |j                  dt        |      g       |r|j                  dt        |      g       |r|j                  dt        |      g       |r|j                  dt        |      g       t	        j                  |d	
       y )Nz;Registering using `rhnreg_ks` profile '%s' into server '%s'	rhnreg_ksz--serverUrlzhttps://%s/XMLRPCz--profilenamez--proxyz--sslCACertz--activationkeyFr   )LOGinfoextendstrr   )serverprofile_nameca_cert_pathproxyactivation_keycmds         r"   do_registerr0   B   s     HHE
 -CJJ2V;<=JJ\!234

Is5z*+

M3|#456

%s>':;<IIc5!    r   cfgcloudargsreturnc                    d|vrt         j                  d|        y |d   }|j                  d      }|r||j                  j	                  t
               t               sRt        ||j                  j                  d      j                  |j                  d      |j                  d             y y t         j                  d	|        y )
Nr   z=Skipping module named %s, no 'spacewalk' key in configurationr*   T)fqdnr-   r.   )r-   r.   zOSkipping module named %s, 'spacewalk/server' key was not found in configuration)r&   debuggetdistroinstall_packagesrequired_packagesr#   r0   
datasourceget_hostnamehostname)r   r2   r3   r4   spacewalk_servers        r"   handlerA   Z   s    #		K	
 	
k
Cwwx(%%&78   --4-8AAggg&"ww'78	  			.	
r1   )__doc__loggingtextwrapr   	cloudinitr   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   r   cloudinit.settingsr	   MODULE_DESCRIPTIONr   __annotations__	getLogger__name__r&   r   r<   def_ca_cert_pathr#   r0   r)   listrA    r1   r"   <module>rQ      s    0    ! # < +  .%.	
	 !,}#j ( t
g! X
 M < " "
"0
 
6 
% 
t 
 
r1   