Server IP : 127.0.0.2 / Your IP : 3.148.206.183 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/cloudinit/config/ |
Upload File : |
# This file is part of cloud-init. See LICENSE file for license information. """ Spacewalk --------- **Summary:** install and configure spacewalk 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/ **Internal name:** ``cc_spacewalk`` **Module frequency:** per instance **Supported distros:** redhat, fedora **Config keys**:: spacewalk: server: <url> proxy: <proxy host> activation_key: <key> """ from cloudinit import subp distros = ['redhat', 'fedora'] required_packages = ['rhn-setup'] def_ca_cert_path = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" def is_registered(): # Check to see if already registered and don't bother; this is # apparently done by trying to sync and if that fails then we # assume we aren't registered; which is sorta ghetto... already_registered = False try: subp.subp(['rhn-profile-sync', '--verbose'], capture=False) already_registered = True except subp.ProcessExecutionError as e: if e.exit_code != 1: raise return already_registered def do_register(server, profile_name, ca_cert_path=def_ca_cert_path, proxy=None, log=None, activation_key=None): if log is not None: log.info("Registering using `rhnreg_ks` profile '%s'" " into server '%s'", profile_name, server) cmd = ['rhnreg_ks'] cmd.extend(['--serverUrl', 'https://%s/XMLRPC' % server]) cmd.extend(['--profilename', str(profile_name)]) if proxy: cmd.extend(["--proxy", str(proxy)]) if ca_cert_path: cmd.extend(['--sslCACert', str(ca_cert_path)]) if activation_key: cmd.extend(['--activationkey', str(activation_key)]) subp.subp(cmd, capture=False) def handle(name, cfg, cloud, log, _args): if 'spacewalk' not in cfg: log.debug(("Skipping module named %s," " no 'spacewalk' key in configuration"), name) return cfg = cfg['spacewalk'] spacewalk_server = cfg.get('server') if spacewalk_server: # Need to have this installed before further things will work. cloud.distro.install_packages(required_packages) if not is_registered(): do_register(spacewalk_server, cloud.datasource.get_hostname(fqdn=True), proxy=cfg.get("proxy"), log=log, activation_key=cfg.get('activation_key')) else: log.debug("Skipping module named %s, 'spacewalk/server' key" " was not found in configuration", name) # vi: ts=4 expandtab