3 \me @sUdZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZd Zd d d ed ddgeedgdgdZe e eZejeZddgZdgZdZddZeddfddZee eeddddZdS)z*Spacewalk: Install and configure spacewalkN)dedent)subp)Cloud)Config) MetaSchema get_meta_doc) PER_INSTANCEaThis 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/ Z cc_spacewalkZ SpacewalkzInstall and configure spacewalkZrhelZfedoraZ openeulerz spacewalk: server: proxy: activation_key: spacewalk)idnametitle descriptiondistrosZ frequencyZexamplesZactivate_by_schema_keysZredhatz rhn-setupz'/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERTcCsTd}ytjddgddd}Wn0tjk rN}z|jdkr>WYdd}~XnX|S)NFzrhn-profile-syncz --verbose)captureT)rZProcessExecutionErrorZ exit_code)Zalready_registereder"/usr/lib/python3.6/cc_spacewalk.py is_registered4s rcCstjd||dg}|jdd|g|jdt|g|rN|jdt|g|rd|jdt|g|rz|jdt|gtj|d d dS) Nz;Registering using `rhnreg_ks` profile '%s' into server '%s'Z rhnreg_ksz --serverUrlzhttps://%s/XMLRPCz --profilenamez--proxyz --sslCACertz--activationkeyF)r)LOGinfoextendstrr)serverZ profile_nameZ ca_cert_pathproxyactivation_keycmdrrr do_registerBsr)r cfgcloudargsreturncCszd|krtjd|dS|d}|jd}|rj|jjttsvt||jj ddj |jd|jddn tjd |dS) Nr z=Skipping module named %s, no 'spacewalk' key in configurationrT)Zfqdnrr)rrzOSkipping module named %s, 'spacewalk/server' key was not found in configuration) rdebuggetZdistroZinstall_packagesrequired_packagesrrZ datasourceZ get_hostnameZhostname)r rrr Zspacewalk_serverrrrhandleZs$  r%)__doc__ZloggingtextwraprZ cloudinitrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrZcloudinit.settingsrZMODULE_DESCRIPTIONmetaZ getLogger__name__rrr$Zdef_ca_cert_pathrrrlistr%rrrrs6