3
\me
@ s U d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ddl
mZmZ ddl
mZ d Zd
dded
ddgeedgdgdZeeeZ ejeZddgZdgZdZdd ZeddfddZee eeddddZdS )z*Spacewalk: Install and configure spacewalk N)dedent)subp)Cloud)Config)
MetaSchemaget_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/
Zcc_spacewalkZ SpacewalkzInstall and configure spacewalkZrhelZfedoraZ openeulerz spacewalk:
server:
proxy:
activation_key:
spacewalk)idnametitledescriptiondistrosZ frequencyZexamplesZactivate_by_schema_keysZredhatz rhn-setupz'/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERTc C sT d} yt j ddgdd d} W n0 t jk
rN } z|jdkr> W Y d d }~X nX | S )NFzrhn-profile-syncz --verbose)captureT )r ZProcessExecutionErrorZ exit_code)Zalready_registerede r "/usr/lib/python3.6/cc_spacewalk.py
is_registered4 s
r c C s t jd|| dg}|jdd| g |jdt|g |rN|jdt|g |rd|jdt|g |rz|jdt|g tj|d d
d S )Nz;Registering using `rhnreg_ks` profile '%s' into server '%s'Z rhnreg_ksz--serverUrlzhttps://%s/XMLRPCz
--profilenamez--proxyz--sslCACertz--activationkeyF)r )LOGinfoextendstrr )serverZprofile_nameZca_cert_pathproxyactivation_keycmdr r r do_registerB s r )r cfgcloudargsreturnc C sz d|krt jd| d S |d }|jd}|rj|jjt t svt||jj ddj
|jd|jdd nt jd | d S )
Nr z=Skipping module named %s, no 'spacewalk' key in configurationr T)Zfqdnr r )r r zOSkipping module named %s, 'spacewalk/server' key was not found in configuration)r debuggetZdistroZinstall_packagesrequired_packagesr r Z
datasourceZget_hostnameZhostname)r r r r Zspacewalk_serverr r r handleZ s$
r% )__doc__Zloggingtextwrapr Z cloudinitr Zcloudinit.cloudr Zcloudinit.configr Zcloudinit.config.schemar r Zcloudinit.settingsr ZMODULE_DESCRIPTIONmetaZ getLogger__name__r r r$ Zdef_ca_cert_pathr r r listr% r r r r s6